var jQuery =$;

jQuery(function(){
//判断当前页面ID,决定给那个菜单高亮
nowPage = jQuery("body").attr("id");
nowPage = nowPage.split("_");
fatherMenu = nowPage[0];
childMenu = nowPage[1];
jQuery('.' + fatherMenu).attr("id","firstNow").next("ul").show();
jQuery('.' + childMenu).attr("id","secdNow");
//ie6 背景图 闪烁

if(jQuery.browser.version==6.0){
	try {        
		 document.execCommand("BackgroundImageCache", false, true);        
	} catch(err) {}
}
//设置页面最小宽度
	autoSize();
    if (document.attachEvent) {
        window.attachEvent("onresize", autoSize);
    }
    else {
        window.addEventListener('resize', autoSize, false);
    }
	
	trHover();
	striptr();
	buttonHover();
	loginInputHover();
	copy();
	
	jQuery("#open").show();
	//点击一级菜单切换
	jQuery("#nav h3").click(function(){
		//jQuery("#nav ul:visible").hide();
		jQuery("#open").removeAttr("id");
		
		jQuery("#firstNow").removeAttr("id");
		jQuery(this).attr("id","firstNow");
		
		//jQuery(this).next("ul").show();
		//jQuery(this).next("ul").attr("id","open");
	})
	
	//按钮跳转
	jQuery("input[@type=button]").click(function(){
		if(jQuery(this).attr("alt")){
			window.location=jQuery(this).attr("alt");
		}
	})
	
	//显示提示
	jQuery("#successShow").click(function(){
		jQuery("html").css("overflow","hidden");							 
		jQuery("div.mark").show();
		jQuery("#successAlert").show()
	})
	
	jQuery("#confBox").click(function(){
		jQuery("html").css("overflow","hidden");	
		jQuery("div.mark").show();							 
		jQuery("#conf").show()
	})
	
	jQuery("#errorShow").click(function(){
		jQuery("html").css("overflow","hidden");							   
		jQuery("div.mark").show();
		jQuery("#errorAlert").show()
	})
	
	jQuery(".alertBox .button").click(function(){
		jQuery("html").css("overflow","auto");															  
		jQuery("div.mark").hide();
		jQuery(this).parent().hide();
	})
	
	//操作确认
	jQuery("td .del").click(function() {
  		jQuery(this).parent().parent().remove();
  		jQuery("body").css("overflow","hidden");							 
		jQuery("div.mark").show();							 
		jQuery("#successAlert").show()
	})

	//文本框高亮
	jQuery("input[@type=text],input[@type=password],textarea").focus(function(){
		jQuery(this).css("border","1px solid #F18E00");
	})
	
	jQuery("input[@type=text],input[@type=password],textarea").blur(function(){
		jQuery(this).css("border","1px solid #b4b4b4");
	})
	
	jQuery(".btArea input").eq(1).click(function(){
		jQuery(".confBox,.mark").hide();
	})
	
	jQuery("a.close").click(function(){
		jQuery(".confBox,.mark").hide();
	})
});

//mouseover,tr change color
function trHover(){
	jQuery(".table02 tr").mouseover(function(){
		jQuery(this).addClass("over");}).mouseout(function(){
		jQuery(this).removeClass("over");})
}
//line change color
function striptr(){
	jQuery(".table02 tr:even").addClass("alt");

	
	jQuery(".table03").each(function(i){
		jQuery(this).find("tr:even").addClass("alt");
	})
}
//mouseover,button change color
function buttonHover(){
	jQuery("input[@type=button]").mouseover(function(){
		jQuery(this).addClass("buttonHover");}).mouseout(function(){
		jQuery(this).removeClass("buttonHover");});
}
function loginInputHover(){
	jQuery(".loginInput").mouseover(function(){
		jQuery(this).addClass("loginInputHover");}).mouseout(function(){
		jQuery(this).removeClass("loginInputHover");});
}

//tab切换函数
/*function tabs(cont,url){
	jQuery(cont).load(url+ "&type=m01"); //，首页默认tab
	jQuery(".scrolldoorFrame a").click(function(){
		jQuery("#opened").attr("id","");
		jQuery(this).attr("id","opened");
		temp = jQuery(this).attr("href");
		jQuery(cont).load(url+"&type="+temp);
		return false;
	})	
}

//tab切换函数
function tabs(cont,url){
	jQuery(cont).load(url+ " #m01"); //，首页默认tab
	jQuery(".scrolldoorFrame a").click(function(){
		jQuery("#opened").attr("id","");
		jQuery(this).attr("id","opened");
		temp = jQuery(this).attr("href");
		jQuery(cont).load(url + " #"+temp);
		return false;
	})	
}

*/
//调整窗口大小
function autoSize(){
clientWi = (document.compatMode == 'CSS1Compat') ? document.documentElement.clientWidth : document.body.clientWidth;
if(clientWi<1002){
	jQuery(".layerTop,.layerFooter").css("width","1002");
}else{
	jQuery(".layerTop,.layerFooter").css("width","100%");
}
}

//display
function copy(){
	jQuery(".copyhint").hide();
	jQuery(".copy").click(function(){
		jQuery(".copyhint").show().fadeOut(3000);						  
	})	
}

//弹出暂停提示窗口
function closeshow(menutitle,divtext,status){
document.getElementById("menutitle").innerHTML=menutitle;
document.getElementById("divtext").innerHTML=divtext;
document.getElementById("status").value=status;
jQuery(".confBox,.mark").show();
	}
function titletabs(){
jQuery(".scrolldoorFrame a").click(function(){
		jQuery("#opened").attr("id","");
		jQuery(this).attr("id","opened");
		temp = jQuery(this).attr("href");
		return false;
	})	


}	
	
function tabs(type){
titletabs();  //标题样式转换
if(type=='m01'){
	document.getElementById("m01").style.display='';
	document.getElementById("m02").style.display='none';
	document.getElementById("m03").style.display='none';
	document.getElementById("m04").style.display='none';
}
if(type=='m02'){
	
	document.getElementById("m01").style.display='none';
	document.getElementById("m02").style.display='';
	document.getElementById("m03").style.display='none';
	document.getElementById("m04").style.display='none';
}
if(type=='m03'){
	document.getElementById("m01").style.display='none';
	document.getElementById("m02").style.display='none';
	document.getElementById("m03").style.display='';
	document.getElementById("m04").style.display='none';
}
if(type=='m04'){
	document.getElementById("m01").style.display='none';
	document.getElementById("m02").style.display='none';
	document.getElementById("m03").style.display='none';
	document.getElementById("m04").style.display='';
}

}