var isIE = document.all && window.external ? 1 : 0;
var isW3C =typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat'?true:false;
function stopError() {
  return true;
}
window.onerror = stopError;
function getcookie(name) {
	var cookie_start = document.cookie.indexOf(name);
	var cookie_end = document.cookie.indexOf(";", cookie_start);
	return cookie_start == -1 ? '' : unescape(document.cookie.substring(cookie_start + name.length + 1, (cookie_end > cookie_start ? cookie_end : document.cookie.length)));
}

function setcookie(cookieName, cookieValue, seconds, path, domain, secure) {
	seconds = seconds ? seconds : 8400000;
	var expires = new Date();
	expires.setTime(expires.getTime() + seconds);
	document.cookie = escape(cookieName) + '=' + escape(cookieValue)
		+ (expires ? '; expires=' + expires.toGMTString() : '')
		+ (path ? '; path=' + path : '/')
		+ (domain ? '; domain=' + domain : '')
		+ (secure ? '; secure' : '');
}
function InsertFlash(Flash,Vars,Width,Height,ID,Box){
  var FlashHtml='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
  FlashHtml+='codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" ';
  FlashHtml+='width="' + Width + '" height="' + Height + '" id="' + ID + '">';
  FlashHtml+='<param name="movie" value="' + Flash + '">';
  FlashHtml+='<param name="quality" value="high">';
  FlashHtml+='<param name="wmode" value="transparent">';
  FlashHtml+='<param name="allowscriptaccess" value="always">';
  FlashHtml+='<param name="FlashVars" value="'+Vars+'">';
  FlashHtml+='<embed src="' + Flash + '" name="' + ID + '" quality="high" allowscriptaccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer" ';
  FlashHtml+='type="application/x-shockwave-flash" width="' + Width + '" FlashVars="'+Vars+'" wmode="transparent" height="' + Height + '"></embed>';
  FlashHtml+='</object>';
  $(FlashHtml).appendTo(Box);
}
function pageHeight(){ 
  if($.browser.msie){ 
    return document.compatMode == "CSS1Compat"? document.documentElement.clientHeight : document.body.clientHeight; 
  }else{ 
    return self.innerHeight; 
  } 
}
function pageWidth(){ 
  if($.browser.msie){ 
    return document.compatMode == "CSS1Compat"? document.documentElement.clientWidth : document.body.clientWidth; 
  }else{ 
    return self.innerWidth; 
  }
}
function in_array(k,arr){
  for(var i=0;i<arr.length;i++){
    if(k==arr[i])return true;
  }
  return false;
}
function D(){
  return top.document.getElementById("Group_body").contentWindow;
}
function drag(o){
	o.onmousedown=function(a){
		var d=document;if(!a)a=window.event;
		var x=a.layerX?a.layerX:a.offsetX,y=a.layerY?a.layerY:a.offsetY;
    var b=document.all?a.srcElement:a.target;
		if(o.setCapture)
			o.setCapture();
		else if(window.captureEvents)
			window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);

		d.onmousemove=function(a){
			if(!a)a=window.event;
			if(!a.pageX)a.pageX=a.clientX;
			if(!a.pageY)a.pageY=a.clientY;
			var tx=a.pageX-x,ty=a.pageY-y;
			var pX=isIE ? document.documentElement.scrollLeft : pageXOffset;
			var pY=isIE ? document.documentElement.scrollTop : pageYOffset;
      o.style.left=(pX + tx)+'px';
      o.style.top=(pY + ty)+'px';
		};

		d.onmouseup=function(){
			if(o.releaseCapture)
				o.releaseCapture();
			else if(window.captureEvents)
				window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
			d.onmousemove=null;
			d.onmouseup=null;
		};
	};
}
function OnezFile(s){
  var o=s.split('|');
  token=o[0];
  var filename=$('#'+token).attr('filename');
  var fileurl=$('#'+token).attr('fileurl');
  $('#'+token).remove();
  if(o[1]=='security'){
    PrintChat('文件“'+filename+'”已被Flash安全机制阻止，请点击<a href="'+fileurl+'" target="_blank">这里</a>下载！','im_info');
  }else if(o[1]=='ioerror'){
    PrintChat('文件“'+filename+'”的下载地址已失效','im_info');
  }else if(o[1]=='close'){
    //PrintChat('','im_info');
  }else if(o[1]=='cancel'){
    PrintChat('您取消了文件“'+filename+'”的下载','im_info');
  }else if(o[1]=='ok'){
    PrintChat('文件“'+filename+'”下载完毕','im_info');
  }
}
function eventCheck(){
  try{
    var execStrs=$('#eventBox').html();
    $('#eventBox').html('');
    if(execStrs.length>0){
      eval(execStrs);
    }
  }catch(e){}
}