// 如果最上层窗体不是该页面重新加载最上层窗体
if(self.location!=top.location){ window.top.location.href=document.location.href; }

var calcTimeFunc
//点击主菜单后的效果
function ClickMenu(CNname,ENname,autoOpen,mudi){
//	LeftK.location.href="left_menu.asp?mudiCN="+ escape(CNname) +"&mudi="+ ENname +"&autoOpen="+ autoOpen;
	$id("leftMenuContent").innerHTML=$id("leftMenuID"+ ENname).innerHTML;
	$id("LeftText").innerHTML=CNname;
	$id($id("menuStr").value).style.background = "";
	$id($id("menuStr").value).innerHTML = $id($id("menuStr").value).innerHTML.replace("font1_2","fontMenu");
		if (mudi != "userManage"){
	$id("mainMenu"+ ENname).style.background = "url('images/top_menuBg.gif')";
	$id("mainMenu"+ ENname).innerHTML = $id("mainMenu"+ ENname).innerHTML.replace("fontMenu","font1_2");
	$id("menuStr").value="mainMenu"+ ENname;
		}
	if (autoOpen==true){
		eval($id("input"+ ENname).value);
	}else{
		RightK.location.href="left_menuNote.asp?mudi="+ ENname;
	}
}


//左侧菜单伸缩
function TurnMenu(){
	if ($id("ShowLeft").style.display == "")
		{$id("ShowLeft").style.display = "none";$id("LeftImg").src="images/left_open.gif";}
	else
		{$id("ShowLeft").style.display = "";$id("LeftImg").src="images/left_close.gif";}
}


//链接右边内容框
function HrefTo(mainMenuName,menuName,URLstr){
	$id("RightText").innerHTML=$id("LeftText").innerHTML +"→"+ menuName;
	RightK.location.href=URLstr;
//	$id("RightText").innerHTML=mainMenuName +"→"+ menuName;
}

//右边内容框链接引导页
function HrefToDef(){
	$id("RightText").innerHTML="引导页";
	RightK.location.href="left_menuNote.asp?mudi=";
}

// 倒计时
function calcTime(){
	Mnum=parseInt($id("exitM").innerHTML)
	Snum=parseInt($id("exitS").innerHTML)
	Snum=Snum-1
	if (Snum<0){$id("exitM").innerHTML=Mnum-1;$id("exitS").innerHTML="59"}else{$id("exitS").innerHTML=Snum}
	if (Mnum==0 && Snum==0){
		nowDiffTime = 0;

		$.ajaxSetup({cache:false});
		$.get("read.asp?mudi=exitTimeDiff", function(result){
			nowDiffTime = result; 

			try{
				nowDiffTime = parseInt(nowDiffTime);
			}
			catch (e){}

			if (nowDiffTime<=0){
				alert("您超过"+ exitMinute +"分钟没动静，为了后台安全，请重新登录。");
				document.location.href="admin_cl.asp?mudi=exit&nohrefStr=close";
			}else{
				exitNewM = parseInt(nowDiffTime / 60);
				exitNewS = parseInt(nowDiffTime % 60);

				clearTimeout(calcTimeFunc);
				$id("exitM").innerHTML = exitNewM;
				$id("exitS").innerHTML = exitNewS;
				calcTime();
			}
		});

//		alert("您超过"+ exitMinute +"分钟没动静，为了后台安全，请重新登录。");document.location.href="admin_cl.asp?mudi=exit&nohrefStr=close";
	}else{
		calcTimeFunc = window.setTimeout("calcTime()",1000);
	}
	
}

// 初始化倒计时，并开始倒计时
function StartCalcTime(){
	if (exitMinute==0){$id("exitTimeK").style.display="none";return false;}
	clearTimeout(calcTimeFunc);
	$id("exitM").innerHTML = exitMinute;
	$id("exitS").innerHTML = 0;
	calcTime();
}

/*
function CheckInfoRefK(form){
	if (form.refDate1.value == "" && form.refDate2.value != "")
		{alert("末尾日期既然填了，起始日期就不能为空");return false}
	
	if (form.refDate1.value != "" && form.refDate2.value != ""){
		var OneMonth = form.refDate1.value.substring(5,form.refDate1.value.lastIndexOf ("-"));
		var OneDay = form.refDate1.value.substring(form.refDate1.value.length,form.refDate1.value.lastIndexOf ("-")+1);
		var OneYear = form.refDate1.value.substring(0,form.refDate1.value.indexOf ("-"));

		var TwoMonth = form.refDate2.value.substring(5,form.refDate2.value.lastIndexOf ("-"));
		var TwoDay = form.refDate2.value.substring(form.refDate2.value.length,form.refDate2.value.lastIndexOf ("-")+1);
		var TwoYear = form.refDate2.value.substring(0,form.refDate2.value.indexOf ("-"));

		if (Date.parse(OneMonth+"/"+OneDay+"/"+OneYear) > Date.parse(TwoMonth+"/"+TwoDay+"/"+TwoYear))
			{alert("起始日期不能大于末尾日期");return false}
	}
	
	RightText.innerHTML="动态信息→查询结果"
}
*/



// 打开/关闭快捷&工具栏
function CheckFdbox(str){
	if (str=="open"){
		$id("fdBox").style.display = "";
	}else if (str=="close"){
		$id("fdBox").style.display = "none";
	}else{
		if ($id("fdBox").style.display==""){
			$id("fdBox").style.display = "none";
		}else{
			$id("fdBox").style.display = "";
		}
	}
}



// 清空数据库缓存
function ClearDbCache(){
	AjaxGetDeal("admin_cl.asp?mudi=clearDbCache");
	$id("cacheK").style.display="none";
}


// 清除缓存信息
function ClearCacheData(fileName,mudi){
	switch (fileName){
		case "shopOrders": case "type": case "infoMove": case "info": case "product": case "infoMove": case "images":
			$id("cacheK").style.display="";
			break;
	}
}


function CheckRightHeight(){
	window.frames['RightK'].WindowHeight(30);
}
