uav=navigator.userAgent.toLowerCase();isIEP6=uav.indexOf("msie")>-1&&uav.indexOf("msie 7")<=-1;
var _mv,_mx,_md;
var pagesize=tb_getPageSize();s_width=300,s_height=200,s_minwidth=200,s_minheight=160;s_left=(pagesize[0]-s_width)/2;s_top=(pagesize[1]-s_height)/2;s="";

function showmsg(){
_mv=false;_mx=false;_md=false;
//alert("_mv="+_mv+",_mx="+_mx+",_md="+_md);
if(navigator.userAgent.toLowerCase().indexOf("msie")>-1){
window.style="html{background:"+$("body").css("background-color")+" url(http://images.warcraftchina.com/images_wow/shared/pixel.gif) no-repeat fixed;}";document.createStyleSheet("javascript:style");
mg_position="absolute";
v_top="expression((document.documentElement.scrollTop==0?document.body.scrollTop:document.documentElement.scrollTop)+s_top)";
}
else {mg_position="fixed";v_top=s_top+"px";}
s_resizeable="<div class='mg-resizable-handle mg-resizable-handle-north mg-unselectable' id='ext-gen37' style='MozUserSelect:none;KhtmlUserSelect:none' unselectable='on'></div><div class='mg-resizable-handle mg-resizable-handle-south mg-unselectable' id='ext-gen40' style='MozUserSelect:none;KhtmlUserSelect:none' unselectable='on'></div><div class='mg-resizable-handle mg-resizable-handle-east mg-unselectable' id='ext-gen43' style='height:"+s_height+"px;MozUserSelect:none;KhtmlUserSelect:none' unselectable='on'></div><div class='mg-resizable-handle mg-resizable-handle-west mg-unselectable' id='ext-gen46' style='height:"+s_height+"px;MozUserSelect:none;KhtmlUserSelect:none' unselectable='on'></div><div class='mg-resizable-handle mg-resizable-handle-northeast mg-unselectable' id='ext-gen49' style='MozUserSelect:none;KhtmlUserSelect:none' unselectable='on'></div><div class='mg-resizable-handle mg-resizable-handle-northwest mg-unselectable' id='ext-gen52' style='MozUserSelect:none;KhtmlUserSelect:none' unselectable='on'></div><div class='mg-resizable-handle mg-resizable-handle-southeast mg-unselectable' id='ext-gen55' style='MozUserSelect:none;KhtmlUserSelect:none' unselectable='on'></div><div class='mg-resizable-handle mg-resizable-handle-southwest mg-unselectable' id='ext-gen58' style='MozUserSelect:none;KhtmlUserSelect:none' unselectable='on'></div>";
		if(isIEP6)s_shadow="<div class='mg-ie-shadow' id='bugrpbomg-shadow' style='DISPLAY:block;Z-INDEX:9002;FILTER:progid:DXImageTransform.Microsoft.alpha(opacity=50) progid:DXImageTransform.Microsoft.Blur(pixelradius=4);top:expression((document.documentElement.scrollTop==0?document.body.scrollTop:document.documentElement.scrollTop)+s_top-4);left:"+(s_left-4)+"px;width:"+(s_width-1)+"px;height:199px;position:absolute;'></div>";
		else s_shadow="<div style='z-index:9002;top:"+(s_top-2)+"px;left:"+(s_left-4)+"px;width:308px;height:200px;display:block;' id='bugrpbomg-shadow' class='mg-shadow'><div class='xst'><div class='xstl'></div><div style='width:296px;' class='xstc'></div><div class='xstr'></div></div><div style='height:188px;' class='xsc'><div class='xsml'></div><div style='width:296px;' class='xsmc'></div><div class='xsmr'></div></div><div class='xsb'><div class='xsbl'></div><div style='width:296px;' class='xsbc'></div><div class='xsbr'></div></div></div>";
if(!document.getElementById("bugrpbox")){
		s+="<div class='mg-window-proxy' id='bugrpbomg-proxy' style='display:none;filter:alpha(opacity=50);opacity:0.5;top:189px;left:354px;width:298px;height:198px;position:"+mg_position+";'></div>"+s_shadow;
		s+="<div class='mg-window-plain' id='bugrpbox' style='Z-INDEX:9003;top:"+v_top+";left:"+s_left+"px;position:"+mg_position+";'><div class='mg-window-tl'><div class='mg-window-tr'><div class='mg-window-tc'><div class='mg-window-header mg-unselectable mg-window-draggable' style='MozUserSelect:none;KhtmlUserSelect:none' unselectable='on'><div class='mg-tool mg-tool-close' id='bugrpbomg-close'>&nbsp;</div><span class='mg-window-header-text' unselectable='on'>提交错误报告</span></div></div></div></div><div class='mg-window-bwrap'><div class='mg-window-ml'><div class='mg-window-mr'><div class='mg-window-mc'><div class='mg-window-body' style='padding:5px;'><div class='mg-plain mg-form-label-left'><div class='mg-plain-bwrap'><div class='mg-plain-body mg-plain-body-noheader' style='height:119px'><FORM class='mg-form' id='form_bugrpbox' name='Survey_712d6c91-dec2-4290-b67b-b6243b20ef11' action='#' method='post'><input type='hidden' name='Survey_PaperID' value='712d6c91-dec2-4290-b67b-b6243b20ef11'><input type='hidden' name='Survey_ActionText' value='感谢您的对魔兽世界官网的支持'><input type='hidden' name='Survey_Charset' value='UTF-8'><div class='mg-form-item'><label class='mg-form-item-label' style='width:55px'>页面地址:</label><div class='mg-form-element' style='PADDING-left:60px'><INPUT class='mg-form-text mg-form-field' style='width:202px' readOnly name='Survey_T_254_409' id='Survey_T_254_409' value='"+self.location.href+"' /></div></div><label style='margin-bottom:6px;display:block;'>请提交本页面的错误内容:<br><font color='#ff0000'>(如果您在游戏内遇到问题请联系GM解决)</font></label><div class='mg-form-item mg-hide-label'><div class='mg-form-element' style='PADDING-left:60px'><TEXTAREA class='mg-form-textarea mg-form-field' name='Survey_T_256_412' id='Survey_T_256_412' style='width:264px;height:64px;' autocomplete='off'></TEXTAREA></div></div></FORM></div></div></div></div></div></div></div><div class='mg-window-bl'><div class='mg-window-br'><div class='mg-window-bc'><div class='mg-window-footer'><div class='mg-panel-btns-ct'><div class='mg-panel-btns mg-panel-btns-center'><TABLE cellSpacing='0'><TBODY><TR><TD class='mg-panel-btn-td'><TABLE class='mg-btn-wrap mg-btn mg-btn-over' id='mg-btn-submit' style='width:75px' cellSpacing='0' cellPadding='0' border='0'><TBODY><TR><TD class='mg-btn-left'><I>&nbsp;</I></TD><TD class='mg-btn-center'><EM unselectable='on'><button class='mg-btn-text'>提交</button></EM></TD><TD class='mg-btn-right'><I>&nbsp;</I></TD></TR></TBODY></TABLE></TD><TD class='mg-panel-btn-td'><TABLE class='mg-btn-wrap mg-btn' id='mg-btn-close' style='width:75px' cellSpacing='0' cellPadding='0' border='0'><TBODY><TR><TD class='mg-btn-left'><I>&nbsp;</I></TD><TD class='mg-btn-center'><EM unselectable='on'><button class='mg-btn-text'>关闭</button></EM></TD><TD class='mg-btn-right'><I>&nbsp;</I></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></div></div></div></div></div></div></div></div><div id='bugrpbomg-ghost' class='mg-panel-ghost' style='width:300px;left:"+s_left+"px;top:"+v_top+"; display:none;position:"+mg_position+";'><div class='mg-window-tl'><div class='mg-window-tr'><div class='mg-window-tc'><div style='-moz-user-select:none;' class='mg-window-header mg-unselectable mg-window-draggable'><div class='mg-tool mg-tool-close'>&nbsp;</div><span class='mg-window-header-text'>提交错误报告</span></div></div></div></div><ul style='height:175px;'></ul></div>";
		$("body").append(s);
		$(".mg-window-tc").mousedown(function(){
			_mx=false;
			if(_mv){_mv=false;return false;}
			else{_md=true;createghost();}
		});
		$(document).mouseup(function(){if(_md){_md=false;_mv=false;bcl=$('#bugrpbomg-ghost').css('left');bct=$('#bugrpbomg-ghost').css('top');
		$("#bugrpbox,#bugrpbomg-shadow").css("visibility","visible");$("#bugrpbomg-ghost").css("display","none");$("#bugrpbox").css("left",bcl);$("#bugrpbox").css("top",bct);$("#bugrpbomg-shadow").css("left",bcl.substr(0,bcl.length-2)-4);$("#bugrpbomg-shadow").css("top",bct.substr(0,bct.length-2)-(isIEP6?4:2));s_top=bct.substr(0,bct.length-2)-(document.documentElement.scrollTop==0?document.body.scrollTop:document.documentElement.scrollTop);}
		});
		$(".mg-tool-close").mouseover(function(){_mv=true;});
		$("#bugrpbox #bugrpbomg-close,#bugrpbox #mg-btn-close").click(function(){$("#bugrpbox,#bugrpbomg-shadow").css("visibility","hidden")});
		$("#bugrpbox #mg-btn-submit").click(function(){if($("#Survey_T_256_412").text()!="")$("#form_bugrpbox").submit();else alert("请填写您发现本页面的错误内容");});
		}
	else {$("#Survey_T_254_409").attr("value",self.location.href);$("#bugrpbox,#bugrpbomg-shadow").css("visibility","visible");}
}
function tb_getPageSize(){
	var de = document.documentElement;var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;arrayPageSize = [w,h];return arrayPageSize;}
function createghost(){
if(_md){
$("#bugrpbomg-ghost").css("left",$('#bugrpbox').css('left'));
$("#bugrpbomg-ghost").css("top",$('#bugrpbox').css('top'));
$("#bugrpbox,#bugrpbomg-shadow").css("visibility","hidden");
$("#bugrpbomg-ghost").css("display","block");
draggable("bugrpbox");
}}
function draggable(element){
if($.browser.msie)getTL=document.getElementById(element).getBoundingClientRect();
else getTL=cumulativeOffset(document.getElementById(element));
document.onmousemove = tipPosition;

}
function cumulativeOffset(element){
var valueT = 0, valueL=0;   
do{
	valueT+=element.offsetTop||0;
	valueL+=element.offsetLeft||0;
	element=element.offsetParent;
	}
while (element);   
return  {'left':valueL, 'top':valueT};
}

function tipPosition(callingEvent)
{
  if (!callingEvent) callingEvent = window.event;
  moX = callingEvent.clientX;
  moY = callingEvent.clientY;
  if(!_mx){_mx=moX-getTL.left;_my=moY-getTL.top;}
  if(!_mv){$("#bugrpbomg-ghost").css("left",moX-_mx);
  	if(navigator.userAgent.toLowerCase().indexOf("msie")>-1){document.getElementById("bugrpbomg-ghost").style.top=moY+(document.documentElement.scrollTop==0?document.body.scrollTop:document.documentElement.scrollTop)-_my;}
	else $("#bugrpbomg-ghost").css("top",moY-_my);
}
}
