//函数名：chkemail
//功能介绍：检查是否为Email Address
//参数说明：要检查的字符串
//返回值：0：不是  1：是
function chkemail(a)
{	var i=a.length;
	var temp = a.indexOf('@');
	var tempd = a.indexOf('.');
	if (temp > 1) {
		if ((i-temp) > 3){
			
				if ((i-tempd)>0){
					return 1;
				}
			
		}
	}
	return 0;
}

/*检查电话号码*/
function fucCheckTEL(TEL)
{
	var i,j,strTemp;
	strTemp="0123456789-()# ";
	for (i=0;i<TEL.length;i++)
	{
		j=strTemp.indexOf(TEL.charAt(i));	
		if (j==-1)
		{
		//说明有字符不合法
			return 0;
		}
	}
	//说明合法
	return 1;
}

/*获得对象*/
function getId(o)
{
	return document.getElementById(o);	
}

/*隐藏某对象*/
function hiddenOb(idnum)
{
	getId(idnum).style.display = "none";
}

/*显示某对象*/
function showOb(idnum)
{
	getId(idnum).style.display = "block";
}


//去前后空格
//by zhouzhe

String.prototype.Trim = function() 
{ 
    return this.replace(/(^\s*)|(\s*$)/g, ""); 
} 
String.prototype.LTrim = function() 
{ 
    return this.replace(/(^\s*)/g, ""); 
} 
String.prototype.Rtrim = function() 
{ 
    return this.replace(/(\s*$)/g, ""); 
}

//检查邮箱地址有效性--------
function checkmail(mail){
  var strr;
  re=/(\w+@\w+\.\w+)(\.{0,1}\w*)(\.{0,1}\w*)/i;
  re.exec(mail);
  if (RegExp.$3!="" && RegExp.$3!="." && RegExp.$2!="."){
	  strr=RegExp.$1+RegExp.$2+RegExp.$3
  }
  else{
    if (RegExp.$2!="" && RegExp.$2!="."){
		strr=RegExp.$1+RegExp.$2;
	}else{
		strr=RegExp.$1
	}
  }
  if (strr!=mail){return false}
  return true;
}

/*
===========================================
//是否是手机
===========================================
*/
String.prototype.isMobile = function()
{
    return /^0{0,1}13[0-9]{9}$/.test(this);
}

/*
===========================================
//是否是邮件
===========================================
*/
String.prototype.isEmail = function()
{
    return /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(this);
}

/*
===========================================
//是否是正数
===========================================
*/
String.prototype.isAllNumeric = function()
{
    return /^\d+\.?\d*$/.test(this);
}

/*使IFRAME自适应高度*/
function SetCwinHeight(iframeObj)
{
	if (document.getElementById)
	{
		if(iframeObj && !window.opera)
		{
			if (iframeObj.contentDocument && iframeObj.contentDocument.body.offsetHeight)
			{
				iframeObj.height = iframeObj.contentDocument.body.offsetHeight;
			}
			else if(document.frames[iframeObj.name].document && document.frames[iframeObj.name].document.body.scrollHeight)
			{
				iframeObj.height = document.frames[iframeObj.name].document.body.scrollHeight;
			}
		}
	}  
}
