﻿$(document).ready(function(){	
	$("#hexinyewu").bind("mouseover", function(){
		var obj = $("#menu1").clone();
		$(obj).attr("id","windy_popup_window");
		$(obj).css("visibility","visible");
		$(obj).css("opacity","0");
		$("body").append($(obj));
		$("#windy_popup_window").fadeTo("slow", 1,function(){
			//alert();
		});	
	});
	$("#hexinyewu").bind("mouseout", function(){
		//$("#menu1").fadeTo("slow", 0,function(){
		//	$("#menu1").css("visibility","hidden");
		//});	
	});
	$(document).bind("mousedown",function(){
		$("#windy_popup_window").fadeTo("slow", 0,function(){
			$("#windy_popup_window").remove();
		});
	});
		//add menu hexinyewu
	//$("<div id='menu1' style='position:absolute;left:0px;top:0px;width:212px;height:159px;z-index:999;background-color:#ffffff;filter:alpha(opacity=0);-moz-opacity:0;opacity:0;'><a href='www.16.com'>asd</a></div>").appendTo("body");
	$("#menu1").css("left",(getElementX($("#hexinyewu")[0]) - 64)+"px");
	$("#menu1").css("top",(getElementY($("#hexinyewu")[0]) + 42) +"px");
	
	$("#windy_popup_window").bind("mouseover", function(){
		//$("#hexinyewu").unbind("mouseout");
	});
	$("#hexinyewu").bind("mouseout", function(){
		//$("#windy_popup_window").fadeTo("slow", 0,function(){
		//	$("#windy_popup_window").remove();
		//});	
	});


	var metas = $("meta[name='navselected']");
	if(metas.length == 1)
	{
		var meta = metas[0];
		var lis = $("#main-nav li");
		$.each( lis, function(i, n){
		  $("#" + n.id).removeAttr("class");
		});
		if(document.getElementById(meta.content)){
			$("#"+meta.content).attr("class","now");
		}
	}
});
function getElementX(elem){
	return elem.offsetParent?(elem.offsetLeft+getElementX(elem.offsetParent)):elem.offsetLeft;
}
function getElementY(elem){
	return elem.offsetParent?(elem.offsetTop+getElementY(elem.offsetParent)):elem.offsetTop;
}