
$("#ageyear").focus();var countryToken="false";var dobToken="false";var monthToken="false";var dayToken="false";var yearToken="false";var ageToken="false";function fillDate()
{var month=$("#agemonth").val();var date="";var selectbox=document.getElementById('agedate');var j;for(j=selectbox.options.length-1;j>=0;j--)
{selectbox.options[j]=null;}
if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)
{date=31;}
if(month==4||month==6||month==9||month==11)
{date=30;}
if(month==2)
{date=28;}
document.getElementById('agedate').options[0]=new Option(jsTranslate['register.selectdate'],'');for(i=1;i<=date;i++){document.getElementById('agedate').options[i]=new Option(i,i);}}
function fillDefaultDate(defaultMonthId)
{var month=defaultMonthId;var date=31;var firstIndexStr=jsTranslate['register.ageCheck'];document.getElementById('agedate').options[0]=new Option(firstIndexStr,'');for(i=1;i<=date;i++){document.getElementById('agedate').options[i]=new Option(i,i);}
document.getElementById('agedate').selectedIndex='1';}
function monthCheck(){var date=$("#agedate").val();var year=$("#ageyear").val();var month=$("#agemonth").val();if(month==''){$("#dobStatus").html(jsTranslate['register.ageCheck']);$("#dobStatus").attr('style','display: block;');monthToken="false";}else{$("#dobStatus").html('&nbsp;');monthToken="true";}}
function dateCheck(){var date=$("#agedate").val();var year=$("#ageyear").val();var month=$("#agemonth").val();if(date==''){$("#dobStatus").html(jsTranslate['register.ageCheck']);$("#dobStatus").attr('style','display: block;');dayToken="false";}else{$("#dobStatus").html('&nbsp;');dayToken="true";}}
function yearCheck(){var year=$("#ageyear").val();if(year==''){$("#dobStatus").html(jsTranslate['register.ageCheck']);$("#dobStatus").attr('style','display: block;');yearToken="false";}else{$("#dobStatus").html('&nbsp;');yearToken="true";}}
function daysInMonth(iMonth,iYear){return 32-new Date(iYear,iMonth,32).getDate();}
function checkAgeValidity(){var country=$("#agecountry").val();var month=$("#agemonth").val();var date=$("#agedate").val();var year=$("#ageyear").val();var checkAge=document.getElementById('checkAge');if(checkAge.checked==false){var rememberMe='off';}else{var rememberMe='on';}
countryCheck();yearCheck();dateCheck();monthCheck();if(monthToken=="false"||dayToken=="false"||yearToken=="false"){dobToken="false";$("#dobStatus").html(jsTranslate['register.ageCheck']);$("#dobStatus").attr('style','display: block;');}else{$("#dobStatus").html('&nbsp;');dobToken="true";}
$("#ageCheckStatus").attr('style','display: none;');postObject=new Object;postObject.countryId=country;postObject.month=month;postObject.date=date;postObject.year=year;postObject.rememberMe=rememberMe;if(countryToken=="true"&&dobToken=="true"){$.post('/user/checknsetage/',postObject,function(data){if(data){$("#dobStatus").attr('style','display: none;');$("#popupContactClose").trigger('click');}else{$("#dobStatus").html(jsTranslate['age.ageInv']);$("#dobStatus").attr('style','display: block;');return false;}},"html");}}
function getFlag(){document.getElementById('checkFlag').value="1";}
function countryCheck(){var country=$("#agecountry").val();if(country==''){$("#agecountryStatus").html(jsTranslate['register.countryInv']);$("#agecountryStatus").attr('style','display: block;');countryToken="false";}else{$("#agecountryStatus").html('');$("#agecountryStatus").attr('style','display: none;');countryToken="true";}}
function trim(stringValue){return stringValue.replace(/^\s+|\s+$/g,"");}
function isUrl(s){var regexp=/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;return regexp.test(s);}
$(function(){$("#agemonth").bind('change',fillDate);$("select").keypress(function(e){if((e.which&&e.which==13)||(e.keyCode&&e.keyCode==13)){$("#allow").trigger('click');}});$("input[@id=checkAge]").keypress(function(e){if((e.which&&e.which==13)||(e.keyCode&&e.keyCode==13)){$("#allow").trigger('click');return false;}
return true;});});$("#agemonth").bind('change',fillDate);
