//** http://www.shineage.com
//** Last updated: 2008年10月1日22:24:31

function bOnClick(conPath)
{
 mp_o =document.getElementById('mp_s');
 mpConfirm_o =document.getElementById('mpConfirm_s');
 amount_o =document.getElementById('amount_s');
 topupDelay_o =document.getElementById('tpNeedHrs');
if(checkInput(mp_o,mpConfirm_o,amount_o,'_s'))
{
 var reqAmount_o =amount_o;
 var tpNeedHrs_o =topupDelay_o;
 var strPara = 'mp='+mp_o.value+'&reqAmount='+reqAmount_o.value+'&hours='+tpNeedHrs_o.value
Requ.send(conPath+'booking.php?'+strPara, 'POST', callback)
}
}
function callback(msg)
{
var str=msg.responseText;
var strll=str.split(",");
var r_i=strll[0].indexOf("=");
var result =strll[0].substring(r_i+1)
if(result!='00'){
window.location.reload();
}
var ii=strll[1].indexOf("=");
var amount_obj =document.getElementById('s_amount');
amount_obj.childNodes[0].replaceNode(document.createTextNode('￥'+strll[1].substring(ii+1)));
}

/*
function tipInfo(inputId,tipInfo){
 	cardNo =document.getElementById(inputId);
  objParent=cardNo.parentNode;
  fontO=document.createElement("<font class='cue red'>");
  textObj=document.createTextNode(" "+tipInfo);
  fontO.appendChild(textObj);
  objParent.lastChild.replaceNode(fontO);
}
*/
function focus_input(inputId){
 	in_obj =document.getElementById(inputId);;
  objParent=in_obj.parentNode;
  textObj=document.createTextNode(" ");
//  objParent.lastChild.replaceNode(textObj);
  document.getElementById("infor4u").innerHTML = "";
}

function checkForm()
{
	mp = document.topupRequestCheckinForm.mp;
	if(!isMobil(mp.value)){
	  	//alert('对不起，充值手机号码输入错误，请确认输入！')
	  	document.getElementById("infor4u").innerHTML = "充值手机号码输入错误，请确认输入！4";
	  	return false;
	}
	document.topupRequestCheckinForm.action=''+"booking.php";
    document.topupRequestCheckinForm.submit.disabled=true;
	//document.topupRequestCheckinForm.submit();
	return true;
}


function isMobil(js_value)
{
//var patrn=/^(((13[0-9]{1})|159)+\d{8})$/;
var patrn = /^(((13[0-9]{1})|159|(15[0-9]{1}))+\d{8})$/;
		if (js_value.match (patrn))
			return	true;
		return	false;
}


function checkInput(v_mp_o,v_mpConfirm_o,v_amount_o,input_sk){

	  if(!isMobil(v_mp_o.value)){
	  	//tipInfo('mp'+input_sk,'充值手机号码输入错误，请确认输入！')
	  	document.getElementById("infor4u").innerHTML = "充值手机号码输入错误，请确认输入！3";
	  	return false;
	  }

/*	  if(!isMobil(v_mpConfirm_o.value)){
	  	tipInfo('mpConfirm'+input_sk,'充值确认手机号码输入错误，请确认输入！')
	  	return false;
	  }
	  if(v_mpConfirm_o.value!=v_mp_o.value){
	  		tipInfo('mpConfirm'+input_sk,'充值号码两次输入不一致，请确认输入！')
	  	  return false;
	  }
*/	  
	  if(input_sk=='_s'){
	    mp_i=v_mp_o.value.substring(1,2);
		mp_ii=v_mp_o.value.substring(2,3);
		if(mp_i==3){
				if(0<mp_ii&&mp_ii<=9)
				  {}
			  else
				 {document.getElementById("infor4u").innerHTML = "暂不支持对该号码进行充值，请确认输入！1";
	        return false;
				 }
		}else if(mp_i==5){
				if((8<=mp_ii&&mp_ii<=9)||mp_ii==2||mp_ii==4||mp_ii==3||mp_ii==5||mp_ii==6||mp_ii==0){}
			 else
				{document.getElementById("infor4u").innerHTML = "暂不支持对该号码进行充值，请确认输入！2";
	  	   return false;
				}
		}
	}
/*	  if(v_amount_o.value==null||v_amount_o.value==0){
	  	tipInfo('amount'+input_sk,'对不起，请选择充值金额！')
	  	return false;
	  }	
	  return true;
*/
}

/*
function checkForm(input_sk){
 		 mp_o =document.getElementById('mp'+input_sk);
	 	 mpConfirm_o =document.getElementById('mpConfirm'+input_sk);
	 	 amount_o =document.getElementById('amount'+input_sk);
	 	 topupDelay_o =document.getElementById('tpNeedHrs');
	 	 sendSms_o=document.getElementById("sendSms"+input_sk);
		 sendSmsVal="0"
	    if(sendSms_o.checked)
		 	sendSmsVal=sendSms_o.value;
	 	
	 	if(!checkInput(mp_o,input_sk)){
	 		return false;
	 	}
		 	
	 	if(input_sk=='_s')
		{  var sumbitPara='&mp='+mp_o.value+'&mpConfirm='+mpConfirm_o.value+'&amount='+amount_o.value+'&topupDelay='+topupDelay_o.value+'&sendSMS='+sendSmsVal;
			document.location=''+'/slowtopup/tReqCheckin.do?action=confirm'+sumbitPara,'DisplayWindow';
		}else{
			if(document.getElementById('sendSms_k').checked){
				document.location=''+'/topupRequest.htm?mp='+mp_o.value+'&mpConfirm='+mpConfirm_o.value+'&amount='+amount_o.value+'&delayHour=0&isNeedSMS=1','DisplayWindow';
			}else{
				document.location=''+'/topupRequest.htm?mp='+mp_o.value+'&mpConfirm='+mpConfirm_o.value+'&amount='+amount_o.value+'&delayHour=0&isNeedSMS=0','DisplayWindow';
			}
		}
	  return true;
}


function checkValue(){ 
	//判断是否为ture true为选中,false为未选中 
	if(document.topupRequestCheckinForm.sendSMS.checked == true){ 
		document.topupRequestCheckinForm.sendSMS.value="1";
		alert(document.topupRequestCheckinForm.sendSMS.value+"被选中"); 
	} 
	else
	{
		document.topupRequestCheckinForm.sendSMS.value="0";
		alert(document.topupRequestCheckinForm.sendSMS.value+"未选中"); 
	}
} 

*/



/*
function changeSltValue(obj_id,sltValue,mpSk){
 e_obj =document.getElementById(obj_id);
 if(mpSk=='_s'){
e_obj.childNodes[0].replaceNode(document.createTextNode('￥'+sltValue*document.getElementById('discount').value));
 }else{
    mpVal= document.getElementById('mp_k').value;
    mpCkVal=checkMpCmcc(mpVal);
    if(mpCkVal=='1'){
	    cmcc50disVal=document.getElementById('cmcc50dis').value;
	    cmcc100disVal=document.getElementById('cmcc100dis').value;
	    n100=(sltValue/100).toString().substring(0,1);
	    amount100=n100*100*cmcc100disVal;
	    amount50=sltValue%100==0?0:50*cmcc50disVal;
	    e_obj.childNodes[0].replaceNode(document.createTextNode('￥'+(amount100+amount50)));     
    }else if(mpCkVal=='2'){
     unicom50disVal= document.getElementById('unicom50dis').value;
     unicom100disVal= document.getElementById('unicom100dis').value;
     amount100=(sltValue/100).toString().substring(0,1)*100*unicom100disVal;
     amount50=sltValue%100==0?0:50*unicom50disVal;
     e_obj.childNodes[0].replaceNode(document.createTextNode('￥'+(amount100+amount50)));
    }else{
     alert('请输入正确的手机号码!');
     return false;
    }
  }
} 

function checkMpCmcc(cmccMp){
  var patrn=/^[1]{1}[3,5]\d{9}$/;
  if (!cmccMp.match (patrn))
    return 0;
  mp_i=cmccMp.substring(1,2);
  mp_ii=cmccMp.substring(2,3);
  if(mp_i==3){
    if(3<mp_ii&&mp_ii<=9)
      {return 1;}
     else
     {return 2;}
  }else if(mp_i==5){
    if((8<=mp_ii&&mp_ii<=9)||mp_ii==0){return 1;}
     else
    {return 2;}
  }
  return 0;
}

function checkChangeValue(inputId){
 	in_obj =document.getElementById(inputId);;
  objParent=in_obj.parentNode;
  textObj=document.createTextNode(" ");
  objParent.lastChild.replaceNode(textObj);
  
    e_obj =document.getElementById('k_amount');  
    mpVal= document.getElementById('mp_k').value;
    if(mpVal==''){
    	e_obj.childNodes[0].replaceNode(document.createTextNode(''));
    }
    sltValue = document.getElementById('amount_k').value;
    mpCkVal=checkMpCmcc(mpVal);
    if(mpCkVal=='1'){
	    cmcc50disVal=document.getElementById('cmcc50dis').value;
	    cmcc100disVal=document.getElementById('cmcc100dis').value;
	    n100=(sltValue/100).toString().substring(0,1);
	    amount100=n100*100*cmcc100disVal;
	    amount50=sltValue%100==0?0:50*cmcc50disVal;
	    e_obj.childNodes[0].replaceNode(document.createTextNode('￥'+(amount100+amount50)));     
    }else if(mpCkVal=='2'){
     unicom50disVal= document.getElementById('unicom50dis').value;
     unicom100disVal= document.getElementById('unicom100dis').value;
     amount100=(sltValue/100).toString().substring(0,1)*100*unicom100disVal;
     amount50=sltValue%100==0?0:50*unicom50disVal;
     e_obj.childNodes[0].replaceNode(document.createTextNode('￥'+(amount100+amount50)));
    }else{
     return false;
    }
  
}

*/


window.onload=function()
    {
         var o=document.getElementById('infozone');
         window.setInterval(function(){scrollup(o,15,0);},3000);
    }
   function scrollup(o,d,c)
    {
        try
        {
             if(d==c)
             {
                  var t=o.firstChild.cloneNode(true);
                  o.removeChild(o.firstChild);
                  o.appendChild(t);
                  t.style.marginTop=o.firstChild.style.marginTop='0px';
             }
             else
             {
                  var s=3,c=c+s,l=(c>=d?c-d:0);
                  o.firstChild.style.marginTop=-c+l+'px';
                  window.setTimeout(function(){scrollup(o,d,c-l)},100);
             }
         }catch(e){}
    } 