/**
 * common.js
 * common js file
 */
var cfg = 
{
	notLogin:"请重新登陆！谢谢",
	errTimeOutInc:root+"include/inc/err-timeout.html",
	errLoginInc:root+"include/inc/err-login.html",
	setPoneInc1:root+"include/inc/set-phone1.html",
	setPoneInc2:root+"include/inc/set-phone2.html",
	setPoneInc3:root+"include/inc/set-phone3.html",
	updatePoneInc1:root+"include/inc/update-phone1.html",
	successRegInc:root+"include/inc/success-login.html",
	cardSuccessInc:root+"include/inc/card-success.html",
	normalInfoInc:root+"include/inc/normal-info.html",
	agreeInfoInc:root+"include/inc/agree-info.html",
	updateRegInfoInc:root+"include/inc/update-reg-info.html",
	verifyEmailInc:root+"include/inc/verify-email.html",
	SendMailToFriend:root+"include/inc/SendMailToFriend.html",
	ReportProblem:root+"include/inc/ReportProblem.html",
	ServiceTemp:root+"include/inc/service_temp.html",
	redeemInfoInc:root+"include/inc/redeem.html",
	tplview:root+"include/inc/TplView.htm",
	phoneCallBack:root+"include/inc/pop_webcall.html",
	TestNet:root+"include/inc/TestNet.html",
	locdomain:window.location.hostname,
	//locdomain:"test.8ger.com",
	themeDir:root+"style/scn/images/",
	count:0,
	cookiesName:"Hi8_userId",
	gotoUrl:"",
	chkPhoneTimes:"",
	stopFlag:0,
	successFlag:0,
	chkPhoneServerId:""

};

//js错误处理 add by tony 2008-03-20 11:08
//onerror=WatchJSErr;

function WatchJSErr(msg,url,line){
	
	try{

		txt="";
		txt+="Error: " + msg + "\r\n";
		txt+="URL: " + url + "\r\n";
		txt+="Line: " + line + "\r\n";
		//txt+="Author: "+  + "\r\n";

		$.get(
		
			root+"WatchJSErr.php",
			{"step":"JsErr_AddLog","Log":txt}
			
		);
	}
	catch(e){
		return true;
	}
	return true;
}
// end

/**
 * getObj
 */ 
function getObj(objectId) {
    if(document.getElementById && document.getElementById(objectId)) {
		// W3C DOM
		return document.getElementById(objectId);
    } else if (document.all && document.all(objectId)) {
		// MSIE 4 DOM
		return document.all(objectId);
    } else if (document.layers && document.layers[objectId]) {
		// NN 4 DOM.. note: this won't find nested layers
		return document.layers[objectId];
    } else {
		return false;
    }
}
 
/**
 * strlen
 * 计算字串长度
 * @param string str
 * return int count
 */

function strlen(str){
	var len = 0;
	var c_len = 1;//charset == 'utf-8' ? 3 : 2;
	for(var i=0;i<str.length;i++){
		len += str.charCodeAt(i) < 0 || str.charCodeAt(i) > 255 ? c_len : 1;
	}
	return len;
}

/**
 * strByteCount
 * 计算字串byte长度
 * @param string str
 * return int count
 */
function strByteCount(str)
{
	str = str.replace(/(<.*?>)/ig,"");
	str = str.replace(/([\u0391-\uFFE5])/ig, "11");
	var count = str.length;
	return count;
}

/**
 * trim
 * 去掉开始结束字串空格
 * @param string str
 */
function trim(str)
{
	return str.replace(/(^\s*)|(\s*$)/g, "");
}

/**
 * 使用W3C标准语法为SELECT添加Option
 * addOption
 * @param objSelectNOw
 * @param txt
 * @param val
 * @param s_txt
 */
function addOption(objSelectNow, txt, val, s_txt)
{
	var objOption = document.createElement("OPTION");
	objOption.text = "";
	objOption.value ="";
	objOption.selected = "";

	objOption.text = txt;
	objOption.value = val;
	//alert(s_txt);
	if (val == s_txt){
	  objOption.selected = "selected";
	}else{
	  objOption.selected = "";
	}
	objSelectNow.options.add(objOption);
}

/**
 * clearSelectOption
 * 清空下拉表单
 */
function clearSelectOption(s_id) 
{
    var select = document.getElementById(s_id);
    while (select.length > 0) 
	{
        select.remove(0);
    }
}

/**
 * 用途：检查输入字符串是否为空或者全部都是空格 
 * 输入：str 
 * 返回： 
 * 如果全是空返回true,否则返回false 
 */
function isNull(str) 
{
	if (str == "") 
	{
		return true;
	}
	var regu = "^[ ]+$";
	var re = new RegExp(regu);
	return re.test(str);
}

/** 
  * 用途：检查输入对象的值是否符合E-Mail格式 
  * 输入：str 输入的字符串 
  * 返回：如果通过验证返回true,否则返回false 
  */
function isEmail(str) 
{
	var myReg = /^[\.\-_A-Za-z0-9]+@([\-_A-Za-z0-9]+\.)+[A-Za-z0-9]{2,4}$/;
	if (myReg.test(str)) 
	{
		return true;
	}
	return false;
}
/** 
  * 用途：检查输入对象的值是否符合Url格式 
  * 输入：str 输入的字符串 
  * 返回：如果通过验证返回true,否则返回false 
  */
function isUrl(s)
{
	var patrn=/^(https?:\/\/)?([a-z0-9]+(\-[a-z0-9]+)*\.)+((aero|biz|cc|co|com|coop|edu|gov|info|int|mil|museum|name|nato|net|org|tv){1}|(af|aq|at|au|be|bg|br|ca|ch|cl|cn|de|eg|es|fi|fr|gr|hk|hu|ie|il|in|iq|ir|is|it|jp|kr|mx|nl|no|nz|pe|ph|pr|pt|ru|se|sg|th|tr|tw|uk|us|za){1}|(aero|biz|cc|co|com|coop|edu|gov|info|int|mil|museum|name|nato|net|org|tv)(\.(af|aq|at|au|be|bg|br|ca|ch|cl|cn|de|eg|es|fi|fr|gr|hk|hu|ie|il|in|iq|ir|is|it|jp|kr|mx|nl|no|nz|pe|ph|pr|pt|ru|se|sg|th|tr|tw|uk|us|za)){1})(\/(.*))?$/i;
	if (!patrn.exec(s)) return false;
	return true;
}
/** 
  * 用途：检查输入字符串是否只由英文字母和数字和下划线组成 
  * 输入： s：字符串 
  * 返回： 如果通过验证返回true,否则返回false 
  */
function isNumberOr_Letter(s) 
{
 	//判断是否是数字或字母 
	var regu = "^[0-9a-zA-Z_]+$";
	var re = new RegExp(regu);
	if (re.test(s)) 
	{
		return true;
	} 
	else 
	{
		return false;
	}
}
/** 
  * 用途：检查输入字符串是否只由英文字母和数字和下划线组成,并且要以字母打头 
  * 输入： s：字符串 
  * 返回： 如果通过验证返回true,否则返回false 
  */
function isUserName(s) 
{
 	//判断是否是数字或字母 
	var regu = "^[a-zA-Z]([0-9a-zA-Z_])*$";
	var re = new RegExp(regu);
	if (re.test(s)) 
	{
		return true;
	} 
	else 
	{
		return false;
	}
}
/** 
  * 用途：判断一个值是否在数组中,相当于php的in_array 
  * 输入： child：字符串 
  * 返回： 如果通过验证返回true,否则返回false 
  */
Array.prototype.inArray = function (child) {
	for (var i = 0; i < this.length; i++) {
		if (this[i] == child) return true;
	}
	return false;
};
/**
 * 用途：检查输入的电话号码格式是否正确 
 * 输入： 
 * strPhone：字符串 
 * 返回： 
 * 如果通过验证返回true,否则返回false 
 */
function checkPhone(type,strPhone) 
{
	var phoneRegWithArea = /^(0)[1-9]([0-9]{1,2})([0-9]{5,10})$/;
	var phoneRegNoArea = /^([1-9]{1})([0-9]{5,8})$/;
	if (cfg.testMode == true)
	{
		var phoneRegMobile = /^([0-9]*)$/;
	}
	else
	{
		var phoneRegMobile = /^(01)(3|5)[0-9]{9}$/;	
	}
	
	var phoneRegNum = /^[0-9]{0,8}$/;
	//var prompt = "\u60a8\u8f93\u5165\u7684\u7535\u8bdd\u53f7\u7801\u4e0d\u6b63\u786e!";
	if (strPhone)
	{
		if (type=='phone' && strPhone.length > 9) 
		{
			if (phoneRegWithArea.test(strPhone)) 
			{
				return true;
			} 
			else 
			{
				//alert(prompt);
				return false;
			}
		} 
		else if (type=='mobile')
		{
			if (phoneRegMobile.test(strPhone)) 
			{
				return true;
			} 
			else 
			{
				//alert(prompt);
				return false;
			}
		}
		else if (type=='num')
		{
			if (phoneRegNum.test(strPhone)) 
			{
				return true;
			} 
			else 
			{
				//alert(prompt);
				return false;
			}		
		}
		else
		{
			if (phoneRegWithArea.test(strPhone) || phoneRegMobile.test(strPhone))
			{
				return true;
			}
			else
			{
				return false;
			}
		}
	}
	else
	{
		return false;
	}
}

/** 
 * 用途：检查输入字符串是否只由汉字、字母、数字组成 
 * 输入： 
 * value：字符串 
 * 返回：如果通过验证返回true,否则返回false 
 */
function isChinaOrNumbOrLett(s) { //判断是否是汉字、字母、数字组成 
	var regu = "^[0-9a-zA-Z_\u4e00-\u9fa5]+$";
	var re = new RegExp(regu);
	if (re.test(s)) {
		return true;
	} else {
		return false;
	}
}

/** 
 * 用途：检查输入字符串是否符合身份证号码规则 
 * 输入： 
 * value：字符串 
 * 返回：如果通过验证返回true,否则返回false 
 */
function isIdcard(id){
	var regu = /^\d{15}$|^\d{18}$|^\d{17}x$/;
	if(regu.test(id)){
		return true;
	}else{
		return false;
	}
}

/** 
 * 用途：检查输入对象的值是否符合整数格式 
 * 输入：str 输入的字符串 
 * 返回：如果通过验证返回true,否则返回false 
 */ 
function isInteger( str ){  
	var regu = /^[-]{0,1}[0-9]{1,}$/; 
	return regu.test(str); 
}

/**
 * array_unique
 * 去除数组里重复元素
 * @param Array oldArray
 * @return Array newArray
 */
function array_unique(oldArray){
 for(var i=0; i<oldArray.length; i++){   
  for(j=i+1; j<oldArray.length; j++){   
	if(oldArray[i]==oldArray[j]) oldArray[i] = null;   
  }   
 }   
 	var m = 0, newArray = new Array();  
 	for(var k=0; k<oldArray.length; k++){   
	if(oldArray[k]) newArray[m++] = oldArray[k];   
 }
 return newArray;
}

/**
 * setImgSize
 * 微缩图片方法
 * @param imgID（图片的标识ID）
 * @param maxWidth（图片的最大宽度，值为0则表示不限制宽度）
 * @param maxHeight（图片的最大高度，值为0则表示不限制高度）
 */
function setImgSize(imgID,maxWidth,maxHeight,oldWidth, oldHeight)
{
	var img = imgID;
	 if (typeof(imgID) != 'object')
	 {
    	img = document.images[imgID];
	 }
	
	 img.width = parseInt(oldWidth);
	 img.height = parseInt(oldHeight);

	 //alert('begin:'+img.height+"-"+img.width);

     if(maxWidth < 1 && maxHeight > 1){
         if(img.height >= maxHeight){
             img.height = maxHeight;
			 img.removeAttribute("width");
        }
		//alert(img.height+"-"+img.width);
        return true;
     }

     if(maxHeight < 1 && maxWidth > 1){
         if(img.width >= maxWidth){
             img.width = maxWidth;
			 img.removeAttribute("height");
         }
		 //alert('fuck:'+img.height+"-"+img.width);
         return true;
     }

     if((maxHeight > 1 || maxWidth > 1) && (img.height > maxHeight || img.width > maxWidth)){
         if((img.height / maxHeight) >= (img.width / maxWidth)){
			 img.height = maxHeight;
             img.width = img.width * (maxHeight / img.height);
         }else{
			 img.width = maxWidth;
             img.height = img.height * (maxWidth / img.width);
         }
		
         return true;
     }
 }
 
 /**
  * openWindow
  * 打开弹出窗口
  * @param String url 地址
  * @param String name 窗口名
  * @param Int width 
  * @param Int heigth
  */
 function openWindow(url, name, width, height)
 {
 	window.open(url, name, "width=" + width + ",height=" + height + ",toolbar=no, status=no, menubar=no, resizable=no, scrollbars=yes");
 }
 
 

/**
 * cfmMsg
 * @param msg
 */
function cfmMsg(msg)
{
	if(confirm(msg))
	{    			
		return true;
	}
	else
	{
		return false;
	}
}

/**
 *　showHiddenChangeTxt
 *　显示和隐藏的转换
 */
function showHiddenChangeTxt(id)
{
	if(getObj("child"+id).style.display == "")
		getObj("show"+id).innerHTML = "隐藏";
	else if($("child"+id).style.display == "none")
		getObj("show"+id).innerHTML = "显示";
	
}


/**
 * 显示上传图片
 * @param picObj 显示的图像ID
 * @param picSrc 显示的图像src
 */
function showLoadPic(picObj,picSrc)
{
	try
	{
		getObj(picObj).src = picSrc;
	}
	catch(e)
	{
		
	}
}

function onFocus(obj,str)
{
	if (obj.value == str)
	{
		obj.value = '';
		obj.style.color = '#000000';
	}
}

function onBlur(obj,str)
{
	if (obj.value == '')
	{
		obj.value = str;
		obj.style.color = '#CCCCCC';
	}	
}

/**
 * 设置cookies值
 * @param name		名
 * @param value		值
 * @param expires	过期时间
 * @param path		路径
 * @param domain	域
 * @param secure 	安全
*/
function setCookie(name, value, expires, path, domain, secure) 
{
	var curCookie = name + "=" + escape(value) +
			((expires) ? "; expires=" + expires.toGMTString() : "") +
			((path) ? "; path=" + path : "") +
			((domain) ? "; domain=" + domain : "") +
			((secure) ? "; secure" : "");
	if ((name + "=" + escape(value)).length <= 4000)
	{
		document.cookie = curCookie;
	}
	else if (confirm("Cookie exceeds 4KB and will be cut!"))
	{
		document.cookie = curCookie;
	}
		
}

/**
 * 取得cookies值
 * @param cookieName 
 */
function getCookie(cookieName)
{   
	var cookieString  =  document.cookie;   
	var start  =  cookieString.indexOf(cookieName + '=');   
	//alert(cookieString.toString()); 
	if (start == -1) 
	{
		 return null;
	}	 
	start  += cookieName.length + 1;   
	var  end  = cookieString.indexOf(";", start);   
	if (end == -1)
	{
		return  unescape(cookieString.substring(start));
	}
	else
	{
		return  unescape(cookieString.substring(start, end));
	}
	   
}

/**
 * 删除cookies值
 * @param delCookie 
 */
function delCookie(cookieName)
{   
	if (!cookieName)
	{
		cookieName = cfg.cookiesName;
	}
	var exp = new Date();exp.setTime(exp.getTime() - 1);
	setCookie(cookieName,null,exp,'/',cfg.locdomain);
	   
}

/**
 * 页面跳转函数
 * @param docName   要跳转的文件名
 */
function goto(docName, flag)
{
	var urlReg = /\.php/i;
	if (checkLogin(flag))
	{
		if (docName == 'setPhone')
		{
			setPhone();
		}
		else
		{
			if (urlReg.test(docName)) window.location = docName;
			else window.location = docName+".php";
		}
	}
	else
	{
		if (docName == 'setPhone')
		{
			cfg.gotoUrl = "my8ger.php";
		}
		else
		{
			if (urlReg.test(docName)) cfg.gotoUrl = docName;
			else cfg.gotoUrl = docName+".php";
		}

		return false;
	}
}
/**
 * setPhone
 * @param step 步骤
 */
function setPhone(step)
{
	if (!step)step=1;
	if (step >= 1 && step <= 3)
	{
		if (typeof(message) != "object")
		{
			message = new messageDiv(DMM);
		}
		eval("var setPoneDir = cfg.setPoneInc"+step+";");
		message.displayMessage(setPoneDir,580,420);
	}
}
/**
 * 检测页面权限
 * @param 
 */
function checkLogin(flag)
{

	var id = getCookie(cfg.cookiesName);

	if (typeof(id) != 'object' && id != "null" && id != "undefined")
	{
		return true;
	}
	else
	{
		if (flag == false)
		{
			if (typeof(message) != "object")
			{
				message = new messageDiv(DMM);
			}
			message.displayMessage(cfg.errLoginInc,480,310);
			return false;
		}
		else
		{
			//alert(cfg.notLogin);
			if (typeof(message) != "object")
			{
				message = new messageDiv(DMM);
			}
			cfg.errTimeOutStatus = "notLogin";
			message.displayMessage(cfg.errTimeOutInc,480,310);
			return false;
		}
	}
}
/**
 * 动态载入css文件
 * @param cssUrl   要载入的文件名
 * @param name   要载入的脚本id
 */
function loadCss(cssUrl)
{
	if ( navigator.userAgent.toLowerCase().indexOf('msie') >= 0 ) {
		document.createStyleSheet(cssUrl);
	} else {
		var style = document.createElement('link');
		style.type = 'text/css';
		style.rel = 'stylesheet';
		style.href = cssUrl;
		document.body.insertBefore(style, null);
	}
}

/**
 * 检测是否加载了js文件
 */
var documentjs=
{
	getScripts:function()
	{ //获取页面中的所有js
		var retsrc=new Array();
		for(var i=0;i<document.getElementsByTagName('script').length;i++)
		{
			if(document.getElementsByTagName('script')[i].src!=null && document.getElementsByTagName('script')[i].src!='')
			{
				var s=document.getElementsByTagName('script')[i].src;
				if(s.indexOf('//')>0){
					s=s.substr(s.indexOf('//')+2);
					retsrc[retsrc.length]=s.substr(s.indexOf('/'));
				}
				else
				{
					retsrc[retsrc.length]=s;
				}    
			}
		}
		return retsrc;
	},
	isLoadedByName:function(jsname)
	{ //根据文件名判断是否加载,如:test.js
		var js=documentjs.getScripts();
		var f=false;
		for(var i=0;i<js.length;i++)
		{
			var s=js[i].split('/');
			if(s[s.length-1].toLowerCase()==jsname.toLowerCase())
			{
				f=true;break;
			}
		}
			return f;
	},
	isLoadedByPath:function(path)
	{ //根据文件路径判断是否加载，如:/js/test.js
		var js=documentjs.getScripts();
		var f=false;
		for(var i=0;i<js.length;i++)
		{
			if(js[i].toLowerCase()==path.toLowerCase())
			{
				f=true;break;
			}
		}
		return f;
	},
	loadScriptHead:function(path)
	{ //加载文件到head之间
		if(!documentjs.isLoadedByPath(path))
		{
			head=document.getElementsByTagName('head').item(0); 
			script=document.createElement('script'); 
			script.src=path; 
			script.type='text/javascript'; 
			script.defer=true; 
			void(head.appendChild(script)); 
		}
	},
	loadScriptBody:function(path)
	{ //加载到body之间
		if(!documentjs.isLoadedByPath(path))
		{
			script=document.createElement('script'); 
			script.src=path; 
			script.type='text/javascript'; 
			script.defer=true;
			document.body.appendChild(script);
		}
	}
}; 

/**
 * 显示层对话框，登陆框等。
 */
function messageDiv(dmmObject)
{
	this.dMM = dmmObject;

	//if (!this.dMM)
	
	this.setShadow = function(int)
	{
		int?(int = int):(int = 5);
		this.dMM.setShadowOffset(int);	// Large shadow
	};
	this.addEvent = function(eventName)
	{
		cfg.addEvent = eventName;
	};
	this.displayMessage = function(url, width, height, dontDisplayTransparent)
	{
		if (!width)width = 400;
		if (!height)height = 200;
		this.dMM.setSource(url);
		this.dMM.setCssClassMessageBox(false);
		this.dMM.setSize(width,height);
		this.dMM.setShadowDivVisible(true);	// Enable shadow for these boxes
		this.dMM.display(dontDisplayTransparent);
	};
	this.displayStaticMessage = function(messageContent, cssClass, width, height, dontDisplayTransparent)
	{
		if (!width)width = 300;
		if (!height)height = 150;
		this.dMM.setHtmlContent(messageContent);
		this.dMM.setSize(width,height);
		this.dMM.setCssClassMessageBox(cssClass);
		this.dMM.setSource(false);	// no html source since we want to use a static message here.
		this.dMM.setShadowDivVisible(true);	// Disable shadow for these boxes	
		this.dMM.display(dontDisplayTransparent);	
	};
	this.closeMessage = function()
	{
		this.dMM.close();	
	};
}
/**
 * 显示对话框的类开始。
 */
D_mod_Msg = function()
{
	var url;
	var htmlOfModalMessage;
	var divs_transparentDiv;
	var divs_content;
	var iframe;	
	var layoutCss;
	var width;
	var height;
	
	var existingBodyOverFlowStyle;
	var dynContentObj;
	var cssClassOfMessageBox;
	var shadowDivVisible;
	var shadowOffset;
	var MSIE;
		
	this.url = '';
	this.htmlOfModalMessage = '';
	this.layoutCss = 'modal-message.css';
	this.height = 200;
	this.width = 400;
	this.cssClassOfMessageBox = false;
	this.shadowDivVisible = true;
	this.shadowOffset = 5;
	this.MSIE = false;
	if(navigator.userAgent.indexOf('MSIE')>=0) this.MSIE = true;
};

D_mod_Msg.prototype = {
	setSource : function(urlOfSource)
	{
		this.url = urlOfSource;
		
	},
	setHtmlContent : function(newHtmlContent)
	{
		this.htmlOfModalMessage = newHtmlContent;
		
	},
	setSize : function(width,height)
	{
		if(width)this.width = width;
		if(height)this.height = height;		
	},	
	setCssClassMessageBox : function(newCssClass)
	{
		this.cssClassOfMessageBox = newCssClass;
		if(this.divs_content){
			if(this.cssClassOfMessageBox)
				this.divs_content.className=this.cssClassOfMessageBox;
			else
				this.divs_content.className='modalDialog_contentDiv';	
		}
					
	},	
	setShadowOffset : function(newShadowOffset)
	{
		this.shadowOffset = newShadowOffset;
					
	},
	display : function(dontDisplayTransparent)
	{
		if(!this.divs_transparentDiv){
			this.__createDivs();
		}	

		this.divs_transparentDiv.style.display='block';
		if (dontDisplayTransparent) this.divs_transparentDiv.style.display='none';
		this.divs_content.style.display='block';
		this.divs_shadow.style.display='block';		
		if(this.MSIE)this.iframe.style.display='block';	
		this.__resizeDivs();
		window.refToThisModalBoxObj = this;		
		setTimeout('window.refToThisModalBoxObj.__resizeDivs()',150);
		
		this.__insertContent();
	},	
	setShadowDivVisible : function(visible)
	{
		this.shadowDivVisible = visible;
	},
	close : function()
	{
		this.divs_transparentDiv.style.display='none';
		this.divs_content.style.display='none';
		this.divs_shadow.style.display='none';
		if(this.MSIE)this.iframe.style.display='none';
		
	},	
	addEvent : function(whichObject,eventType,functionName,suffix)
	{ 
	  if(!suffix)suffix = '';
	  if(whichObject.attachEvent)
	  { 
	    whichObject['e'+eventType+functionName+suffix] = functionName; 
	    whichObject[eventType+functionName+suffix] = function(){whichObject['e'+eventType+functionName+suffix]( window.event );}; 
	    whichObject.attachEvent( 'on'+eventType, whichObject[eventType+functionName+suffix] ); 
	  } 
	  else 
	  {
	    whichObject.addEventListener(eventType,functionName,false);
	  }
	},
	__createDivs : function()
	{
		this.divs_transparentDiv = document.createElement('DIV');
		this.divs_transparentDiv.className='modalDialog_transparentDivs';
		this.divs_transparentDiv.id='DHTMLSuite_modalDialog_transparentDivs';
		this.divs_transparentDiv.style.left = '0px';
		this.divs_transparentDiv.style.top = '0px';
		
		document.body.appendChild(this.divs_transparentDiv);
		this.divs_content = document.createElement('DIV');
		this.divs_content.className = 'modalDialog_contentDiv';
		this.divs_content.id = 'DHTMLSuite_modalBox_contentDiv';
		this.divs_content.style.zIndex = 100000;
		
		if(this.MSIE){
			this.iframe = document.createElement('<IFRAME src="about:blank" frameborder=0 id="modalDialog_contentIframe">');
			this.iframe.style.zIndex = 90000;
			this.iframe.style.position = 'absolute';
			document.body.appendChild(this.iframe);	
		}
			
		document.body.appendChild(this.divs_content);
		this.divs_shadow = document.createElement('DIV');
		this.divs_shadow.className = 'modalDialog_contentDiv_shadow';
		this.divs_shadow.id = 'DHTMLSuite_contentDiv_shadow';
		this.divs_shadow.style.zIndex = 95000;
		document.body.appendChild(this.divs_shadow);
		window.refToModMessage = this;
		this.addEvent(window,'scroll',function(e){ window.refToModMessage.__repositionTransparentDiv();});
		this.addEvent(window,'resize',function(e){ window.refToModMessage.__repositionTransparentDiv();});
		

	}
	,	
	__getBrowserSize : function()
	{
    	var bodyWidth = document.documentElement.clientWidth;
    	var bodyHeight = document.documentElement.clientHeight;
    	
		var bodyWidth, bodyHeight; 
		if (self.innerHeight){
		 
		   bodyWidth = self.innerWidth; 
		   bodyHeight = self.innerHeight; 
		}  else if (document.documentElement && document.documentElement.clientHeight) {	 
		   bodyWidth = document.documentElement.clientWidth; 
		   bodyHeight = document.documentElement.clientHeight; 
		} else if (document.body) {
		   bodyWidth = document.body.clientWidth; 
		   bodyHeight = document.body.clientHeight; 
		} 
		return [bodyWidth,bodyHeight];		
		
	}
	,
    __resizeDivs : function()
    {
    	
    	var topOffset = Math.max(document.body.scrollTop,document.documentElement.scrollTop);

		if(this.cssClassOfMessageBox)
			this.divs_content.className=this.cssClassOfMessageBox;
		else
			this.divs_content.className='modalDialog_contentDiv';	
			    	
    	if(!this.divs_transparentDiv)return;
    	
    	var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
    	var sl = Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);
    	
    	window.scrollTo(sl,st);
    	setTimeout('window.scrollTo(' + sl + ',' + st + ');',10);

    	this.__repositionTransparentDiv();
    	

		var brSize = this.__getBrowserSize();
		var bodyWidth = brSize[0];
		var bodyHeight = brSize[1];
    	
      	this.divs_content.style.width = this.width + 'px';
    	this.divs_content.style.height= this.height + 'px';  	

    	var tmpWidth = this.divs_content.offsetWidth;	
    	var tmpHeight = this.divs_content.offsetHeight;	
    	this.divs_content.style.left = Math.ceil((bodyWidth - tmpWidth) / 2) + 'px';
    	this.divs_content.style.top = (Math.ceil((bodyHeight - tmpHeight) / 2) +  topOffset) + 'px';
    	
 		if(this.MSIE){
 			this.iframe.style.left = this.divs_content.style.left;
 			this.iframe.style.top = this.divs_content.style.top;
 			this.iframe.style.width = this.divs_content.style.width;
 			this.iframe.style.height = this.divs_content.style.height;
 		}
    	this.divs_shadow.style.left = (this.divs_content.style.left.replace('px','')/1 + this.shadowOffset) + 'px';
    	this.divs_shadow.style.top = (this.divs_content.style.top.replace('px','')/1 + this.shadowOffset) + 'px';
    	this.divs_shadow.style.height = tmpHeight + 'px';
    	this.divs_shadow.style.width = tmpWidth + 'px';
    	if(!this.shadowDivVisible)this.divs_shadow.style.display='none';
    },    
    __repositionTransparentDiv : function()
    {
    	this.divs_transparentDiv.style.top = Math.max(document.body.scrollTop,document.documentElement.scrollTop) + 'px';
    	this.divs_transparentDiv.style.left = Math.max(document.body.scrollLeft,document.documentElement.scrollLeft) + 'px';
		var brSize = this.__getBrowserSize();
		var bodyWidth = brSize[0];
		var bodyHeight = brSize[1];
    	this.divs_transparentDiv.style.width = bodyWidth + 'px';
    	this.divs_transparentDiv.style.height = bodyHeight + 'px';		
		   	
    },
    __insertContent : function()
    {
		if(this.url){
			ajax_loadContent('DHTMLSuite_modalBox_contentDiv',this.url);
		}else{
			this.divs_content.innerHTML = this.htmlOfModalMessage;	
		}
    }		
};
var DMM = new D_mod_Msg();

var enableCache = false;
var jsCache = new Array();

var dynamicContent_ajaxObjects = new Array();

function ajax_showContent(divId,data,url,doCache)
{

	var dataStr = data.replace(/\{%\$theme%\}/g,cfg.themeDir);

	if (!doCache)
	{
		var targetObj = document.getElementById(divId);
		targetObj.innerHTML = dataStr;
	}
	if (cfg.addEvent == 'move')
	{
		var whichObject = document.getElementById("infoTitle");
		var shadow	= document.getElementById("DHTMLSuite_contentDiv_shadow");	
		var iframe  = document.getElementById("modalDialog_contentIframe");
		var titleX = "";
		var titleY = "";
		var functionDown = function ()
							{
								titleX=event.x-targetObj.style.pixelLeft;
								titleY=event.y-targetObj.style.pixelTop;
								sX=event.x-shadow.style.pixelLeft;
								sY=event.y-shadow.style.pixelTop;
								iX=event.x-iframe.style.pixelLeft;
								iY=event.y-iframe.style.pixelTop;

								//alert(titleX+"+"+titleY);
							};
		var functionOver = function ()  //实现层的拖移
							{
								if (event.button == 1)
								{
									var cX=targetObj.clientLeft;
									var cY=targetObj.clientTop;
									targetObj.style.pixelLeft=cX+(event.x-titleX);
									targetObj.style.pixelTop=cY+(event.y-titleY);
									var scX=shadow.clientLeft;
									var scY=shadow.clientTop;
									shadow.style.pixelLeft=scX+(event.x-sX);
									shadow.style.pixelTop=scY+(event.y-sY);
									var icX=iframe.clientLeft;
									var icY=iframe.clientTop;
									iframe.style.pixelLeft=icX+(event.x-iX);
									iframe.style.pixelTop=icY+(event.y-iY);
									//alert(cX+"+"+cY+"+"+targetObj.style.pixelLeft+"+"+targetObj.style.pixelTop);
								}
							};
		
		whichObject.style.cursor = "move";
		$(whichObject).bind("mousedown", functionDown);
		$(whichObject).bind("mousemove", functionOver);
		//this.dMM.addEvent(whichObject,eventType,functionName);	// addEvent
	}	
	if(doCache && url){			//old  enableCache
		jsCache[url] = dataStr;
		//alert(jsCache[url]);
	}
	if (!doCache)
	{
		ajax_parseJs(targetObj);
	}
}

function ajax_loadContent(divId,url,doCache)
{
	if(jsCache[url]){		//old  enableCache
		//document.getElementById(divId).innerHTML = jsCache[url];
		ajax_showContent(divId,jsCache[url],url);
		//alert("ok");
		return;
	}
	if (!doCache)
	{
	var ajaxIndex = dynamicContent_ajaxObjects.length;
	document.getElementById(divId).innerHTML = '<br><br><div style="text-align:center"><img src='+cfg.themeDir+'loading.gif />Loading content - please wait</div>';
	}
	$.get(url+"?"+(new Date()).getTime(),'',function(data){ ajax_showContent(divId,data,url,doCache); });
}

function ajax_parseJs(obj)
{
	var scriptTags = obj.getElementsByTagName('SCRIPT');
	var string = '';
	var jsCode = '';
	for(var no=0;no<scriptTags.length;no++){	
		if(scriptTags[no].src){
	        var head = document.getElementsByTagName("head")[0];
	        var scriptObj = document.createElement("script");
	
	        scriptObj.setAttribute("type", "text/javascript");
	        scriptObj.setAttribute("src", scriptTags[no].src);  	
		}else{
			if(navigator.userAgent.indexOf('Opera')>=0){
				jsCode = jsCode + scriptTags[no].text + '\n';
			}
			else
			{
				jsCode = jsCode + scriptTags[no].innerHTML;	
			}
		}
		
	}

	if(jsCode) ajax_installScript(jsCode);
}


function ajax_installScript(script)
{		
    if (!script)
        return;		
    if (window.execScript)
	{        	
    	window.execScript(script);
    }
	else if(window.jQuery && jQuery.browser.safari)
	{
        window.setTimeout(script,0);
    }
	else
	{        	
        window.setTimeout(script, 0);
    } 
}
/**
 * 显示对话框的类结束。
 */

/**
 * 选择Radio，取得值
 */
function selectRadio(radioName)
{//alert(radioName);
	var tempRadio = document.getElementsByName(radioName);
	
	for (var i=0; i<tempRadio.length; i++) 
	{
		if (tempRadio[i].checked == true) 
		{
			var tempValue = tempRadio[i].value;
			break;
		}
	}
	//alert(tempValue);
	return tempValue;
}

/**
 * 设置Radio，值
 */
function setRadio(radioName,checked)
{//alert(radioName);
	var tempRadio = document.getElementsByName(radioName);
	var number = "";
	for (var i=0; i<tempRadio.length; i++) 
	{
		if (tempRadio[i].value == checked) 
		{
			tempRadio[i].checked = true;
			number = i;
			break;
		}
	}
	//alert(tempValue);
	return number;
}

/**
 * 选择selectCheckBox，选择复选框
 */
function selectCheckBox(CheckBoxName)
{
	var tempCheckBox = document.getElementsByName(CheckBoxName);
	var tempValue = Array();
	for (var i=0; i<tempCheckBox.length; i++) 
	{
		if (tempCheckBox[i].checked == true) 
		{
			tempValue.push(tempCheckBox[i].value);
		}
	}
	var tempStr = "["+tempValue.toString()+"]";
	return tempStr;
}
/**
 * setCheckBox，设置复选框
 */
function setCheckBox(CheckBoxName,checked)
{
	var tempCheckBox = document.getElementsByName(CheckBoxName);
	//var tempNumber = Array();
	for (var i=0; i<tempCheckBox.length; i++) 
	{
		if (tempCheckBox[i].value == checked) 
		{
			tempCheckBox[i].checked = true;
			//tempNumber.push(i);
		}
	}
	//var tempStr = "["+tempNumber.toString()+"]";
	return true;
}
/**
 * setCheckBox，设置复选框
 */
function setSelect(CheckSelectName,Selected)
{
	var tempSelect = document.getElementsByName(CheckSelectName);
	//var tempNumber = Array();
	for (var i=0; i<tempSelect.options.length; i++) 
	{
		if (tempSelect.options[i].value == Selected) 
		{
			tempSelect.options[i].selected = true;
			//tempNumber.push(i);
		}
	}
	//var tempStr = "["+tempNumber.toString()+"]";
	return true;
}


/*
	设置复选框
*/
function selectOptionByValue(name, value ){
	
	var obj=document.getElementsByTagName( 'SELECT' );
	obj=obj[name];

	for (i=obj.options.length-1;i>=0;i--)   
	  {   
		  if(obj.options[i].value==value){
				obj.options[i].selected=true;
				return true;
		  }
	  }
	return false;
}

/*
	复选框值
*/

function getOptionValue(name ){

	var obj=document.getElementsByTagName( 'SELECT' );
	obj=obj[name];

	for (i=obj.options.length-1;i>=0;i--)   
	  {   
		  if(obj.options[i].selected==true){
				return obj.options[i].value;
		  }
	  }
	return false;
}


function setFocus(id)
{
	if (typeof(id) == "object")
	{
		id.focus();
	}
	else
	{
		getObj(id).focus();
	}
}
/*
 * 弹出好友管理菜单相关操作  开始
 *
 */
var agt = navigator.userAgent.toLowerCase();
var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var menu_z_index = 1;
function findPosX(obj)
{
	var curleft = 0;
	if(obj.offsetParent)
	{
		while(obj.offsetParent)
		{
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	}
	else if(obj.x)
	{
		curleft += obj.x;
	}
	return curleft - ietruebody().scrollLeft;
}
function findPosY(obj)
{
	var curtop = 0;
	if(obj.offsetParent)
	{
		while(obj.offsetParent)
		{
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	} 
	else if(obj.y)
	{
		curtop += obj.y;
	}
	return curtop - ietruebody().scrollTop;
}
function menupz(obj,type,contentId)
{
	menu_z_index++;
	if (!contentId) contentId = "showmenu";
	var o = getObj(contentId);
	o.style.display = '';
	o.style.cssText = 'FILTER:Alpha(opacity=95);opacity:0.95;left:-500px;z-index:300000';
	if (contentId == "showmenu") 
	{
		menu_z_index += 300000;
		o.style.cssText = 'FILTER:Alpha(opacity=95);opacity:0.95;left:-500px;z-index:'+menu_z_index;
	}
	
	if(typeof obj == 'string')
	{
		obj = getObj(obj);
	}
	if(obj == null)
	{
		o.style.top  = (ietruebody().clientHeight - o.offsetHeight)/2 + ietruebody().scrollTop + 'px';
		o.style.left = (ietruebody().clientWidth - o.offsetWidth)/2 + 'px';
	} 
	else
	{
		var top  = findPosY(obj);
		var left = findPosX(obj);
		if(top < ietruebody().clientHeight/2 || type>3)
		{
			top += ietruebody().scrollTop + obj.offsetHeight;
		} 
		else
		{
			top += ietruebody().scrollTop - o.offsetHeight;
		}
		if(left > (ietruebody().clientWidth)*3/5)
		{
			left -= o.offsetWidth - obj.offsetWidth;
		}
		o.style.top  = top  + 'px';
		o.style.left = left + 'px';
	}
}
function mouseover_open(idName,object,type, contentId)
{
	if(typeof type == "undefined")
	{
		type = 1;
	}
	
	if (!contentId) contentId = "showmenu";
	getObj(contentId).innerHTML = getObj(idName).innerHTML;
	getObj(contentId).className = getObj(idName).className;

	menupz(object,type,contentId);
	try{
	if (contentId == "showmenu" && getObj("showmenu1")) closep("showmenu1");
	}catch(e){}
	if(type!=2)
	{
		document.onmouseout = doc_mouseout;
		//alert("ccc");
	}
	
	return false;
}
function closep(contentId)
{//alert(contentId);
	if (!contentId) contentId = "showmenu";
	getObj(contentId).style.display = "none";
	document.onmouseout = '';
	try{
	if (contentId == "showmenu" && getObj("showmenu1")) 
	{
		showSub(navigationSubId , navigationTopId );
		//alert(navigationSubId +"-"+ navigationTopId);
	}//alert(navigationSubId +"-"+ navigationTopId+ "+");
	}catch(e){}
	return false;
}
function doc_mouseout(e,contentId)
{
	var e = is_ie ? event: e;
	if (!contentId) contentId = "showmenu";
	var o = getObj(contentId);
	_x	= is_ie ? e.x : e.pageX;
	_y	= is_ie ? e.y + ietruebody().scrollTop : e.pageY;
	_x1 = o.offsetLeft + 4;
	_x2 = o.offsetLeft + o.offsetWidth;
	_y1 = o.offsetTop - 20;
	_y2 = o.offsetTop + o.offsetHeight + 10;

	if(_x<_x1 || _x>_x2 || _y<_y1 || _y>_y2)
	{
		closep(contentId);
	}
}
function ietruebody()
{
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}
function IsElement(id)
{
	return document.getElementById(id)!=null ? true : false;
}
/*
 * 弹出好友管理菜单相关操作  结束
 *
 */
/*
 * 选中所有checkbox
 */ 
function selectAllCheckBox(CheckBoxName, obj)
{
	var tempCheckBox = document.getElementsByName(CheckBoxName);
	var value = obj.checked;

	for (var i=0; i<tempCheckBox.length; i++) 
	{
		if (value)
		{
			if (tempCheckBox[i].checked != true) 
			{
				tempCheckBox[i].checked = true;
			}
		}
		else
		{
			if (tempCheckBox[i].checked == true) 
			{
				tempCheckBox[i].checked = false;
			}
			
		}
	}
	
	return tempCheckBox.length;
}
//copy code
function copycode(val) 
{
	//var clipBoardContent=window.document.title;
	
	window.clipboardData.setData("Text",val);
	alert("复制成功，请按CTRL+V粘贴到合适的位置！");
}

window.onbeforeunload = function()
{ 
	var   n   =   window.event.screenX   -   window.screenLeft;   
	var   b   =   n   >   document.documentElement.scrollWidth-20;   
	if(b   &&   window.event.clientY   <   0   ||   window.event.altKey)   
	{   
		var t= document.referrer;
		var id = getCookie(cfg.cookiesName);
		if(id && t.toLowerCase().indexOf(cfg.locdomain)>0)
		{
			$.get('logout.php');
		}
	}   
};

function menu_display(t_id,i_id_1,i_id_2){

	var t_id;
	var i_id_1;
	var	i_id_2;
	var on_img_1 = cfg.themeDir+"tree_on_1.gif";
	var off_img_1 = cfg.themeDir+"tree_off_1.gif";
	
	var on_img_2 = cfg.themeDir+"tree_on_2.gif";
	var off_img_2 = cfg.themeDir+"tree_off_2.gif";
	
	if (t_id.style.display == "none") {
		t_id.style.display="";	
		i_id_1.src=on_img_1;
		i_id_2.src=on_img_2;	
	} else {
		t_id.style.display="none";
		i_id_1.src=off_img_1;
		i_id_2.src=off_img_2;	
	}
}

var dropReady = false;
var dt = null;
var dHeight = null;
var timer = null;
var fq = 20;
var tip_id = null;
var hr = 0;

function hideTopTip(divid)
{
	//if(!dropReady)return;
	tip_id = "toptip";
	var toppopIconObj = getObj('webcall_toppop_icon');
	var huabaoIdObj	= getObj('huabao_id');
	if (divid == 1) 
	{
		tip_id = "#SoftPhone_tip";
		
		if($('#noTips1').attr('checked') == true)
		{
			var exp = new Date();
			exp.setTime(exp.getTime() + 36000000);
			setCookie('notshow1',1,exp,'/',cfg.locdomain);
		}	
		$(tip_id).css("display","none");
		return ;
	}


	tip_id = "#"+tip_id;



	dHeight = parseInt($(tip_id).css("height")) + 4;
	if($('#noTips').attr('checked') == true)
	{
		var exp = new Date();
		exp.setTime(exp.getTime() + 36000000);
		setCookie('notshow',1,exp,'/',cfg.locdomain);
	}

	//alert($('#toptip').css("height"));
	//return ;
	var loop = function()
	{
		hr += 3;
		if(hr >= dHeight)
		{
		$(tip_id).css("marginTop", '-' + dHeight );
		//$(tip_id).css("display","none");
		clearInterval(timer);
		dropReady = false;
		}
		else
		{
		$(tip_id).css("marginTop", '-' + hr );
		}
	};
	timer = setInterval(loop,fq);
}

function chkRecharge(action,memo)
{
	var actionUrl = "";
	var displayStr = "";
	if (action == 'redeem')
	{
		displayStr = "提现";
		actionUrl = root+'member/member-balance-redeem.php';	
	}
	else if (action == 'detail')
	{
		displayStr = "查看明细";
		actionUrl = root+'member/member-balance-detail.php';
	}
	else if (action == 'webcall')
	{
		actionUrl = root+'webcall.php';
	}
	else
	{
		displayStr = "充值";
		if( action && action !=undefined ){
			actionUrl = root+'member/member-balance-recharge.php?mode='+action;
		}
		else{
			actionUrl = root+'member/member-balance-recharge.php';
		}
	}
	$.get
	(
		root+'member.php',
		{"step":"chkLogin"},
		function (msg)
		{
			if(msg)
			{				
				//alert(msg);
				if(msg == 'NoLogin')
				{

					if(memo=='' || memo == undefined){
						cfg.memo = "<div style=\"text-align:left; margin-bottom:10px; line-height:22px\">1:海拔网注册用户登录后,才可以"+displayStr+"<br>2:非注册用户需要注册登录后，才可以"+displayStr+"。<a href='"+root+"reg.php'>注册</a></div>";
					}
					else{
						cfg.memo=memo;
					}
					
					/*
					if( displayStr == "充值" ){
						cfg.memo=memo;
					}
					*/

					cfg.fresh = actionUrl;
					checkLogin(false);
					return false;
				}
			}
			else
			{

				window.location = actionUrl;	

			}
		}
	);
}

//收藏文章
function ArticleFavorite(artId)
{
	if (!artId) return ;
	$.get
	(
		root+'member.php',
		{"step":'ArticleFavorite', "artId":artId},
		function (msg)
		{
			
			if(msg == 'FavoriteSuccess')
			{
				alert('恭喜，收藏成功！');
			}
			else if(msg == 'FavoriteExist')
			{
				alert('您已经收藏过此篇文章了！');
			}
			else
			{
				displayStr = "收藏文章";
				cfg.memo = "<div style=\"text-align:left; margin-bottom:10px; line-height:22px\">1:海拔网注册用户登录后,才可以"+displayStr+"<br>2:非注册用户需要注册登录后，才可以"+displayStr+"。<a href='"+root+"reg.php'>注册</a></div>";
				checkLogin(false);
				return false;
			}
		}
	)

}


//推荐文章到邮件
function recommendArticle(artId)
{

	if (!artId) return ;

	displayStr = "推荐文章";
	cfg.memo = "<div style=\"text-align:left; margin-bottom:10px; line-height:22px\">1:海拔网注册用户登录后,才可以"+displayStr+"<br>2:非注册用户需要注册登录后，才可以"+displayStr+"。<a href='"+root+"reg.php'>注册</a></div>";
	checkLogin(false);
	
	if (typeof(message) != "object")
	{
		message = new messageDiv(DMM);
	}
	
	cfg.recommendArtId = artId;
	//alert( cfg.SendMailToFriend );
	cfg.SendArticleToFriend = root+"include/inc/recommend-article.html";
	message.displayMessage(cfg.SendArticleToFriend,480,310);

}

//举报文章
function doArticleReport(artId)
{
	if (!artId) return ;

	displayStr = "举报文章";
	cfg.memo = "<div style=\"text-align:left; margin-bottom:10px; line-height:22px\">1:海拔网注册用户登录后,才可以"+displayStr+"<br>2:非注册用户需要注册登录后，才可以"+displayStr+"。<a href='"+root+"reg.php'>注册</a></div>";
	checkLogin(false);

	if (typeof(message) != "object")
	{
		message = new messageDiv(DMM);
	}

	cfg.problemArtId = artId;
	cfg.SendArticleProblem = root+"include/inc/report-problem-article.html";
	message.displayMessage(cfg.SendArticleProblem,480,250);

}

//ajax获取服务状态
function getServiceStatus(SrvId){

	if (!SrvId) return ;

	//alert(SrvId);

	$.get(
		root+"member.php",
		{"step":"getServiceStatus","SrvId":SrvId},
		function (msg){
			
			//alert(msg);
			if(msg) return msg;
		}		
	);
}

//ajax处理中

function Ajax_Load_Show(){
	
	var Ajax_Load_Div="";

	Ajax_Load_Div=document.getElementById('Ajax_Load_Div');

	if(Ajax_Load_Div == "" || Ajax_Load_Div==undefined || !Ajax_Load_Div){

		var Ajax_Load_Div=document.createElement('DIV');
		
		Ajax_Load_Div.style.color='#00FF00';
		Ajax_Load_Div.style.fontsize='75%';
		Ajax_Load_Div.style.top=20;
		Ajax_Load_Div.style.right=30;
		Ajax_Load_Div.style.padding=2;
		Ajax_Load_Div.style.position='absolute';
		Ajax_Load_Div.style.background='#000000';
		Ajax_Load_Div.style.zIndex =3;
		Ajax_Load_Div.id='Ajax_Load_Div';
		Ajax_Load_Div.innerHTML="正在执行...";
		
		document.body.appendChild(Ajax_Load_Div);

	}
	Ajax_Load_Div.style.display='';
}

//ajax 隐藏

function Ajax_Load_Hidden(){
	
	var Ajax_Load_Div;
	Ajax_Load_Div=document.getElementById('Ajax_Load_Div');
	Ajax_Load_Div.style.display ='none';
	
}

function SoftPhone_Installed(){

	var s_ActiveX=null;
	try{

		s_ActiveX=new ActiveXObject("ACTIVEPHONE.activePhoneCtrl.1");
		if( s_ActiveX == null ){
			return false;
		}
		s_ActiveX=null;
		return true;
	}
	catch(e){
		return false;
	}
	return true;
}