//网站挑错提交后无法提交
document.domain = "changyou.com";
$.fn.webBugRefer = function(o){
	   var opt = {
		   game : "tl",
		   src  : "http://www.changyou.com/webbug/webbug.html"
	   };
	   
	   opt = $.extend(opt, o || {});
	   return this.each(function(){
		   $(this).click(function(){
			  
			  var clientH = window.screen.availHeight;
			  var scrollT = document.documentElement.scrollTop + document.body.scrollTop;
			  var topPos = (parseInt(clientH)-700)/2+parseInt(scrollT);
			  
			  $('<div id="maskBox"></div>').appendTo($("body")).hide();
			  $("#maskBox").css({position : "absolute", zIndex : 2000, width : "100%", height : $(document).height(), background : "black", opacity : 0.8, left : 0, top : 0});
			  $("#maskBox").fadeIn();
			  
			  $('<div id="webBugBox"></div>').appendTo($("body"));
			  
			  
			  $("#webBugBox").css("position","absolute");
			  $("#webBugBox").css({zIndex : 2005});
			  $("#webBugBox").css({ width : 610, height : 700 });
			  $("#webBugBox").css("left" , (window.screen.availWidth - 610 ) /2);
			  $("#webBugBox").css("top", topPos);
						  
			  var webInfo = $('<iframe allowtransparency="true" src="'+opt.src+'" id="webInfo" scrolling="no" width="610" height="700" frameborder="0" allowtransparency="true" style="position:relative; z-index:0;"></iframe>');
			  if (webInfo[0].attachEvent){
				  webInfo[0].attachEvent("onload", function(){
					  $("#webInfo",$("#webBugBox"))[0].contentWindow.document.getElementById("rex").setAttribute("value", opt.game);
				  });
			  } else {
				  webInfo[0].onload = function(){
					  $("#webInfo",$("#webBugBox"))[0].contentWindow.document.getElementById("rex").setAttribute("value", opt.game);
				  };
			  }
			  $("#webBugBox").append(webInfo);	
			  $("#webBugBox").append($('<div class="close">').css({position : "absolute", width : 60, height : 25, right : 0, top : 0, cursor : "pointer", zIndex: 1, backgroundColor: "#fff"})
			  												 .animate({opacity:0},0));	

              
			  
			  $(".close",$("#webBugBox")).click(function(){
				  $("#webBugBox").hide().remove();
				  $("#webInfo",$("#webBugBox")).remove();
				  $(this).remove();
				  $("#maskBox").fadeOut().remove();
			  });
			  
			  return false;
		   });
	   });
   };
