function isemail(str)
{
  var supported = 0;
  if (window.RegExp)
  {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported) return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(str) && r2.test(str));
}
function isdate(strDate){
   var strSeparator = "-"; //日期分隔符
   var strDateArray;
   var intYear;
   var intMonth;
   var intDay;
   var boolLeapYear;

   strDateArray = strDate.split(strSeparator);

   if(strDateArray.length!=3) return false;

   intYear = parseInt(strDateArray[0],10);
   intMonth = parseInt(strDateArray[1],10);
   intDay = parseInt(strDateArray[2],10);

   if(isNaN(intYear)||isNaN(intMonth)||isNaN(intDay)) return false;

   if(intMonth>12||intMonth<1) return false;

   if((intMonth==1||intMonth==3||intMonth==5||intMonth==7||intMonth==8||intMonth==10||intMonth==12)&&(intDay>31||intDay<1)) return false;

   if((intMonth==4||intMonth==6||intMonth==9||intMonth==11)&&(intDay>30||intDay<1)) return false;

   if(intMonth==2){
      if(intDay<1) return false;

      boolLeapYear = false;
      if((intYear%100)==0){
         if((intYear%400)==0) boolLeapYear = true;
      }
      else{
         if((intYear%4)==0) boolLeapYear = true;
      }

      if(boolLeapYear){
         if(intDay>29) return false;
      }
      else{
         if(intDay>28) return false;
      }
   }
   return true;
}
function CheckChar(template, string)
{
	var letters=template;
	var charlength=string.length;
	for (i=0;i<charlength;i++)
	{
		var tempChar=string.charAt(i);
		if (letters.indexOf(tempChar)==-1)
		{
			return false;
		}
	} 
	return true;
}	      
function trimString(str)
{
var i,j;
if(str == "") return "";

for(i=0;i<str.length;i++)
if(str.charAt(i) != ' ') break;
if(i >= str.length) return "";

for(j=str.length-1;j>=0;j--)
if(str.charAt(j) != ' ') break;
return str.substring(i,j+1);
}
function uisNum(str)
{
var i, cChar;
str = trimString(str);
for(i=0;i<str.length;i++) 
{
cChar = str.charAt(i);
if( !(("0"<=cChar) && (cChar<="9")) )
return false;
}
return true;
}
function readCookie(name){   //读取cookies
//    name="homepagewsdc"
	cookies_value=WM_readCookie(name)
	return cookies_value
//	alert(cookies_value)
}
function WM_readCookie(name)
{
//如果没有cookie则返回false或者取得值并返回该值
if (document.cookie == '')
    return false;	
else
    return unescape(WM_getCookieValue(name));
}
function WM_getCookieValue(name)
{
// Declare variables.
var firstChar,lastChar;
// Get the entire cookie string.
// (This may have other name=value pairs in it.)
var theBigCookie = document.cookie;
// Grab just this cookie from theBigCookie string.
// Find the start of 'name'.
firstChar = theBigCookie.indexOf(name);
// If you found it,
if(firstChar != -1)
{
// skip 'name' and '='.
firstChar +=
name.length + 1;
// Find the end of the value string (i.e. the next';').
lastChar = theBigCookie.indexOf(';', firstChar);
if(lastChar == -1) lastChar = theBigCookie.length;
// Return thevalue.
return theBigCookie.substring(firstChar, lastChar);
} else
{
// If there was no cookie, return false.
return false;
}
}
