	
function fillTime()
{
	var dat = new Date();
	/* The getTime method is going to return the number of milliseconds since 
		Jan 1, 1970 at midnight UTC time. We need the number of milliseconds 
		local time. offSet is set to the number of milliseconds between UTC time
		and the users local time.											*/
	var offSet = ( dat.getTimezoneOffset() * 60000 );
	var millis = (dat.getTime() - offSet).toString();
	document.cookie = 'ms=' + millis + ';path=/';
}

	
function clearFields()
{
	document.Form1.reset();
	fillTime();
	document.Form1.action = "searchresults.aspx";
}

function getCookie(NameOfCookie)
{
	if (document.cookie.length > 0) 
	{ 
		begin = document.cookie.indexOf(NameOfCookie+"="); 
		if (begin != -1)
		{ 
			begin += NameOfCookie.length+1; 
			end = document.cookie.indexOf(";", begin);
			if (end == -1) end = document.cookie.length;
			return unescape(document.cookie.substring(begin, end)); 
		} 
	}
	
	return null; 
}	

function changeRPP(url)
{
	// The cookie being used by the previous version of searchresults.aspx.cs used InitCaps in
	// the name - we don't want this cookie any longer.
	if (getCookie('PageSize')) 
	{
		document.cookie = 'PageSize' + '=' + '; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/';
	}
	// The cookie being used by the current version of searchresults.aspx.cs is all lowercase.
	document.cookie = 'pagesize=' + document.Form1.ddlPPP[document.Form1.ddlPPP.selectedIndex].value + ';path=/';
	location.href = url;
}


function viewAll(url)
{
	document.cookie = 'pagesize=all' + ';path=/';
	location.href = url;
}