/* Сценарии сайта. 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 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,toolbar=no, menubar=no, titlebar=no, scrollbars="+s+",resizable="+r+",width="+w+",height="+h+pos); // если смотрового окна нет
}

function win(url,wname,w,h,r) {
// if (b) { // проверка броузера
   newWin = window.open(url,wname,"toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable="+r+",width="+w+",height="+h);
// }
}




function doLoad(value) {

 var pos = value.indexOf(',');
 var s   = value.substring(0,pos);



    // 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, '/load.php', true);
    // Send data to backend.
    req.send( { q: value } );

}









function print_span(email, text, event) {

	document.write('<span id= \''+ email[0] +'\' ' + event + '="javascript:doLoad(\''+ email +'\');"><a href="mailto:">'+text+'</a></span>');

}


// Главное меню
function navhover(id) {  var childs = document.getElementById("globalLink").childNodes;
  var j = 0;
  for (var i=0; i<childs.length; i++) {
    if (childs[i].nodeName == "A") {      j++;
      var cursub = document.getElementById("subglobal"+j);      if (id == j) {        childs[i].className = "glink glinkactive";
        cursub.style.visibility = "visible";
      } else {
        childs[i].className = "glink";
        cursub.style.visibility = "hidden";
      }
    }
  }
}

// Меню моделей
function navautohover(id) {
  var childs = document.getElementById("autohead").childNodes;
  var j = 0;
  for (var i=0; i<childs.length; i++) {
    if (childs[i].nodeName == "DIV") {
      j++;
      var cursub = document.getElementById("subauto"+j);
      if (id == j) {
        childs[i].className = "alink alinkactive";
        cursub.style.visibility = "visible";
      } else {
        childs[i].className = "alink";
        cursub.style.visibility = "hidden";
      }
    }
  }
}

// end
