var r1=r2=r3=r4=0;

	// среднее меню
function li_1(este,fl){
if(fl==1){
este.className='foc';
}else if (fl==2){
este.className='real';
}}

	// среднее меню
function menu_1(este,fl){
if(fl==1){
este.parentElement.setAttribute("className", "blist6");
}else if (fl==2){
este.parentElement.setAttribute("className", "news1");
}}


function Pre_target(este,url){

	vname = este.children.tags('TD');
	for(i=0;i<vname.length;i++){
	 elm=vname[i];
       	 elm.setAttribute("onmouseover", function (){Target(this,1,url)});
	}
}


function Target(este,fl,url){

	oldid = este.getAttribute("id");
	este.setAttribute("id", "u1");

	vname = este.parentElement.children.tags('TD');
	for(i=0;i<vname.length;i++){
	 elm=vname[i];
	 if(elm.getAttribute('id')=="u1") {tnum = i;break;}
	}
	vname = este.parentElement.parentElement.children.tags('TR');
	for(i=2;i<vname.length-4;i++){
	 elm=vname[i].children.tags('TD');
	 if(elm[tnum]) {
	     if(fl==1){
		elm[tnum].setAttribute("className", "ost4");
      	     }else{
		elm[tnum].setAttribute("className", "");
	     }	
	 }
	}
	este.setAttribute("id", oldid);

if(fl==1){
	este.parentElement.setAttribute("className", "ost4");
	este.setAttribute("onmouseout", function (){Target(this,2)});

	vname = este.parentElement.children.tags('TD');
	for(i=2;i<vname.length;i++){
	 // для цены
	 if(i==vname.length-2){continue;}

	  if(url){
	  vname[i].setAttribute("onclick", function (){window.open(url);});
	  vname[i].setAttribute("title", "нажмите чтобы перейти на сайт хостера");
	  }
	}

//       vname[2].background = "/img/tb_strel.gif";

         if(vname[1].children.tags('A')[0]){
	 vname[1].children.tags('A')[0].setAttribute("href", "javascript:void(0)");
	 vname[1].children.tags('A')[0].setAttribute("onclick", function (){window.open(url);});
	 vname[1].children.tags('A')[0].setAttribute("title", "нажмите чтобы перейти на сайт хостера");
	 }

}else if (fl==2){
	este.parentElement.setAttribute("className", "");
}}


	// открытие меню поиска
function open_select(){
var home   = document.getElementById('OpenSelect');
var asearh = document.getElementById('asearh');

home.style.display = (home.style.display=='none')?('block'):('none');
asearh.innerText   = (home.style.display=='none')?('Открыть условия поиска'):('Скрыть условия поиска');

return true;
}


	// открытие меню
function open_mselect(este,id,text){

var home   = document.getElementById(id);

home.style.display = (home.style.display=='none')?('block'):('none');
este.innerText   = (home.style.display=='none')?('+ '+text):('- '+text);

return true;
}




function tabSwitch(tabId) {
	
	var tab = document.getElementById(tabId);
	var li_node = tab.parentNode;
	tab.style.display = 'block';
	li_node.style.position = 'relative';
}
function nd(tabId) {
	var tab = document.getElementById(tabId);
	tab.style.display = 'none';
	var li_node = tab.parentNode;
	li_node.style.position = 'static';
	
	return true;
}


function PreSubmit(type){
	vname=Array();
	for(i=0;i<document.forms.HGF.elements.length;i++){
	 elm=document.forms.HGF.elements[i];
 
	    if (elm.type=="checkbox" && elm.name=="sid[]") {
	        if ( elm.checked && elm.value!="") {
	          vname.push(elm.value);
	        }
	    }
	}
	if(vname.length<2) {alert("Ошибка! Выберите пункты подлежащие сравнению!");return false;}
	if(vname.length>10) {alert("Ошибка! Выберите не более 10 пунктов для сравнения!");return false;}

	// отправить на обработку

	if(type) {
	        sid = vname.join(",");
		oShop(type,sid);}

	return true;
}

function CheckAll(este){

	vname=Array();
	for(i=0;i<document.forms.HGF.elements.length;i++){
	 elm=document.forms.HGF.elements[i];
	 
	    if (elm.type=="checkbox") {
	        if ( elm.name=="sid[]") {
	          if(este.checked){elm.checked=true;}
	          if(!este.checked){elm.checked=false;}
	        }
	    }

	}
	return true;
}



function Tar(id,up){
var al = up?0:1;
var up = up?up:"none";
	este = document.getElementById(id);
	vname = este.parentElement.children.tags('A');
	for(i=0;i<vname.length;i++){
	 elm=vname[i];
	 eid = elm.getAttribute('id');
	 if(eid!='') {
	        $start = (eid==id)?1:0; 
		if($start && up=='none'){
               	elm.setAttribute("active", 0);
		}
                if($start && up=='block'){
               	elm.setAttribute("onclick",  function(){Tar(this.getAttribute('id'),'none')});
               	elm.setAttribute("active", 1);
               	}else{
               	if(elm.getAttribute("active")!=1){
               	elm.setAttribute("dblclick",  function(){Tar(this.getAttribute('id'),'none')});
               	elm.setAttribute("onclick",  function(){Tar(this.getAttribute('id'),'block')});
               	elm.setAttribute("active", 0);
               	}
		}
		continue;}
	   if((!al && $start) || al){
           elm.style.display=up;
       	   elm.setAttribute("className", "author");
       	   elm.setAttribute("onmouseover", function(){this.className='blist11'});
       	   elm.setAttribute("onmouseout", function(){this.className='author'});
           }
	}
}


