


var da=document.all

function emptyCombo (cbo) {
	for (i=0; i<cbo.length; i++) {
		cbo.removeChild (cbo.options[i])
	}
	cbo.innerHTML = ""
}


function FillDays(cbDay, cbMonth, cbYear) {
	m = parseInt(cbMonth.value)
	switch (m) {
		case 1 :
		case 3 :
		case 5 :
		case 7 :
		case 8 :
		case 10 :
		case 12 :
			Fill (cbDay, 31)
			break;
			
		case 4 :
		case 6 :
		case 9 :
		case 11 :
			Fill (cbDay, 30)
			break;
			
		case 2 :
			if (((cbYear.value % 4 == 0) && (cbYear.value % 100 != 0)) || (cbYear.value % 400 == 0)) {
				Fill (cbDay, 29)
			} else {
				Fill (cbDay, 28)
			}
			break;
	}
}

function Fill (cbo, cnt) {
	sel = cbo.value
    emptyCombo (cbo)
	for (i=1; i<=cnt; i++) {
		var opt = document.createElement("OPTION")
		opt.text  = i
		opt.value = i
		cbo.add (opt)
	}
	if (parseInt(sel) <= cbo.options.length) {
		cbo.value = sel
	} else {
		cbo.value = cbo.options.length
	}
}



function floatvalidation (e,min, max, alertbox)
{
	// FLOAT
	// Assign default value to delimiter
	sFloatDelimiter=",";
	var re=new RegExp("^("+((true)?"[\\-\\+]?":"")+"(\\d*"+sFloatDelimiter+"?\\d+)|(\\d+"+sFloatDelimiter+"?\\d*))$");
		if (!re.test(e.value)){
			if (alertbox!="") {
				alert(alertbox);
				return false;
				}
			}
			else{
				return true;
			}
}

function valuevalidation(e, min, max, alertbox, datatype)
{	
	checkvalue=parseFloat(e.value);
	
	if (datatype) {
		smalldatatype=datatype.toLowerCase();
		if (smalldatatype.charAt(0)=="i") {
			checkvalue=parseInt(e.value)
		};
	}
	if ( (parseFloat(min) == min && checkvalue<min) || (parseFloat(max)==max && checkvalue>max) || e.value!=checkvalue) {
		if (alertbox!="") {
			alert(alertbox);
		} 
		return false;
	} else {
		return true;
	}
} 

function emptyvalidation(entered, alertbox)
{
// Emptyfield Validation by Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove this line and the two lines above.
with (entered)
{
if (value==null || value=="")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}

function emptycbvalidation(entered, alertbox)
{
with (entered)
{
if (value==null || value=="")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}


function emailvalidation(entered, alertbox)
{
// E-mail Validation by Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove this line and the two lines above.
with (entered)
{
apos=value.indexOf("@"); 
dotpos=value.lastIndexOf(".");
lastpos=value.length-1;
if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
{if (alertbox) {alert(alertbox);} return false;}
else {return true;}
}
}







function passwordvalidation(pass,conf,alertbox)
{
//alert(pass.value);
//alert(conf.value);
if (pass.value.toString()!=conf.value.toString())
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
function onClear() {
	frm.reset();
}



