var t_DiglogX=0;
var t_DiglogY=0;
var t_DiglogW=0;
var t_DiglogH=0;
var xmlHttp="";
/****************************去全角、半角空格*********************************/
/**
*去除头部和尾部空格*obj参数：含有string的对象*返回值:去除了空格后的对象*/
function trimspace(obj)
{
	String.prototype.Trim = function()
	{
		return this.replace(/(^\s*)|(\s*$)/g, "");
	}			
	obj.value = obj.value.Trim();
}
/****************************测字符串的长度*********************************/
/**
*去除头部和尾部空格*obj参数：strValue，要测试的字符串；len，最大长度,msg出错信息
*返回值:大于最大值，返回false；负责返回true。*/
function checkStrLen(strValue,len,msg)
{
    var newvalue = strValue.replace(/[^\x00-\xff]/g, "**");  
    var length = newvalue.length;
    if(msg==null)
    {
     msg="您";
    }
    if(length>len)
    {
        alert(msg+"输入太长了。");
        return false;
    } 
    else
    {
        return true;
    }
}

function showxieyi(id){
	 if($$(id).style.display==''){
		 $$(id).style.display='none';}
	 else{$$(id).style.display='';}
}
function itMouse()
{
	var layerid=document.getElementById("city-pop");
	if(layerid.style.display=="none")
	{
		layerid.style.display="block";
	}
	else{
		layerid.style.display="none";	
	}
}
function chongaddpay(o){
	if(o.shu.value==""){
		alert("对不起,您正确输入!");
		o.shu.focus();
		return false;
	}
	if(o.kindid.value=="1"){
		document.Form1.action="../alipay/default.aspx";	
	}
	else if(o.kindid.value=="2"){
		document.Form1.action="../chinabank/send.aspx";		
	}
	else{
		document.Form1.action="?action=consumesave";		
	}
}
function judgeString(str){
 	var len = str.length;
	var tt=0;
    for(var i=0;i<len;i++){
       var txt = str.charCodeAt(i);
       if(txt>128){     //ascii码大于128的是汉字
          tt= tt+2;
       } else{
          tt= tt+1;
       }
    }
 	return tt;
}
function isRightEmail(email) {
   var re="^[\s]*[a-zA-Z0-9._%-]+@[a-zA-Z0-9._%-]+\.[a-zA-Z0-9]{2,4}[\s]*$";
   if(email.match(re)==null)
       return false;
   else
       return true;
}
function isRightPW(pwd) {
   var re= "^[a-zA-Z0-9_]*$";
   if (pwd.match(re) == null)
      return false;
   else
     return true;
}
function CheckUserName(namet){
	var lent=judgeString(namet);
	if(lent < 3 || lent > 16)
		return false;
	else
		return true;
}
function CheckUserPwd(namet){
	var lent=judgeString(namet);
	if(lent < 6 || lent > 32)
		return false;
	else
		return true;
}
function showlogin(url)
{
	var  Digital=new  Date();
	Digital=Digital+40000;
	url=url+"&k="+Digital;
	xmlHttp=GetXmlHttpObject(requestischecklogintttt)
	xmlHttp.open("get", url , true)
	xmlHttp.send(null);
}
function requestischecklogintttt()
{
	if(xmlHttp.readyState==4)
	{
		if(xmlHttp.status==200)
		{
			var output=xmlHttp.responseText;
			//alert(document.getElementById("islogin"));
			document.getElementById("islogin").innerHTML = output;
		}
	}
}
function copyToClipBoard(){
    var clipBoardContent="";
    clipBoardContent+=document.title;
    clipBoardContent+="";
    clipBoardContent+=window.location.href;
    window.clipboardData.setData("Text",clipBoardContent);
    alert("复制成功，请粘贴到你的QQ/MSN上推荐给你的好友");
}

function copyTo(val,tt){
	window.clipboardData.setData("Text",val);
	if(tt=="")
		tt="QQ/MSN";
    alert("复制成功，请粘贴到你的"+tt+"上推荐给你的好友");
}

﻿/****************************通过ID号取得对象***********************************/
function $$(id){
  return document.getElementById(id);
}
function getCookie(name)
{
	 var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
     if(arr != null) return unescape(arr[2]); return null;
}
function setCookie(name,value)
{
  var Days = 30; //此 cookie 将被保存 30 天
  var exp  = new Date();    //new Date("December 31, 9998");
  exp.setTime(exp.getTime() + Days*24*60*60*1000);
  document.cookie = name + "="+ escape(value) +";expires="+ exp.toGMTString()+";path=/" ;
}
function delCookie(name)
{
  var exp = new Date();
  exp.setTime(exp.getTime() - 1);
  var cval=getCookie(name);
  if(cval!=null) document.cookie=name +"="+cval+";expires="+exp.toGMTString();
}
function loadss(){
	if(getCookie("themeIndexTom")){
		setTtCss(getCookie("themeIndexTom"))
	}
}
function setTtCss(index){
	if(window.location.href.indexOf("learn")!=-1){
		if(window.location.href.indexOf("learn/index.html")!=-1){
			document.getElementById('themecss').href = "template/default/skin/theme/theme" + index + ".css";	
		}
		else{
			document.getElementById('themecss').href = "../template/default/skin/theme/theme" + index + ".css";		
		}
	}
	else{
		document.getElementById('themecss').href = "/template/default/skin/theme/theme" + index + ".css";	
	}
}
function GetXmlHttpObject(handler)
{ 
	var objXmlHttp;
	//开始初始化XMLHttpRequest对象
	if(window.XMLHttpRequest) { //Mozilla 浏览器
			objXmlHttp = new XMLHttpRequest();
			if (objXmlHttp.overrideMimeType) {//设置MiME类别
				objXmlHttp.overrideMimeType("text/xml");
			}
	}
	else if (window.ActiveXObject) { // IE浏览器
			try {
				objXmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					objXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {}
			}
	}
	if (!objXmlHttp) { // 异常，创建对象实例失败
			window.alert("不能创建XMLHttpRequest对象实例.");
			return false;
	}
	objXmlHttp.onreadystatechange = handler;
	return objXmlHttp
}


