function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function wy_swapSrc(id,url){
	if(typeof(document.getElementById(id)) == undefined) return null;
	document.getElementById(id).src = url;
}

function createXMLHttpRequest()
{
      if(window.XMLHttpRequest)
        {
              xmlHttp = new XMLHttpRequest();//mozilla浏览器
        }
        else if(window.ActiveXObject)
        {
            try
            {
             xmlHttp = new ActiveX0bject("Msxml2.XMLHTTP");//IE老版本
            }
            catch(e)
            {}
            try
            {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");//IE新版本
            }
            catch(e)
            {}
            if(!xmlHttp)
            {
                window.alert("不能创建XMLHttpRequest对象实例");
                return false;
            }
        }
}

function $ID(id){
      return document.getElementById(id);
}

function $FID(id){
	  return document.getElementById(id).value;
}
      
function chkmobile()
{
           var mobile = $FID('mobile');
		   var regNum = /1[358]\d{9}$/;
		   if(regNum.test(mobile))
		   {
		        $ID('cmobile').innerHTML="";
		   }
		   else
		   {
				$ID('cmobile').innerHTML="<font class=font3>输入正确的电话号（如：13913339685）</font>";
		   }
}

function chkemail()
{
      var email = $FID('email');
	  var regEmail = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
	  if(regEmail.test(email))
	  {
	       $ID('cemail').innerHTML="";
	  }
	  else
	  {
	       $ID('cemail').innerHTML="<font class=font3>输入正确的电子邮件地址（如:michael@hotmail.com）</font>";
	  }
}

 function Checkuser(username)
{
      createXMLHttpRequest();//特编
      xmlHttp.open("GET","check.php?action=chkuser&username="+username+"&ran="+Math.random()*1000,true);
      xmlHttp.onreadystatechange = handleStateChange;
      xmlHttp.send(null);
}
        
function handleStateChange(object)
{
    if(xmlHttp.readyState==4)
    {
        if(xmlHttp.status==200)
        {
            document.getElementById("cusername").innerHTML = xmlHttp.responseText;
        }
    }
}

 function page(userid,logtype,pageno)
{
	  createXMLHttpRequest();//特编
      xmlHttp.open("GET","http://www.roewe.com.cn/550concert/app/loadinfo.php?action=loadlog&id="+userid+"&logtype="+logtype+"&pageno="+pageno+"&ran="+Math.random()*1000,true);
      if(logtype=='mylog'){
      	xmlHttp.onreadystatechange = output1;
      }
      if(logtype=='myvote'){
      	xmlHttp.onreadystatechange = output2;
      }
      xmlHttp.send(null);
}
        
function output1()
{
    if(xmlHttp.readyState==4)
    {
        if(xmlHttp.status==200)
        {
            document.getElementById("jsweb8_two_1").innerHTML = xmlHttp.responseText;
        }
    }
}

function output2()
{
    if(xmlHttp.readyState==4)
    {
        if(xmlHttp.status==200)
        {
            document.getElementById("jsweb8_two_2").innerHTML = xmlHttp.responseText;
        }
    }
}

function setCookie ( name, value ) 
{ 
var Days = 30;
expires = new Date(); 
expires.setTime(expires.getTime() + (Days*24*60*60*1000)); 
document.cookie = name + "=" + escape(value) + "; expires=" + expires.toGMTString() + "; path=/" + ";domain=.roewe.com.cn"; 
} 

function getCookie ( name ) 
{ 
cookie_name = name + "="; 
cookie_length = document.cookie.length; 
cookie_begin = 0; 
while (cookie_begin < cookie_length) 
{ 
value_begin = cookie_begin + cookie_name.length; 
if (document.cookie.substring(cookie_begin, value_begin) == cookie_name) 
{ 
var value_end = document.cookie.indexOf ( ";", value_begin); 
if (value_end == -1) 
{ 
value_end = cookie_length; 
} 
return unescape(document.cookie.substring(value_begin, value_end)); 
} 
cookie_begin = document.cookie.indexOf ( " ", cookie_begin) + 1; 
if (cookie_begin == 0) 
{ 
break; 
} 
} 
return null; 
} 

// 清除 Cookie 
function delCookie ( name ) 
{ 
var expireNow = new Date(); 
document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT" + "; path=/" + ";domain=.roewe.com.cn"; 
} 


function valiRef(){
	$ID('yzm').src="include/validation/validation.php?ran="+Math.random()*1000;
}

function MM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}
function openWin(n,u,w,h)
{
	var windowLeft = (window.screen.availWidth - w)/2;
	var windowTop = (window.screen.availHeight - h)/2;
	args = "left="+windowLeft+",top="+windowTop+",width="+w+",height="+h+",status=yes,toolbar=no,menubar=no,location=no";
	window.open(u,n,args);
}