if(document.getElementById) document.write('<style type="text/css">TR.subdiv{display:none }</style>');
var is = new Is();
function Is(){
  this.agent=navigator.userAgent.toLowerCase();
  this.opera = (this.agent.indexOf('opera')!=-1) ? true:false;
  this.ie4 = ((this.agent.indexOf('msie')!=-1) && (this.agent.indexOf('opera')==-1)) ? true:false;
  this.ns6 = ((this.agent.indexOf('gecko')!=-1) && (this.agent.indexOf('opera')==-1)) ? true:false;
  this.ns4 = ((this.agent.indexOf('mozilla')!=-1) && (this.agent.indexOf('opera')==-1) && (this.agent.indexOf('msie')==-1) && (this.agent.indexOf('gecko')==-1)) ? true:false;
}

function SwapImage(id,mode){
  var img = document.images[id].src;
  if(mode==1) document.images[id].src=img.substr(0,img.length-4)+'_pr.'+img.substr(img.length-3,img.length);
  if(mode==0) document.images[id].src=img.substr(0,img.length-7)+'.'+img.substr(img.length-3,img.length);  
}

divover="#99ccff"; //div over color
divcolor=["#609dcc","#6cb1e5"]; // div lever colors

//subdivcolor1="#d6dbe7"; // Subdiv non active color
//subdivcolor3="#d6dbe7"; // Subdiv active color

function hilitediv(myobj,mode,level){
  kids = myobj.childNodes;
  if(mode==0){
    color=divcolor[level];
  }
  if(mode==1){
    color=divover;
    try{ myobj.style.cursor="pointer"; } catch (a){}
    try{ myobj.style.cursor="hand"; } catch (a){}
    
  }
  if(mode==3){ // color of the active div
    color="#548ab3";
  }
  myobj.style.Color=color;
  for(var i=0; i<kids.length; i++){
    if(kids[i].nodeName=='TD'){
      kids[i].style.Color=color;
    }
  }
}

/* What it is ? */
subdivcolor2="green";
subdivcolor4="yellow";
subdivcolor5="black";
subdivcolor6="cyan";

function hilitesubdiv(myobj,mode){
/*  kids = myobj.childNodes;
  if(mode==0){
    color1=subdivcolor1;
    color2=subdivcolor2;
  }
  if(mode==1){
    color1=subdivcolor3;
    color2=subdivcolor4;
    try{ myobj.style.cursor="pointer"; } catch (a){}
    try{ myobj.style.cursor="hand"; } catch (a){}
  }
  if(mode==3){
    color1=subdivcolor5;
    color2=subdivcolor6;
  }
  for(var i=0; i<kids.length; i++){
    if(kids[i].nodeName=='TD'){
      kids[i].style.backgroundColor=color1;
    }
  }*/
}

function opendiv(id){
	var display='none';
	with(document.getElementById("subdiv"+id)){
		if(innerHTML!='<TD></TD>' && (style.display=='none' || style.display=='')) 
			display=(is.ie4)?'block':'table-row';
		style.display=display;
	}
}

function OpenImg(src, width, height, target, scrollbars)
{
 win=window.open('',target.replace(/\./,"_"),'width='+width+',height='+height+',hotkeys=1,resizable=yes,scrollbars='+scrollbars);
 win.document.write('<html><head></head><body marginwidth=0 marginheight=0 style="margin:0 0 0 0; padding:0 0 0 0;">');
 win.document.write('<IMG src="'+src+'" alt="" width="'+width+'" height="'+height+'">');
 win.document.write("</body></html>");
 win.focus();
 win.document.close();
}
function checksearchform()
{
 if (document.searchf.producer.value==0 && document.searchf.model.value.length==0) {alert("Укажите название товара или производителя!");return false;}
 if(document.searchf.ftype[0].checked==false && document.searchf.ftype[1].checked==false && document.searchf.ftype[2].checked==false) {alert("Укажите режим поиска!");return false;}
 if (document.searchf.model.value.replace(/ /g,"").length==1) {alert("Укажите более одной буквы!");return false;}
 return true;
}
