function sendmobilenumber(){if(Boolean(!$('mobile').value)||isNaN($('mobile').value)||$('mobile').value.length<10){alert('not a valid mobile number');}
else{$('mobileLoader').style.display='block';if($('mobilefail'))$('mobilefail').style.display='none';$('mobile').disabled=true;$('mobnumSubmit').disabled=true;$('mobnumSubmit').style.color='#ccc';$('spmsg').style.display='none';$('spmsg2').style.display='none';smscallUrl('mobile');}
return false;}
function smsalterview(view){$('mobilesuccess').style.display='none';$('mobileinput').style.display='none';$('mobileverify').style.display='none';if($('mobilefail'))$('mobilefail').style.display='none';$(view).style.display='block';}
function smscallUrl(varname,mobile,smsall){if(Boolean(!$(varname).value)){alert('Please enter the verification code');}
else{var url=siteUrl+'service/sms/register?cih&ajx=1&jsout=text';val=$(varname).value;data=varname+"="+val;if(mobile){val=$(mobile).value;data+='&'+mobile+'='+val;val=$(smsall).checked==true?'2':'1';data+='&'+smsall+'='+val;}
ajax(url,data,'post',{isSuccess:function(){smsresponse(this.xhr.responseText,varname);return true;}});}}
function smsresponse(resp,varname){if(varname=='code'){if(resp==1){smsalterview('mobilesuccess');$('mobileinput').style.display='none';$('subscribeOption').style.display='none';}
else $('wrong_code').style.display='block';}
if(varname=='mobile'){if(resp=='0'){if($('mobilefail'))$('mobilefail').style.display='block';$('mobileLoader').style.display='none';}
else{$('mobileLoader').style.display='none';$('mobileverify').style.display='block';}}}
function smsresubmit(){$('wrong_code').style.display='none';$('spmsg2').style.display='block';smsalterview('mobileinput');$('mobile').disabled=false;$('mobnumSubmit').disabled=false;$('mobnumSubmit').style.color='';}