window.onerror = function(){return false;}

function showurl(url)
{
	location.href=url;
}

function confirmit()
{
if(confirm("是否确认此操作？"))
return true;
else
return false;
}

//=======================新增
function getWinPop(url,con_txt)
{
	if(confirm(con_txt))
	{
		
		contentFK.innerHTML="<div style='margin-left:0px; margin-top:20px; padding:2px; width:500px; height:300px;'>系统正在处理您的请求，请稍候...</div>";
		$("waiting").style.pixelTop = (document.body.offsetHeight - $("waiting").clientHeight) / 2 + document.body.scrollTop;
		$("waiting").style.pixelLeft = (document.body.offsetWidth - $("waiting").clientWidth) / 2 + document.body.scrollLeft;
		$("waiting").style.visibility = 'visible';
		
		$("waiting").style.display="block"
		$("disabled" + new_i).style.height=document.body.scrollHeight;
		$("disabled" + new_i).style.width=document.body.offsetWidth-20
		$("disabled" + new_i).style.display="block"		
		setTimeout(CheckClick(url),500);
	}
}

function CheckClick(url)
{
	contentFK.innerHTML="<iframe name=\"con\" src=""+url+"/" frameborder=\"0\" scrolling=\"auto\" width=\"500\" HEIGHT=\"300\"></iframe>";
}


function AddProcessbar()
{
	var Str=""
	Str+= "<div id=waiting class=dragAble style='' >";
	Str+= "</div>"
	Str+= "<div id=disabled style=''>"
	Str+= "</div>"
	return Str;
	//document.write(Str)
}
var new_div;
var new_div_dis;
var new_i=0;

function sharehotdesk(f_url,title,c_width,c_height)
{	
	if(top.mainFrame)
	{
		top.mainFrame.openWinPop(f_url,title,c_width,c_height);
	}else{
		openWinPop(f_url,title,c_width,c_height);
	}
}

function openWinPop(f_url, title, c_width, c_height)
{	
	new_i ++;
	new_div = document.createElement("div");
	new_div.id = "waiting"+new_i;
	new_div.className = "dragAble";
	new_div.style.cssText = "position:absolute; top:0px;left:0px;z-index:101;visibility:hidden";
	document.getElementsByTagName("body")[0].appendChild(new_div);
	
	new_div_dis = document.createElement("div");
	new_div_dis.id = "disabled"+new_i;
	new_div_dis.style.cssText = "position:absolute;top:0;left:0;width:1000;height:1000;z-index:100;background:#EEE;filter:Alpha(Opacity=50);display:none";
	document.getElementsByTagName("body")[0].appendChild(new_div_dis);	
	
	var Server_ContextPath = "/include/";
	this.Width = c_width;
	this.Height = c_height;
	this.Title = title;
	this.ID = "";
	this.URL = f_url;	
	
	var f=[];
	f.push("<table style='-moz-user-select:none;' oncontextmenu='stopEvent(event);' onselectstart='stopEvent(event);' border='0' cellpadding='0' cellspacing='0' width='"+(this.Width+26)+"'>");
	f.push("  <tr style='cursor:move;'>");
	f.push("    <td width='13' height='33' style=\"background-image:url("+Server_ContextPath+"Framework/Images/dialog_lt.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+Server_ContextPath+"Framework/Images/dialog_lt.png', sizingMethod='crop');\"><div style='width:13px;'></div></td>");
	f.push("    <td height='33' style=\"background-image:url("+Server_ContextPath+"Framework/Images/dialog_ct.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+Server_ContextPath+'Framework/Images/dialog_ct.png\', sizingMethod=\'crop\');"><div style="float:left;font-weight:bold; color:#FFFFFF; padding:9px 0 0 4px;"><img src="'+Server_ContextPath+'Framework/Images/icon_dialog.gif" align="absmiddle">?'+this.Title+"</div>");
	f.push('      <div id="div_close" style="position: relative;cursor:pointer; float:right; margin:5px 0 0; _margin:4px 0 0;height:17px; width:28px; background-image:url('+Server_ContextPath+'Framework/Images/dialog_closebtn.gif)" onMouseOver="this.style.backgroundImage=\'url('+Server_ContextPath+"Framework/Images/dialog_closebtn_over.gif)'\" onMouseOut=\"this.style.backgroundImage='url("+Server_ContextPath+"Framework/Images/dialog_closebtn.gif)'\" drag='false' onClick=\"closeWinPop(" + new_i + ")\"></div></td>");
	f.push("    <td width='13' height='33' style=\"background-image:url("+Server_ContextPath+"Framework/Images/dialog_rt.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+Server_ContextPath+"Framework/Images/dialog_rt.png', sizingMethod='crop');\"><div style=\"width:13px;\"></div></td>");
	f.push("  </tr>");
	f.push("  <tr drag='false'><td width='13' style=\"background-image:url("+Server_ContextPath+"Framework/Images/dialog_mlm.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+Server_ContextPath+"Framework/Images/dialog_mlm.png', sizingMethod='crop');\"></td>");
	f.push("    <td align='center' valign='top'>");
	f.push("    <table width='100%' height='100%' border='0' cellpadding='0' cellspacing='0' bgcolor='#FFFFFF'>");
	f.push("        <tr id='_MessageRow_"+this.ID+"' style='display:none'>");
	f.push("          <td height='50' valign='top'><table id='_MessageTable_"+this.ID+"' width='100%' border='0' cellspacing='0' cellpadding='8' style=\" background:#EAECE9 url("+Server_ContextPath+'Framework/Images/dialog_bg.jpg) no-repeat right top;">');
	f.push("              <tr><td width='25' height='50' align='right'><img id='_MessageIcon_"+this.ID+"' src='"+Server_ContextPath+"Framework/Images/window.gif' width='32' height='32'></td>");
	f.push("                <td align='left' style='line-height:16px;'>");
	f.push("                <h5 class='fb' id='_MessageTitle_"+this.ID+"'>&nbsp;</h5>");
	f.push("                <div id='_Message_"+this.ID+"'>?</div></td>");
	f.push("              </tr></table></td></tr>");
	f.push("        <tr><td align='center' valign='top'>");
	f.push("          <iframe src='include/waiting.asp?toUrl="+ escape(this.URL) +"' ");
	f.push("id='_DialogFrame_"+this.ID+"' allowTransparency='true'  width='"+this.Width+"' height='"+this.Height+"' frameborder='0' style=\"background-color: #transparent; border:none;\"></iframe></td></tr>");
	/*
	f.push("        <tr drag='false' id='_ButtonRow_"+this.ID+"'><td height='36'>");
	f.push("            <div id='_DialogButtons_"+this.ID+"' style='text-align:right; border-top:#dadee5 1px solid; padding:8px 20px; background-color:#f6f6f6;'>");
	f.push("           	<input id='_ButtonOK_"+this.ID+"'  type='button' value='确 定'>");
	f.push("           	<input id='_ButtonCancel_"+this.ID+"'  type='button' onclick=\"Dialog.getInstance('"+this.ID+"').close();\" value='取 消'>");
	f.push("            </div></td></tr>");
	*/
	f.push("      </table></td>");
	f.push("    <td width='13' style=\"background-image:url("+Server_ContextPath+"Framework/Images/dialog_mrm.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+Server_ContextPath+"Framework/Images/dialog_mrm.png', sizingMethod='crop');\"></td></tr>");
	f.push("  <tr><td width='13' height='13' style=\"background-image:url("+Server_ContextPath+"Framework/Images/dialog_lb.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+Server_ContextPath+"Framework/Images/dialog_lb.png', sizingMethod='crop');\"></td>");
	f.push('    <td style="background-image:url('+Server_ContextPath+"Framework/Images/dialog_cb.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+Server_ContextPath+"Framework/Images/dialog_cb.png', sizingMethod='crop');\"></td>");
	f.push("    <td width='13' height='13' style=\"background-image:url("+Server_ContextPath+"Framework/Images/dialog_rb.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+Server_ContextPath+"Framework/Images/dialog_rb.png', sizingMethod='crop');\"></td>");
	f.push("  </tr></table>");
	
	$("waiting"+new_i).innerHTML= f.join("\n");
	$("waiting"+new_i).style.pixelTop = (document.body.offsetHeight - $("waiting"+new_i).clientHeight) / 2 + document.body.scrollTop;
	if($("waiting"+new_i).style.pixelTop < 0)$("waiting"+new_i).style.pixelTop=0;
	$("waiting"+new_i).style.pixelLeft = (document.body.offsetWidth - $("waiting"+new_i).clientWidth-10) / 2 + document.body.scrollLeft;
	$("waiting"+new_i).style.visibility = 'visible';
	
	$("waiting"+new_i).style.display="block"
	$("disabled" + new_i).style.height=document.body.scrollHeight;
	$("disabled" + new_i).style.width=document.body.offsetWidth-20;
	$("disabled" + new_i).style.display="block"
		/*
	contentFK.innerHTML='<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0"><tr onDblClick="sharehotdesk_max()"><td width="10%" height="20" align="left" style="font-weight:bold">??'+title+'</td><td width="10%" height="20" align="right" style="padding-right:5px;"><img src="/include/images/sub03.gif" style="cursor:hand" onClick="waiting.style.display=\'none\';document.all.disabled.style.display=\'none\';" alt="关闭" /></td></tr><tr><td height="100%" valign="top" colspan="2"  bgcolor="#FFFFFF"><div style="overflow: auto; width:100%; height:100%;background-color:#FFFFFF"><div id="divFloatCont" style="overflow: auto; width:100%; height:100%;background-color:#FFFFFF"></div></div></td></tr></table>';
	
	waiting.style.width	=	c_width + "px";
	waiting.style.height	=	c_height + "px";
	document.all.waiting.style.pixelTop = (document.body.offsetHeight - document.all.waiting.clientHeight) / 2 + document.body.scrollTop;
	if(document.all.waiting.style.pixelTop < 0)document.all.waiting.style.pixelTop=0;
	document.all.waiting.style.pixelLeft = (document.body.offsetWidth - document.all.waiting.clientWidth-10) / 2 + document.body.scrollLeft;
	document.all.waiting.style.visibility = 'visible';

	
	waiting.style.display="block"
	disabled.style.height=document.body.scrollHeight;
	disabled.style.width=document.body.offsetWidth-20;
	disabled.style.display="block"
	
	divFloatCont.innerHTML="<iframe name=\"con\" src="/include/waiting.asp?toUrl="+escape(f_url)+"\" frameborder=\"0\" scrolling=\"auto\" width=\"100%\" HEIGHT=\"100%\"></iframe>"
	*/	
}

function closeWinPop(new_i)
{
	$("waiting" + new_i).style.display='none';
	$("disabled" + new_i).style.display='none';
}


/**
* 取得某元素在页面中相对页面左上顶点的位置
*/
function getOffset(obj){
	var offsetleft = obj.offsetLeft;
	var offsettop = obj.offsetTop;
	while (obj.offsetParent != document.body)
	{
		obj = obj.offsetParent;
		offsetleft += obj.offsetLeft;
		offsettop += obj.offsetTop;
	}
	return {Left : offsetleft, Top : offsettop};
}

//常用的JS函数

function $(element) {
	return document.getElementById(element)?document.getElementById(element):element;
}

// Sets cookie values. Expiration date is optional 
// 
function setCookie(name, value, expire)
{ 
  document.cookie = name + "=" + escape(value) 
  + ((expire == null) ? "" : ("; expires=" + expire.toGMTString())) 
} 


function getCookie(Name)
{ 
  var search = Name + "=" 
  if (document.cookie.length > 0) { // if there are any cookies 
     offset = document.cookie.indexOf(search) 
     if (offset != -1) { // if cookie exists 
        offset += search.length 
        // set index of beginning of value 
        end = document.cookie.indexOf(";", offset) 
        // set index of end of cookie value 
        if (end == -1) 
           end = document.cookie.length 
        return unescape(document.cookie.substring(offset, end)) 
     } 
  } 
} 

// 只允许输入数字
function IsDigit()
{
  return ((event.keyCode >= 48) && (event.keyCode <= 57));
}
//javascript去空格函数
function LTrim(str)
{
	//去掉字符串 的头空格
	var i;
	for(i=0;i<str.length;i++){
		if(str.charAt(i)!=" ") break;
	}
	str = str.substring(i,str.length);
	return str;
}

function RTrim(str)
{
	var i;
	for(i=str.length-1;i>=0;i--){
		if(str.charAt(i)!=" ") break;
	}
	str = str.substring(0,i+1);
	return str;
}

function Trim(str)
{
	return LTrim(RTrim(str));
}

function UrlEncode(str)
{ 
	var i,temp,p,q; 
	var result=""; 
	for(i=0;i<str.length;i++){ 
		temp = str.charCodeAt(i); 
		if(temp>=0x4e00){ 
			execScript("ascCode=hex(asc(\""+str.charAt(i)+"\"))", "vbscript"); 
			result+=ascCode.replace(/(.{2})/g, "%$1"); 
		}else{ 
			result+=escape(str.charAt(i)); 
		}
	} 
	return result; 
}
/////////////////////////
function toUser(user)
{
top.topFrame.document.okkk.UserName.value=user;
top.topFrame.document.okkk.submit();
}

window.alert = function(val)
{
	if(top.topFrame)
	{
	top.topFrame.alertD(val,1);	
	}else{
		var shield = document.createElement("DIV"); 
		shield.id = "shield"; 
		shield.style.position = "absolute"; 
		shield.style.left = "0px"; 
		shield.style.top = "0px"; 
		shield.style.width = "100%"; 
		shield.style.height = document.body.scrollHeight+"px"; 
		shield.style.textAlign = "center"; 
		shield.style.zIndex = "10000"; 
		shield.style.filter = "alpha(opacity=0)"; 
		var alertFram = document.createElement("DIV"); 
		alertFram.id="alertFram"; 
		alertFram.style.position = "absolute"; 
		alertFram.style.left = "50%"; 
		alertFram.style.top = "50%"; 
		alertFram.style.marginLeft = "-125px"; 
		alertFram.style.marginTop = "-75px"; 
		alertFram.style.width = "300px"; 
		alertFram.style.height = "180px"; 
		alertFram.style.textAlign = "center"; 
		alertFram.style.lineHeight = "150px"; 
		alertFram.style.zIndex = "10001"; 
		strHtml = "<ul style=\"list-style:none;margin:0px;padding:0px;width:100%\">"; 
		strHtml += "<li style=\"background:#002F9C;text-align:left;padding-left:5px;font-size:12px;font-weight:bold;color:#FFFFFF;height:25px;line-height:25px;border-left:1px solid #FFFFFF;border-top:1px solid #FFFFFF;border-right:1px solid #FFFFFF;\">[提示]</li>"; 
		strHtml += "<li style=\"background:#5A7EDC;text-align:center;font-size:12px;color: #FFFFFF;height:20px;line-height:20px;border-left:1px solid  FFFFFF;border-right:1px solid #FFFFFF;\"></li>"; 
		strHtml += "<li style=\"background:#5A7EDC;text-align:center;font-size:12px;color: #FFFFFF;height:100px;line-height:25px;border-left:1px solid #FFFFFF;border-right:1px solid #FFFFFF;\">"+val+"</li>"; 
		strHtml += "<li style=\"background:#002F9C;text-align:center;font-weight:bold;height:25px;line-height:25px; border-left:1px solid  FFFFFF;border-bottom:1px solid #FFFFFF;border-right:1px solid #FFFFFF; padding:5px;\"><input type=button value=' 确定 ' onclick=\"remove()\"></li>"; 
		strHtml += "</ul>"; 
		alertFram.innerHTML = strHtml; 
		document.body.appendChild(alertFram); 
		document.body.appendChild(shield); 
		var c = 0; 
		this.doAlpha = function(){ 
        if (c++ > 50){clearInterval(ad);return 0;} 
        shield.style.filter = "alpha(opacity="+c+");"; 
    } 
	this.remove=function(){ 
	alertFram.innerHTML=""; 
	shield.style.filter = ""; 
	shield.id = ""; 
	shield.style.position = ""; 
	shield.style.left = ""; 
	shield.style.top = ""; 
	shield.style.width = ""; 
	shield.style.height =""; 
	shield.style.textAlign = ""; 
	shield.style.zIndex = ""; 
	shield.style.filter = ""; 
	alertFram.id=""; 
	alertFram.style.position = ""; 
	alertFram.style.left = ""; 
	alertFram.style.top = ""; 
	alertFram.style.marginLeft = ""; 
	alertFram.style.marginTop = ""; 
	alertFram.style.width = ""; 
	alertFram.style.height = ""; 
	alertFram.style.textAlign = ""; 
	alertFram.style.lineHeight = ""; 
	alertFram.style.zIndex = ""; 
	} 
	var ad = setInterval("doAlpha()",10); 
    alertFram.focus(); 
    document.body.onselectstart = function(){return false;}; 
	}
}

/*
//可以拖动的对象
var ie=document.all; 
var nn6=document.getElementById && !document.all; 
var isDrag = false;
var oDragObj;
var x,y,ntX,ntY;
function moveMouse(e)
{
	if(ie)e=event;
	if(isDrag){
		oDragObj.style.top =  ntY+e.clientY-y+"px";
		oDragObj.style.left =  ntX+e.clientX-x+"px";
	}
}
function initDrag(e)
{
	var oDragHandle = nn6 ? e.target : event.srcElement; 
	while(oDragHandle.tagName != "HTML" && oDragHandle.className != "dragAble")
	{
	oDragHandle = nn6 ? oDragHandle.parentNode:oDragHandle.parentElement;
	}
	if(oDragHandle.className == "dragAble")
	{
		if(ie)e=event;
		isDrag = true;
		oDragObj = oDragHandle;
		oDragObj.style.xindex = 1;
		ntX = parseInt(oDragObj.style.left+0);
		ntY = parseInt(oDragObj.style.top+0);
		y = e.clientY;
		x = e.clientX;
		document.onmousemove = moveMouse;
		return false;
	}
}
document.onmousedown = initDrag;
document.onmouseup = new Function("isDrag = false;oDragObj.style.xindex = 1000;");
*/

function showDia(url, w_title, width, height)
{
	var str;
	str =window.showModalDialog("/include/frame.asp?toUrl=" + escape(url), w_title ,"dialogWidth=" + width + "px;dialogHeight=" + height + "px");
	eval(str);
}
