browser_name = navigator.appName;
browser_version = parseFloat(navigator.appVersion);

if (browser_name == "Netscape" && browser_version >= 3.0) { roll = 'true'; }
else if (browser_name == "Microsoft Internet Explorer" && browser_version >= 3.0) { roll = 'true'; }
else { roll = 'false'; }

function over(img,ref) { if (roll == 'true') { document.images[img].src = ref; } }
function out(img,ref)  { if (roll == 'true') { document.images[img].src = ref; } }

function preloadImg(file){
  image = new Image();
  image.src = file;
}

function rol_img() {
preloadImg('img/menu/catalog-on.gif');
preloadImg('img/menu/prices-on.gif');
preloadImg('img/menu/news-on.gif');
preloadImg('img/menu/forum-on.gif');
preloadImg('img/menu/dillers-on.gif');
preloadImg('img/menu/contacts-on.gif');
preloadImg('img/menu/articles-on.gif');
preloadImg('img/menu/about-on.gif');
preloadImg('img/menu/filials-on.gif');

preloadImg('img/menu/akcii-on.gif');
preloadImg('img/menu/files-on.gif');

preloadImg('img/menu/main-on.gif');
}

function rol_imgEn() {
preloadImg('img/en/menu/contact_us-on.gif');
preloadImg('img/en/menu/news-on.gif');
preloadImg('img/en/menu/about_us-on.gif');
}

function HideShow (par,t) {
var lay=document.getElementById(par);

if (t==0) { lay.style.visibility="visible"; lay.style.display="block";}
if (t==1) { lay.style.visibility="hidden"; lay.style.display="none"; }

}

function selectModel (td,color,colorf) {
arrayOfStrings = td.split("|");
for (var i = 0; i < arrayOfStrings.length; i++) {
	document.getElementById(arrayOfStrings[i]).style.background=color; 
	document.getElementById(arrayOfStrings[i]).style.color=colorf;
	}
}

function menu (td,p,color,colorf,img)
{
if (p==1) {
document.getElementById(td).style.color=colorf;
document.getElementById(td).style.fontSize=img;
}
if (p==2) {
document.getElementById(td).style.background=color+' url(img/'+img+') no-repeat right'; 
document.getElementById(td).style.color=colorf; 
}
if (p==3) {
document.getElementById(td).style.background=color+' url(img/'+img+') no-repeat center'; 
document.getElementById(td).style.color=colorf; 
document.getElementById(td).style.textDecoration="underline"; 
}

}
function menuIns (td,p,color,colorf,img)
{
if (p==1) {
document.getElementById(td).style.background=color+' url(img/'+img+') no-repeat left'; 
//document.getElementById(td).style.color=colorf;
//document.getElementById(td).style.textDecoration="underline"; 
}
if (p==2) {
document.getElementById(td).style.background=color+' url(img/'+img+') no-repeat center top'; 
//document.getElementById(td).style.color=colorf;
document.getElementById(td).style.textDecoration="none"; 
}

}

function menuImg (td,p,color,colorf)
{
if (p==1) {
document.getElementById(td).style.backgroundImage='url(img/'+color+')'; 
document.getElementById(td).style.color=colorf;
}
if (p==2) {
document.getElementById(td).style.backgroundImage='url(img/'+color+')';
document.getElementById(td).style.color=colorf; 
}

}

function add_click (url,target) {
if (url) {
//alert("Debug:"+url);
//alert("Debug:"+target);
if (target=="_parent") {
parent.location.href=url;
}
if (target=="_blank") {
window.open(url);
}
if (target=="_self") {
location.href=url;
}
if (target=="_top") {
top.location.href=url;
}
}//end if !url
}

function fast_catalog(param){
if (param==0) return true;
	
var len = document.fas_cat.length ;
  
for(var i=0; i<len; i++){ 

if(document.fas_cat.elements[i].tagName == "SELECT" ){

    document.fas_cat.elements[i].style.visibility='hidden';
	 document.fas_cat.elements[i].style.display='none';

	}
}
   

	document.getElementById(param).style.visibility='visible';
	document.getElementById(param).style.display='block';
	
	


}

function fast_catalog2(param){
var len = document.fas_cat.length ;
  
for(var i=0; i<len; i++){ 
//alert(document.fas_cat.elements[i].tagName);    
if(document.fas_cat.elements[i].tagName == "SELECT"  &&  document.fas_cat.elements[i].name == "cat2"){

    document.fas_cat.elements[i].style.visibility='hidden';
	 document.fas_cat.elements[i].style.display='none';

	}
}

if (param==0) {
	document.getElementById("parent_id").value='';
	document.fas_cat_sub.action.value='cat';
	return true;
}else{
	document.getElementById(param).style.visibility='visible';
	document.getElementById(param).style.display='block';
	
	document.getElementById("parent_id").value=param;
	document.fas_cat_sub.action.value='cat';
}	

}

function fast_catalog3(param){
if (param==0) return true;
	document.getElementById("parent_id").value=param;
	document.getElementById("action").value='prod';
	document.fas_cat_sub.action.value='prod';
}

function valid_subscriber(){

		validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
		

	    
		if (document.subscribe.name.value == ""){
				alert('Неверное имя');
				return false;
		} 
		if (document.subscribe.company.value == ""){
				alert('Неверное имя компании');
				return false;
		}
		if (document.subscribe.city.value == ""){
				alert('Неверный город');
				return false;
		}
		if (document.subscribe.email.value.search(validRegExp) == -1)  {
	      alert('Неверный e-mail адрес');
	      return false;
	    } 
 return true; 


}

function search(){
		if (document.search.search_all.value == ""){
				alert('Неверный шаблон для поиска');
				
		} else{
			document.search.d.value =	'search';
			document.search.action.value =	'search';
			document.search.submit()
		}
}

function  search_diler(){
		if (document.search.search_dil.value == "" || document.search.search_dil.value == "населенный пункт"){
				alert('Неверный шаблон для поиска');
		} else{
				document.search.d.value =	'filial';
				document.search.action.value =	'search';
				document.search.submit()
		}

}
