
function isValidEgn(egn){var year,mon,day;if(egn.length!=10)
return 0;for(i=0;i<egn.length;i++){if(isNaN(egn.charAt(i)))
return 0;}
year=egn.substr(0,2);mon=egn.substr(2,2);day=egn.substr(4,2);if(!checkDate(mon,day,year))
return 0;checksum=egn.charAt(9);res=(2*(parseInt(egn.charAt(0)))+4*(parseInt(egn.charAt(1)))+8*(parseInt(egn.charAt(2)))+5*(parseInt(egn.charAt(3)))+10*(parseInt(egn.charAt(4)))+9*(parseInt(egn.charAt(5)))+7*(parseInt(egn.charAt(6)))+3*(parseInt(egn.charAt(7)))+6*(parseInt(egn.charAt(8))))%11%10;if(res==(parseInt(checksum)))
return 1;else
return 0;}
function checkDate(month,day,year){var errorCode=0;if(isNaN(day))errorCode=1;if(isNaN(month))errorCode=1;if(isNaN(year))errorCode=1;if((day<1)||(day>31))errorCode=2;if((month<1)||(month>12))errorCode=4;if((month==4)||(month==6)||(month==9)||(month==11)){if(day==31)errorCode=7}
if(month==2){var g=parseInt(year/4);if(isNaN(g))errorCode=8;if(day>29)errorCode=9;if((day==29)&&((year/4)!=parseInt(year/4)))errorCode=10;}
if(errorCode>0){return false;}else{return true;}}
function openPopup(html,name,width,height){left_param=(screen.width)?(screen.width-width)/2:0;top_param=(screen.height)?(screen.height-height)/2:0;params='top='+top_param+', left='+left_param+',width='+width+',height='+height
+'resizable=yes,scrollbars=yes,toolbar=no,titlebar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no';popup=window.open('',name,params);popup.focus();popup.document.write(html);popup.document.close();return false;}
function openPopupPage(url,name,width,height){left_param=(screen.width)?(screen.width-width)/2:0;top_param=(screen.height)?(screen.height-height)/2:0;params='top='+top_param+', left='+left_param+',width='+width+',height='+height
+'resizable=yes,scrollbars=yes,toolbar=no,titlebar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no';popup=window.open(url,name,params);popup.focus();return false;}
