

contact_file_count=0;

function ajax_load(url,objectID)

{

    var http_request = false;



    if (window.XMLHttpRequest) { // Mozilla, Safari,...

        http_request = new XMLHttpRequest();

        if (http_request.overrideMimeType) {

            http_request.overrideMimeType('text/xml');

            // See note below about this line

        }

    } else if (window.ActiveXObject) { // IE

        try {

            http_request = new ActiveXObject("Msxml2.XMLHTTP");

        } catch (e) {

            try {

                http_request = new ActiveXObject("Microsoft.XMLHTTP");

            } catch (e) {}

        }

    }



    if (!http_request) {

        return false;

    }



    document.getElementById(objectID).innerHTML='';



    http_request.onreadystatechange = function () { outputData(http_request,url,objectID) };

    http_request.open('GET', url, true);

    http_request.send(null);

};



function outputData(http_request,url,param)

{

    if (http_request.readyState == 4) {

        if (http_request.status == 200) {

            document.getElementById(param).innerHTML=http_request.responseText;

            try {

                data_frame_fit();

            } catch (e) {};

        }

    }

}



function callme()

{

    number=document.getElementById('callback_number').value;

    url="./callback.php?callback_number="+number;

    ajax_load(url,'callback');

};







function votebutton()

{

var c=10;

var selIndex = -1;

for (var i=1; i<c; i++){

        if (document.getElementById('golos_'+i)){

                if (document.getElementById('golos_'+i).checked==true){

                        selIndex=i;

                }

        }

}

if (selIndex==-1) {

        alert ("Вы Не Выбрали Вариант Ответа !!!");

        return;

}

    url="./golos911.php?golos="+selIndex;

    ajax_load(url,'voteform');

};


function ajax_open_modal_element(url) {
    el=document.getElementById('overlay');
    el.style.display = 'block'; //(el.style.visibility == "visible") ? "hidden" : "visible";
    ajax_load(url,'overlay'); 
    document.location='#'; 
}; 

function dek_kill_element(element_id)
{
    var dek_element=document.getElementById(element_id);
    dek_element.style.display='none';
};

function openw(theURL,winName,features) {
    window.open(theURL,winName,features);
};



function SetHomePage(b){
    if($.browser.msie) {
	try{
	    b.style.behavior="url(#default#homepage)";
	    b.setHomePage(b.href);
	}
	catch(c){
	}
	return false
    };
    if($.browser.mozilla) {
	try{
	    b.style.behavior="url(#default#homepage)";
	    document.location.href="http://kurkino.net.ru/page/homepage_set.php?br=mozilla&home="+b.href; 
	}
	catch(c){
	}
	return false
    };
    if($.browser.opera) {
	try{
	    b.style.behavior="url(#default#homepage)";
	    document.location.href="http://kurkino.net.ru/page/homepage_set.php?br=opera&home="+b.href; 
	}
	catch(c){
	}
	return false
    };
    if($.browser.chrome) {
	try{
	    b.style.behavior="url(#default#homepage)";
	    document.location.href="http://kurkino.net.ru/page/homepage_set.php?br=chrome&home="+b.href; 
	}
	catch(c){
	}
	return false
    };
    if($.browser.safari) {
	try{
	    b.style.behavior="url(#default#homepage)";
	    document.location.href="http://kurkino.net.ru/page/homepage_set.php?br=safari&home="+b.href; 
	}
	catch(c){
	}
	return false
    };


};




function contact_apping_file_form(iddev) {
    contact_file_count=contact_file_count+1;
    var newDiv = document.createElement('div')
    newDiv.innerHTML='';
    if (contact_file_count==1) {
	newDiv.innerHTML+='<font color="red">* ВНИМАНИЕ! Общий объем файлов не должен превышать 10мегабайт!</font><br/>';
	document.getElementById("emailfilereq").value='Добавить ещё форму для отправки файлов';
    };
    if (contact_file_count<=10) {
	newDiv.innerHTML+=contact_file_count+') <input type=\'file\' name=\'mail_file_'+contact_file_count+'\' /><br/>';
    } else {
	newDiv.innerHTML+='<font color="red">Вы не можете прикрепить больше 10 файлов!</font><br/>';
    };
    document.getElementById(iddev).appendChild(newDiv)
};

function sendmailform() {
    var err='';
    if(emailform.mail_name.value=='')  { err+=" Вы не указали своё имя... \n"; };
    if(emailform.mail_email.value=='') {
	err+=" Вы не указали свой email адрес... \n";
    } else {
	email=emailform.mail_email.value;
	email.replace(/^\s+|\s+$/g, '');
	testemail=(/^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,4}$/i).test(email);
	if(!testemail) { err+=" Вы указали не верный email адрес. Адрес должен выглядеть так: name@domain.zone и собержать только: A-Z 0-9 - _ @ . \n"; };
    };
    if(emailform.mail_subj.value=='')  { err+=" Вы не написали тему письма... \n"; };
    if((!emailform.mail_to[0].checked) && (!emailform.mail_to[1].checked) && (!emailform.mail_to[2].checked) && (!emailform.mail_to[3].checked) && (!emailform.mail_to[4].checked))    { err+=" Вы Не выбрали направление(получателя) письма... \n"; };
    if(emailform.mail_text.value=='')  { err+=" Вы не написали текст письма... \n"; };

    if(err=='') {
	emailform.submit();
    } else {
	alert(err);
    };
};




function text_over(text)
{
    tt = document.createElement('div');
    document.body.appendChild(tt);
    tt.innerHTML = text;
    tt.style.position = 'absolute';
    tt.style.background = '#FFFFFF';
    tt.style.border = 'solid 1px #346fdc';
    tt.style.padding = '4px';
    text_move();
}
function text_move(e)
{
    e = e || window.event
    tt.style.left = e.pageX - 85 + 'px';
    tt.style.top = e.pageY + 25 + 'px';
}
function text_out()
{
    document.body.removeChild(tt);
}




//    var prev = 0;
function all_terminal_view(cid){
    document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none";
}


