/*******************************************************************************
** default.js                                                                 **
**                                                                            **
** Default javascript for site.                                               **
**                                                                            **
** CHANGE LOG                                                                 **
** ----------                                                                 **
** 04/05/2004 | scott | Initial Revision                                      **
**                                                                            **
** Copyright (c) Junk Mail Publishing 2004                                    **
*******************************************************************************/
function compareDates(date1, date2) {

    y1 = parseInt(date1.substring(0,4),10);
    m1 = parseInt(date1.substring(5,7),10);
    d1 = parseInt(date1.substring(8,10),10);
    var dt9 = new Date();
    dt9.setFullYear(y1,m1,d1);

	y2 = parseInt(date2.substring(0,4),10); 
	m2 = parseInt(date2.substring(4,6),10);
	d2 = parseInt(date2.substring(8,10),10);
	var dt2 = new Date();
	dt2.setFullYear(y2,m2,d2);


	if(y1<y2 || d1<d2) {
		return true;
	} else {
		return false;
	}

}

function setDat ( iArray, oForm )
{
	var iCount;

	oForm._DURATIONSTART.length = 0;
	oForm._DURATIONEND.length = 0;

	for ( iCount = 0; iCount < arrayDat[iArray].length; iCount++ )
	{
		oOptionStart = new Option( arrayDat[iArray][iCount], arrayDat[iArray][iCount] );
		oOptionEnd = new Option( arrayDat[iArray][iCount], arrayDat[iArray][iCount] );		
		oForm._DURATIONSTART.options[iCount] = oOptionStart;
		oForm._DURATIONEND.options[iCount] = oOptionEnd;
	}

//	if(compareDates(oForm._DURATIONEND.options[oForm._DURATIONEND.length -1 ].value,"2009-01-15")) {
//		oForm._DURATIONEND.options[oForm._DURATIONEND.length - 1 ].value = "2009-01-15"
//		oForm._DURATIONEND.options[oForm._DURATIONEND.length - 1 ].text = "2009-01-15"
//	}

	oForm._DURATIONSTART.options[0].selected = true;
	oForm._DURATIONEND.options[oForm._DURATIONEND.length - 1 ].selected = true;
}
//
function checkDates ( )
{
	//alert( document.EmployerAdvertiseForm._LIVEPRODUCT.name );
	// if ( document.EmployerAdvertiseForm._LIVEPRODUCT )
	if ( this._LIVEPRODUCT )
	{
		if ( document.EmployerAdvertiseForm._LIVEPRODUCT.value == 0 )
		{
			setDat( 0, document.EmployerAdvertiseForm );
		}
		if ( document.EmployerAdvertiseForm._LIVEPRODUCT.value == 1 )
		{
			setDat( 1, document.EmployerAdvertiseForm );
		}
	}
}
