// Выпадающее меню
function dropdown(obj){
	dddiv=obj.parentNode.getElementsByTagName('div')[0].style;
	if(dddiv.display=='none'){dddiv.display='block';}else{dddiv.display='none';}
}
function checked_row(obj){
	check=obj.parentNode.getElementsByTagName('input')[0];
	if(check.checked){check.checked=false;}else{check.checked=true;}
}
function readCookie(name){
    var cookiename=name+"=";
    var ca=document.cookie.split(';');  
    for(var i=0; i<ca.length; i++){  
        var c=ca[i];  
        while (c.charAt(0)==' ') c=c.substring(1,c.length);  
        if(c.indexOf(cookiename)==0) return c.substring(cookiename.length,c.length);
     }  
    return null;  
}
function gotoAnchor(){
	anch=readCookie('coNum');
	elementNeed=$('a[name='+anch+']');
	destination=$(elementNeed).parent().offset().top-10;
    $("html").animate({scrollTop:destination}, 1000);
	var d=new Date();
    document.cookie="coNum=empty;expires="+d.toGMTString()+";"+";";
}
function to0grad(MYobjs){ // !objects width must be same! //using JQuery
	for(k=0; k<MYobjs.length; k++){// Перебираем все объекты, переданные функции
		for(j=0; j<MYobjs[k].size(); j++){ // Перебираем все HTML объекты в JQuery объекте-массиве
			total=jQuery(MYobjs[k].get(j)).innerWidth();
			blockHeight=jQuery(MYobjs[k].get(j)).innerHeight();
			for(i=0; i<total; i++){ // Перебираем все пикселы объекта
				newdiv=document.createElement('div');
				newdiv.style.opacity=i/total;
				newdiv.style.filter="alpha(opacity="+i/total*100+")";
				newdiv.style.height=blockHeight+"px";
				jQuery(MYobjs[k].get(j)).append(newdiv);
			}
		}
	}
}
function compareBox(obj, id, parent_id){
//	document.getElementById("iframe").src="/emarket/resetCompareList/"; return null;
	if(obj.checked){
		if(readCookie('comparePartition')!=parent_id){document.getElementById("iframe").src="/emarket/resetCompareList/";}
		document.getElementById("iframe").src="/emarket/addToCompare/"+id;
		document.cookie="comparePartition="+parent_id+"; path=/;";
	}
	else{document.getElementById("iframe").src="/emarket/removeFromCompare/"+id;}
}
function insCity(ctt){if(lastOne){lastOne.value=country+' >>> '+ctt;}}
function showCity(sityID){
	obj=$('.'+sityID);
	rgb=obj.css('color');
	obj.animate({opacity:0.1}, 450, '', function(){obj.css('color', '#24429f');}); obj.animate({opacity:1}, 450);
	obj.animate({opacity:0.1}, 450, '', function(){obj.css('color', rgb);}); obj.animate({opacity:1}, 450);
}

function olv(itm){$(itm).find('.slider').slideToggle(); return false;}
function hoverTable(tClass){
	$(document).ready(function(){
		$('.'+tClass+' tr').hover(function(){$(this).find('td').toggleClass('hovered');});
	});
}
