//Выпадающее меню
	<!--//--><![CDATA[//><!--
		jsHover = function() {
			var hEls = document.getElementById("nav").getElementsByTagName("li");
			for (var i=0, len=hEls.length; i<len; i++) {
				hEls[i].onmouseover=function() { this.className+=" jshover"; }
				hEls[i].onmouseout=function() { this.className=this.className.replace(" jshover", ""); }
			}
		}
		if (window.attachEvent && navigator.userAgent.indexOf("Opera")==-1) window.attachEvent("onload", 
	
	jsHover);
	//--><!]]>

function hoverMenu(id) {

    row = document.getElementById('row'+id)
    
    if(row.className == 'mainrow') {
    
        row.className = 'hover_row';
    
    } else {
    
        row.className = 'mainrow';
    
    }

}

function hoverMenuDd(id) {

    row = document.getElementById('rowdd'+id);
    if(row.className == 'mainrow_dd') {
    
        row.className = 'hover_row_dd';
    
    } else {
    
        row.className = 'mainrow_dd';
    
    }

}

//для меню третьего уровня
function hide3yj(id) {
	document.getElementById('ddm_block3yj'+id).style.display = 'none';
}
function show3yj(id) {
    clearTimeout(t);
	hide3();
    document.getElementById('ddm_block3yj'+id).style.display = '';
	//alert(document.getElementById('ddm_block3yj'+id).style.display);
	return true;
//alert('ok');
}

function hide() {
    for (i=1; i<9; i++) {
	   if (block = document.getElementById('ddm_block'+i)) {
	        if (block!=undefined) block.style.display= 'none';
       }
	}
}

function hide3() {
	for (i=10; i<20; i++) {
	   if (block = document.getElementById('ddm_block3yj'+i)){
			if (block!=undefined) block.style.display= 'none';
	   }
	}
}

function show(id) {
    clearTimeout(t);
    hide();
    block = document.getElementById('ddm_block'+id);
	block.style.display	= '';
	return true;
//alert('ok');
}

function submitForm() {

    if (!document.getElementById('keyword').value || document.getElementById('keyword').value =='') {

        alert('Введите слово для поиска по сайту!');

    } else {

        document.search.submit('search.php');
alert(ok);
    }

}

function openWin(n) {
	childWin=open("templates/gallery_view.php?link="+n, "ChildWin","scrollbars,width=500,height=400");
}

function openWin_all(n,target,title) {
	childWin=open("templates/gallery_view.php?link="+n+"&target="+target+"&title="+title, "ChildWin","width=610,height=610");
}

function calc() {
	pp = document.getElementById('field1').value;
	gp = document.getElementById('field2').value;
	gbop = document.getElementById('field3').value;
	rp = document.getElementById('field4').value;

	if (!pp || !gp || !gbop || !rp) {

		alert('Введите данные для расчета!');

	} else if (pp <= gp) {
	
		alert('Введены недопустимые данные!');
	
	} else {
	
		rg = rp * 1.1;
		rg = rg * 100;
		rg = Math.round(rg);
		rg = rg/100;

		
		document.getElementById('field5').value = rg;
	
		eco = (pp * rp) - (gp * rg);// экономия на 100км
		eco = eco * 100;
		eco = Math.round(eco);
		eco = eco/100;
		document.getElementById('field7').value = eco;
	
		eco = eco/100;// экономия на 1км
		km = 0;
	
		while (gbop >= 0)  {

    		gbop = gbop - eco;
			km++;

    	}
	
		document.getElementById('field6').value = km;

	}
	
}

function hide_it(type) {
    for (i=1; i<15; i++) {
	   if (block = document.getElementById(type+i)) {
	        block.style.display	= 'none';
           }
	}
}

function show_it(id,type) {
    hide_it(type);
    block = document.getElementById(type+id);
    block.style.display	= '';
}



//галерея
function loadBig(path) {
	
	document.getElementById('big_photo').innerHTML = '<a href="javascript:close()" title="Закрыть фотографию" style="text-decoration:none"><img src="'+path+'_b.jpg" alt="галерея BRC" style="border:solid 2px #dc3115" /><br />Закрыть</a>';
	document.getElementById('big_photo').style.display = '';
	
}

function close() {
	
	document.getElementById('big_photo').style.display = 'none';
	document.getElementById('big_photo').innerHTML = '';
	
}

function load(i) {
	
	if (i < 0 && pic_counter > 2) {
		
		pic_counter = pic_counter + i;
		
	} else if (i > 0) {
	
		for (count = 1; count < (i + 1); count++) {
	
			if (pic_counter < total_pics) {
				
				pic_counter = pic_counter + 1;
				
				if (document.getElementById('mycarousel-item-'+pic_counter).title) {
					
					//alert('mycarousel-item-'+pic_counter);
					val = document.getElementById('mycarousel-item-'+pic_counter).title;
					//alert(val);
					document.getElementById('mycarousel-item-'+pic_counter).innerHTML = '<a href="#" onclick="loadBig(\''+val+'\')" title="галерея BRC"><img src="'+val+'.jpg" alt="галерея BRC" width="190" height="143" /></a>'
					document.getElementById('mycarousel-item-'+pic_counter).value = '';
					
				}
					
			}
			
		}
		
	}
	
}

function hideShow(id) {
	
	obj = document.getElementById(id);
	
	if (obj.style.display == '') {
		obj.style.display = 'none';
	} else {
		obj.style.display = '';
	}
	
}

