var imagesurl = "images/"
var boxwidth_a = 0;
var boxheight_a = 360;//500
var top_adaptersize = 440;//560
function $(str){
	return document.getElementById(str);
}
function Trim(){
	return this.replace(/\s+$|^\s+/g,"");
}
String.prototype.Trim=Trim;

function _(str){
	return document.getElementsByTagName(str);
}
function msg(boxtitle,boxtype,boxwidth,msg,url){
	reval  = "";
reval += "<iframe frameborder=\"0\" id=\"sch_other\" name=\"sch_other\" allowtransparency=\"80\" width=\"98%\" height=\""+boxheight_a+"\" src=\""+url+"\"></iframe>";
	var msg1=reval;
	boxwidth_a=boxwidth;
	$("msg_div_main").style.width = boxwidth+"px";
	$("msg_div_main").style.left = (document.documentElement.clientWidth - boxwidth) / 2+"px";
	$("msg_div_main").style.top = (document.documentElement.clientHeight - top_adaptersize) / 2 + document.documentElement.scrollTop + "px";
	var msg_div_main_but_tmp = "<p style='line-height:10px;'>&nbsp;</p>"
				+ "<button class='msg_div_main_but' id='msg_div_main_but' "
				+ "onclick=\"msg_close_tmp_biyuan();" + url + "\">确 定</button>";
	switch(boxtype * 1){
		case 1:
			$("msg_div_main_content").innerHTML = msg + msg_div_main_but_tmp;
			//$("msg_div_main_but").focus();
		break;
		case 2:
			$("msg_div_main_content").innerHTML =  msg + msg_div_main_but_tmp
							 + "&nbsp;&nbsp;<button class='msg_div_main_but' "
							 + "onclick='msg_close_tmp_biyuan();'>_main_but' "
							 + "onclick='msg_close_tmp_biyuan();'>取 消</button>";
			//$("msg_div_main_but").focus();
		break;
		case 3:
			$("msg_div_main_content").innerHTML =  msg1;
		break;
		defualt:
			$("msg_div_main_content").innerHTML =  msg;
		break;
	}
	$("msg_div_main_title").innerHTML =  boxtitle;
	$("msg_div_main_title").ondblclick=function(){
		if(boxwidth_a<document.documentElement.clientWidth){
		boxwidth_a=document.documentElement.clientWidth;
		boxh=document.documentElement.clientHeight;
		$("msg_div_main").style.width = boxwidth_a-3+"px";
		$("sch_other").height=boxh-78;
		top_adaptersize=boxh-8;
		$("msg_div_main").style.left=1+"px";
		$("msg_div_main").style.top=1+"px";
		}else{
			boxwidth_a=boxwidth;
	$("msg_div_main").style.width = boxwidth+"px";
	$("sch_other").height=boxheight_a;
	top_adaptersize=560;
	$("msg_div_main").style.left = (document.documentElement.clientWidth - boxwidth) / 2+"px";
	$("msg_div_main").style.top = (document.documentElement.clientHeight - top_adaptersize) / 2 + document.documentElement.scrollTop + "px";
			}
		}
	$("msg_div_all").style.zIndex  = 100;
	setSelectState("hidden");
	//if(document.all){
	//$("msg_div_all").style.height=_("body")[0].scrollHeight+"px";
	$("msg_div_all").style.height=document.documentElement.scrollHeight+"px";
	$("msg_div_all").style.width=document.documentElement.scrollWidth+"px";
	if(window.screen.height-170>document.documentElement.scrollHeight){
	  $("msg_div_all").style.height=window.screen.height-170+"px";
		}
	//alert(document.documentElement.scrollWidth);
	//}
	$("msg_div_main").style.zIndex = 200;
	$("msg_div_all").style.display = "";
	over("msg_div_all",0.7)
	$("msg_div_main").style.display = "";
	$("msg_div_all").oncontextmenu = function(){
		return false;
	}
	$("msg_div_main").oncontextmenu = function(){
		return false;
	}
}
function msg_close_tmp_biyuan(){
	out("msg_div_all",0.05)
	setTimeout("$('msg_div_all').style.display='none'",100);
	$('msg_div_main').style.display='none';
	setSelectState("visible")
}
//加入对话框移动代码
var msg_md = false,msg_mobj,msg_ox,msg_oy;
document.documentElement.onmousedown = function(e){
    e=e||window.event
	var o=e.target||e.srcElement
	//alert(o.getAttribute("msg_canmove"));
	if(typeof(o.getAttribute("msg_canmove")) == "undefined"){
		return;
	}
	if(o.getAttribute("msg_canmove")){
		msg_md = true;
		msg_mobj = $(o.getAttribute("msg_forid"));
		msg_ox = msg_mobj.offsetLeft - (e.pageX||e.x);
		msg_oy = msg_mobj.offsetTop - (e.pageY||e.y);
		//alert(e.pageX)
	}
}
document.onmouseup = function(){
	msg_md = false;
}
document.onmousemove = function(e){
	e=e||window.event;
	var o=e.target||e.srcElement;
	if(msg_md){
		msg_mobj.style.left = (e.pageX||e.x) + msg_ox+"px";
		msg_mobj.style.top  = (e.pageY||e.y) + msg_oy+"px";
	}
}
window.onscroll=function(){
	$("msg_div_main").style.top = (document.documentElement.clientHeight - top_adaptersize) / 2+document.documentElement.scrollTop+"px";
	}
window.onresize=function(){
	$("msg_div_main").style.left = (document.documentElement.clientWidth - parseInt(boxwidth_a)) / 2+"px";
	$("msg_div_main").style.top = (document.documentElement.clientHeight - top_adaptersize) / 2+"px";
    $("msg_div_all").style.width=document.documentElement.scrollWidth+"px";
	}
document.writeln("<style type='text/css'>"
	+ "#msg_div_all {width:100%;height:100%;position:absolute;top:0px;left:0px;filter:Alpha(opacity=5);opacity:0.05;background:#EFEFEF;}"
	+ "#msg_div_main {position:absolute;}"
	+ "#msg_div_main_title {font-size:12px;color:#2C71AF;font-family:verdana;cursor:move;}"
	+ "#msg_div_main_content {font-size:14px;color:#2C71AF;padding-left:0px;}"
	+ ".msg_div_main_but {background:url("+imagesurl+"buttonbg.gif);width:65px;height:20px;border:none;padding-top:-3px;font-size:12px;}"
	+ "</style>"
	+ "<div id='msg_div_all' style='display:none;opacity:0.05;'></div>"
	+ "<div id='msg_div_main' style='display:none;'>"
	+ "<table width='100%' height='29' border='0' cellspacing='0' cellpadding='0'>"
	+ "<tr>"
	+ "<td width='25'><img src='"+imagesurl+"bg_01.gif' width='25' height='29' alt='' /></td><td background='"+imagesurl+"bg_02.gif' width='3'></td>"
	+ "<td background='"+imagesurl+"bg_02.gif' msg_canmove='true' msg_forid='msg_div_main' id='msg_div_main_title'></td>"
	+ "<td background='"+imagesurl+"bg_02.gif' align='right' style='padding-top:4px'>"
	+ "<img src='"+imagesurl+"bg_05.gif' width='21' height='21' alt='鍏抽棴' "
	+ "onMouseover=\"this.src='"+imagesurl+"bg_13.gif'\" "
	+ "onMouseout=\"this.src='"+imagesurl+"bg_05.gif'\" onMouseup='msg_close_tmp_biyuan();' "
	+ "onMousedown=\"this.src='"+imagesurl+"bg_18.gif'\"></td>"
	+ "<td width='6'><img src='"+imagesurl+"bg_06.gif' width='6' height='29' alt='' /></td>"
	+ "</tr>"
	+ "</table>"
	+ "<table width='100%' border='0' cellspacing='0' cellpadding='0'>"
	+ "<tr>"
	+ "<td width='3' background='"+imagesurl+"bg_07.gif'></td>"
	+ "<td bgcolor='#F7F7F7' align='center'><p style='line-height:14px;margin:0px;'>&nbsp;</p><div id='msg_div_main_content'></div><p style='line-height:14px;margin:5px;'>&nbsp;</p></td>"
	+ "<td width='3' background='"+imagesurl+"bg_08.gif'></td>"
	+ "</tr>"
	+ "<tr>"
	+ "<td width='3' height='3'><img src='"+imagesurl+"bg_09.gif' width='3' height='3' alt='' /></td>"
	+ "<td background='"+imagesurl+"bg_11.gif'></td>"
	+ "<td width='3' height='3'><img src='"+imagesurl+"bg_10.gif' width='3' height='3' /></td>"
	+ "</tr>"
	+ "</table>"
	+ "</div>");
var tim,bb;
function over(objs,max)
{
 var obj=document.getElementById(objs);
if (document.all)
{
max=max*100;
var tt=parseInt(obj.filters.alpha.opacity);
if(tt<max)
{ 
obj.filters.alpha.opacity+=5;
clearTimeout(tim);
 tim=setTimeout("over('"+objs+"',"+max/100+")", 10); 
}
}
else
{
var tt=obj.style.MozOpacity;
//alert(tt);
if(tt<max)
{ 
var dd=parseFloat(tt)
dd=dd+0.05;
tt=dd;
obj.style.MozOpacity=dd;
bb=window.setTimeout("over('"+objs+"',"+max+")", 10); 
}else
{
window.clearTimeout(bb);
}
}
}
function out(objs,max)
{
 obj=document.getElementById(objs);
if (document.all)
{
max=max*100;
var tt=parseInt(obj.filters.alpha.opacity);
if(tt>max)
{ 
obj.filters.alpha.opacity-=5;
clearTimeout(tim);
tim=setTimeout("out('"+objs+"',"+max/100+")", 10); 
}
}
else
{
var tt=obj.style.MozOpacity;
if(tt>max)
{ 
obj.style.MozOpacity-=0.05;
window.clearTimeout(bb);
bb=window.setTimeout("out('"+objs+"',"+max+")", 10); 
}
}
}
//璁剧疆閫夋嫨妗嗗彲瑙佺姸鎬?
function setSelectState(state)
{
var objl=document.getElementsByTagName('select');
for(var i=0;i<objl.length;i++)
{
if((objl[i].name!="bank")&&(objl[i].name!="paytype")){
objl[i].style.visibility=state;
}
}
}

