function opHoverImg(imgId,linkId){
	//document.getElementById(imgId).className+=" ophover";
	//document.getElementById(linkId).style.color="#ffffff";
	$("#" + imgId).fadeTo("normal", 1);
	//$("#" + linkId).css("color", "#fff");
;
}
function opHoverNone(imgId,linkId){
	//className=" ophover";
	//document.getElementById(imgId).className=className.replace(" ophover", ""); 
	//document.getElementById(linkId).style.color="#39352C";
	$("#" + imgId).fadeTo("normal", 0.2);
	//$("#" + linkId).css("color", "#39352C");

}
function firstIeChild(){
	if(document.getElementById('footerLinks') && window.navigator.userAgent.indexOf("MSIE")>=0){
		box = document.getElementById('footerLinks').firstChild;
		box.style.borderLeft = '0';
	}
}

function popup(flag){
	if(flag){
		document.getElementById('popup').style.display='block';
	}
	else{
		document.getElementById('popup').style.display='none';
	}
}

document.onmousedown = function(ev) {
	var ev = ev || window.event;
	var target = ev.target || ev.srcElement;
	if(document.getElementById('showUp') && document.getElementById('popup')){
		if (target && target.id == 'showUp' ) { 
			popup(true);
		}
		else{
			while(target.parentNode&&(target.id!="popup")){
				target=target.parentNode;
			}
			if(!target.parentNode)popup(false);
		}
	}
}


$(document).ready(function(){
	jQuery.each(jQuery.browser, function(i) {
    	if($.browser.msie){
    		$(".moreLinks a:first-child")
				.css({ margin:"0 40px 0 5px", textDecoration:"none", color:"#4B4740" });
		}
	});
	$("ul.firstLevel > li > a").click(function(){
		$(this).parent().attr({"id": "currentParent"});
		$("ul.firstLevel > li:not(#currentParent) > ul").slideUp("fast");
		$("#currentParent > ul").slideDown("fast");
		$(this).parent().attr({"id": ""});
		if ($(this).children().attr("id")!="menuImageNoSlideDown")
			return false;
	});
	$(".muz area").hover(
		function (e) {
			var area = $(this).attr("alt");
			$(".popBuble").css({ left:e.pageX - 50  + "px", top:e.pageY - 70 + "px", visibility:"visible" });
			$("#bubBody").html(area);
		},
		function () {
			$(".popBuble").css({ visibility:"hidden", left:"0px", top:"0px" });
		}
	);
	$(".floor span").click(function(){
		point = $(this).attr("id");
		if(point == "sel"){
			return;
		}
		$(".floor span").attr({"id": ""});
		$(this).attr({"id": "sel"});
		selected = $(this).attr("rel");
		//alert(selected);
		if(selected == "one"){
			$("#two").fadeOut("normal");
			$("#one").fadeIn("normal");
		}
		else if(selected == "two"){
			$("#one").fadeOut("normal");
			$("#two").fadeIn("normal");
			
		}
		//$("#view").fadeOut("slow");

	});
});





// Сначала был init...
function init() {
	if (arguments.callee.done) return;
	arguments.callee.done = true;
	if (_timer) {
		clearInterval(_timer);
		_timer = null;
	}
	firstIeChild();
};
/* for Mozilla */
if (document.addEventListener) {
	document.addEventListener("DOMContentLoaded", init, false);
}

/* for Internet Explorer */
/*@cc_on @*/
/*@if (@_win32)
	document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
	var script = document.getElementById("__ie_onload");
	script.onreadystatechange = function() {
		if (this.readyState == "complete") {
			init(); // call the onload handler"
		}
	};
/*@end @*/

/* for Safari */
if (/WebKit/i.test(navigator.userAgent)) { // sniff
	var _timer = setInterval(function() {
		if (/loaded|complete/.test(document.readyState)) {
			init(); // call the onload handler
		}
	}, 50);
}


/* for other browsers */
window.onload = init;
