<!--
/**
 * DHTML date validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */
// Declaring valid date character, minimum year and maximum year
var minYear=1900;
var maxYear=2000;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(strYear, strMonth, strDay){
	if (isInteger(strYear)==false){
		return false
	}
	var daysInMonth = DaysArray(12)
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYear)

	if ((month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		return false
	}
	if (year<minYear || year>maxYear){
		return false
	}
return true
}


function handleProdCompare()
{
	var frm = document.forms['compare'];
	var aParams = frm.action.split('&');
	var aProducts;
	for (var i = 0; i < aParams.length; i++)
	{
		var aParam = aParams[i].split('=');
		var sParamName = aParam[0];
		var sParamValue = aParam[1];
		if(sParamName == 'comp')
		{
			aProducts = sParamValue.split('-');
			break;
		}
	}
	for(var j = 0; j < frm.elements.length; j++)
    {
		var newValue = frm.elements[j].value;
		if(frm.elements[j].name.substring(0,7) == "compare" && frm.elements[j].checked)
		{
			var bExists = false;
			for(var k = 0; k < aProducts.length && !bExists; k++)
			{
				if(newValue == aProducts[k]) bExists = true;
			}
			if(!bExists) aProducts[aProducts.length] = newValue;
		}
    }
	var sProducts = aProducts.join('-');
	if(sProducts.charAt(0) == '-') sProducts = sProducts.substr(1);
	aParams[i] = 'comp=' + sProducts;
	frm.action = aParams.join('&');
	//alert(frm.action);
}

function clickPaging(sFormAction)
{
	document.forms['compare'].action = sFormAction;
	handleProdCompare();
	document.forms['compare'].elements['submit'].click();
}
//-->
