var loc1opened=0;

function changePic(pic,item){
bigpic.src=pic;
btns = document.getElementsByName('smallpic'); 
for (i = 0; i < btns.length; i++){ 
if (i==item){btns[i].className="border2";}
else{btns[i].className="corner1_1";}
}

btns = document.getElementsByName('smallpic2'); 
for (i = 0; i < btns.length; i++){ 
if (i==item){btns[i].className="padpic2";}
else{btns[i].className="padpic";}
}

btns = document.getElementsByName('smallpic3'); 
for (i = 0; i < btns.length; i++){ 
if (i==item){btns[i].className="";}
else{btns[i].className="corner4";}
}

btns = document.getElementsByName('smallpic4'); 
for (i = 0; i < btns.length; i++){ 
if (i==item){btns[i].className="";}
else{btns[i].className="corner3";}
}

btns = document.getElementsByName('smallpic5'); 
for (i = 0; i < btns.length; i++){ 
if (i==item){btns[i].className="";}
else{btns[i].className="corner2_1";}
}

}

function animOn(){
topbar.style.display="block";
thison.innerHTML='<table cellspacing=0 cellpadding=0 border=0 width=123><td valign=top><img src=/img/on.gif width=116 height=12 onclick=animOff(); style="cursor:hand;cursor:pointer;"></td></table>';
var isanim2 = "isanim=on; path=/;";
document.cookie = isanim2;
}

function animOff(){
topbar.style.display="none";
thison.innerHTML='<table cellspacing=0 cellpadding=0 border=0 width=123><td valign=top><img src=/img/off.gif width=123 height=12 onclick=animOn(); style="cursor:hand;cursor:pointer;"></td></table>';
var isanim2 = "isanim=off; path=/;";
document.cookie = isanim2;
}


function OverMenu(id){
if (id==1){menu1.src="/img/sklad_.gif";}
if (id==2){menu2.src="/img/contacts_.gif";}
if (id==3){menu3.src="/img/production_.gif";}
if (id==4){menu4.src="/img/gallery_.gif";}
if (id==5){menu5.src="/img/about_.gif";}
if (id==6){menu6.src="/img/clients_.gif";}
if (id==7){menu7.src="/img/vac_.gif";}
if (id==8){menu8.src="/img/price_.gif";}
}

function OutMenu(id){
if (id==1){menu1.src="/img/sklad.gif";}
if (id==2){menu2.src="/img/contacts.gif";}
if (id==3){menu3.src="/img/production.gif";}
if (id==4){menu4.src="/img/gallery.gif";}
if (id==5){menu5.src="/img/about.gif";}
if (id==6){menu6.src="/img/clients.gif";}
if (id==7){menu7.src="/img/vac.gif";}
if (id==8){menu8.src="/img/price.gif";}
}

function checkMovie(rolik,rolik2,isplay){

if (isplay==0){
if (navigator.appName.indexOf("Microsoft") != -1){
document.all.handplay.innerHTML='<img src=/img/handstop.jpg width=41 id=handpic height=33 border=0 style="cursor:hand;" onclick=checkMovie('+rolik2+',1);>';
document.all.mmovie.movie="/download/"+rolik;
}
else{document.all.thefilm.innerHTML = '<EMBED src="/download/'+rolik+'" quality=high scale=noborder wmode=transparent WIDTH="186" HEIGHT="102" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" id="special" MAYSCRIPT></EMBED>';}
mmovie.Play();
}


}



function ShowFotoX(page,id,widt,heit,bro){
if (window.big_item){big_item.close();}
if (bro==0){hei=((screen.height-heit)/2-30);wid=((screen.width-widt)/2);big_item=window.open("/showfotox/"+page+"/"+id+"/","mapp","width="+(widt-4)+",height="+(heit-4)+",screenX=0,screenY=0,left="+wid+",top="+hei+",scrollbars=no");big_item.focus();}
if (bro==1){widt=widt+8;heit=heit+8;hei=((screen.height-heit)/4);wid=((screen.width-widt)/2);big_item=window.open("/showfotox/"+page+"/"+id+"/","mapp","width="+(widt-8)+",height="+(heit-8)+",screenX=0,screenY=0,left="+wid+",top="+hei+",scrollbars=no");big_item.focus();}
}


function getBrowserInfo() {
 var t,v = undefined;
 if (window.opera) t = 'Opera';
 else if (document.all) {
  t = 'IE';
  var nv = navigator.appVersion;
  var s = nv.indexOf('MSIE')+5;
  v = nv.substring(s,s+1);
 }
 else if (navigator.appName) t = 'Netscape';
 return {type:t,version:v};
}
 
function bookmark(a){
 var url = window.document.location;
 var title = window.document.title;
 var b = getBrowserInfo();
 if (b.type == 'IE' && b.version >= 4) window.external.AddFavorite(url,title);
 else if (b.type == 'Opera') {
  a.href = url;
  a.rel = "sidebar";
  a.title = url+','+title;
  return true;
 }
 else if (b.type == "Netscape") window.sidebar.addPanel(title,url,"");
 else alert("Нажмите CTRL-D, чтобы добавить страницу в закладки.");
 return false;
}


function getAuto(str,id){
if (str.length>0){
var req = getXmlHttp();

req.onreadystatechange = function() {  
// onreadystatechange активируется при получении ответа сервера
if (req.readyState == 4) { 
// если запрос закончил выполняться
//statusElem.innerHTML = req.statusText // показать статус (Not Found, ОК..)
if(req.status == 200) { 
// если статус 200 (ОК) - выдать ответ пользователю
document.getElementById("loc"+id).innerHTML=req.responseText;
if (req.responseText.length>0){
document.getElementById("loc"+id).className="loc";
if (id==1){loc1opened=1;}
if (id==2){loc2opened=1;}
setTimeout("locOpenState("+id+")",5);
}
else{
document.getElementById("loc"+id).className="shownone";
}
}
// тут можно добавить else с обработкой ошибок запроса
}
}
// (3) задать адрес подключения
req.open('GET', '/getAuto.php?str='+encodeURI(str)+"&id="+id, true);  

// объект запроса подготовлен: указан адрес и создана функция onreadystatechange
// для обработки ответа сервера
// (4)
req.send(null);  // отослать запрос
}
else{
document.getElementById("loc"+id).className="shownone";
}
}


function getXmlHttp(){
  var xmlhttp;
  try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    try {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
      xmlhttp = false;
    }
  }
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
  }
  return xmlhttp;
}

function doSub(city,id){
if(id==1){document.getElementById("orgcity").value=city;}
document.getElementById("loc"+id).className="shownone";
}

function closeFunction(){
if (loc1opened==2){document.getElementById("loc1").className = "shownone"; loc1opened=0;}
}

function locOpenState(id){
if(id==1){loc1opened=2;}
}
