/* Сценарии сайта. http://vitalik.info/design */

 if ((navigator.appName.indexOf("Netscape")!=-1) && (parseInt(navigator.appVersion) >= 3)) var b="nn";
 if ((navigator.appName.indexOf("Explorer")!=-1) && (parseInt(navigator.appVersion) >= 3)) var b="ie";

function ask(url) {
 if (confirm ('Вы уверены?!'))
  self.location=url;
}
function askform(url) {
 return confirm ('Вы уверены?!');
}
function askmsg(url,msg) {
 if (confirm (msg))
  self.location=url;
}

function newwin(url,wname,w,h,r,s) {
   var posX = (screen.width - w) / 2;
   var posY = (screen.height - h) / 2;
   var pos = ",top="+posY+",left="+posX;
   newWin = open(url,wname,"toolbar=0,location=0,status=0,menubar=1,scrollbars="+s+",resizable="+r+",width="+w+",height="+h+pos); // если смотрового окна нет
}

function win(url,wname,w,h,r) {
   newWin = open(url,wname,"toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable="+r+",width="+w+",height="+h);
}

function toggle_block(eid) {
 if (document.getElementById(eid).style.display == 'none') {
   document.getElementById(eid).style.display='block';
   document.getElementById(eid+'_').style.display='none';
 } else {
   document.getElementById(eid).style.display='none';
   document.getElementById(eid+'_').style.display='block';
 }
}

function toggle_b(eid) {
 if (document.getElementById(eid).style.display == 'none') {
   document.getElementById(eid).style.display='block';
 } else {
   document.getElementById(eid).style.display='none';
 }
}

function doLoad(value,num) {

 var pos = value.indexOf(',');
 var s   = value.substring(0,pos) + num;



    // Create new JsHttpRequest object.
    var req = new JsHttpRequest();

    // Code automatically called on load finishing.
    req.onreadystatechange = function() {
    if (req.readyState == 4) {
            
         
         document.getElementById(s).innerHTML = req.responseJS.q;
		       		  	       
    }  


    }
    // Prepare request object (automatically choose GET or POST).
    req.open(null, '/include/load.php', true);
    // Send data to backend.
    req.send( { q: value } );

}


function print_span(email, text, event,num) {

  if (!num) { 

      var m = 1;
      var n = 100;

      num =  Math.floor(Math.random() * (n-m+1)) +m; 
  }

  document.write('<span id= \''+ email[0] + num + '\' ' + event + '="javascript:doLoad(\''+ email + '\',\'' + num  +'\');"><a href="mailto:">'+text+'</a></span>');
     
}

// end