function setActiveStyleSheet(title) {    var i, a, main;  if (title == 'null') { title='Graphic' };      for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {         if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {            a.disabled = true;            if(a.getAttribute("title") == title) a.disabled = false;         }      }}//function saybubu(form){	//if (Page_IsValid!=true) {	//alert(form);	//alert(form.allsite);		//if (form.Yellow_Doted_Div!=null){		//	form.Yellow_Doted_Div.Visible=false;		//}//	}///}function getActiveStyleSheet() {  var i, a;  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");  }  return null;}function getPreferredStyleSheet() {  var i, a;  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {    if(a.getAttribute("rel").indexOf("style") != -1       && a.getAttribute("rel").indexOf("alt") == -1       && a.getAttribute("title")       ) return a.getAttribute("title");  }   return null;}function createCookie(name,value,days) {  if (days) {    var date = new Date();    date.setTime(date.getTime()+(days*24*60*60*1000));    var expires = "; expires="+date.toGMTString();  }  else expires = "";  document.cookie = name+"="+value+expires+"; path=/";}function readCookie(name) {  var nameEQ = name + "=";  var ca = document.cookie.split(';');  for(var i=0;i < ca.length;i++) {    var c = ca[i];    while (c.charAt(0)==' ') c = c.substring(1,c.length);    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);  }  return null;}window.onload = function(e) {  var cookie = readCookie("style");  var title = cookie ? cookie : getPreferredStyleSheet();  setActiveStyleSheet(title);}window.onunload = function(e) {  var title = getActiveStyleSheet();  createCookie("style", title, 365);}var cookie = readCookie("style");var title = cookie ? cookie : getPreferredStyleSheet();setActiveStyleSheet(title);function underline1(elem){      for(i=0; (a = document.getElementsByTagName("a")[i]); i++) {         a.getAttribute("class") = "";       }      elem.getAttribute("class") = "on";}function toggle( targetId ){  if (document.getElementById){  		target = document.getElementById( targetId );  			if (target.style.display == "none"){  				target.style.display = "";  			} else {  				target.style.display = "none";  			}  	}}
function checkIt(firstcb,secondcb){
	if (firstcb.checked){
		//eval(form + '.' + secondcb + '.checked=false;');
		document.getElementById(secondcb).checked=false;
	}else{firstcb.checked=true;}
}

function fillYear(){
	document.frmIndex.CYear.selectedIndex = 2005
}

function fillDay(maxval){
	while (document.frmIndex.CDay.options.length > 0){
		document.frmIndex.CDay.options[0] = null;
	}
	for(i=1;i<=maxval;i++){
		var oOption = document.createElement("OPTION");
		oOption.text=i;
		oOption.value=i;
		document.frmIndex.CDay.add(oOption);
	}
}

function changeMonths(month){
	if (month==1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12){
		var selVal = document.frmIndex.CDay.value - 1;
		fillDay(31);
		//if selected day is biger then the max in this month not select it, sel the first
		if (selVal <= 31){document.frmIndex.CDay.selectedIndex = selVal}else{document.frmIndex.CDay.selectedIndex = 0};
	}else if (month==4 || month==6 || month==9 || month==11 ){
		var selVal = document.frmIndex.CDay.value - 1;
		fillDay(30);
		//if selected day is biger then the max in this month not select it, sel the first
		if (selVal < 30){document.frmIndex.CDay.selectedIndex = selVal}else{document.frmIndex.CDay.selectedIndex = 0};				
	}else if (month==2){
		var ValDays = 28;
		if (document.frmIndex.CYear.options[document.frmIndex.CYear.selectedIndex].value % 4 == 0) ValDays = 29 ;
		var selVal = document.frmIndex.CDay.value - 1;
		fillDay(ValDays);
		//if selected day is biger then the max in this month not select it, sel the first
		if (selVal < ValDays){document.frmIndex.CDay.selectedIndex = selVal;}else{document.frmIndex.CDay.selectedIndex = 0; alert('Your birth DAY value has been reseted. \r\n No such day for selected month! \r\n Please select the correct birth DAY from list.'); document.frmIndex.CDay.focus();};				

	}
}

function initBirthDate(){
	if (document.frmIndex.BRYear.value != 1){
		if (document.frmIndex.BRDay.value >=1 && document.frmIndex.BRDay.value <=31)
			document.frmIndex.CDay.selectedIndex=document.frmIndex.BRDay.value-1;
		if (document.frmIndex.BRMonth.value >=1 && document.frmIndex.BRMonth.value <=12)
			document.frmIndex.CMonth.selectedIndex=document.frmIndex.BRMonth.value -1;
		document.frmIndex.CYear.selectedIndex = 2005 - document.frmIndex.BRYear.value;
	}else {fillYear();}
}

function changeYear(){
	changeMonths(document.frmIndex.CMonth.options[document.frmIndex.CMonth.selectedIndex].value);
}

function LoadBirthDates(){
	fillDay(31);
	initBirthDate();
}

