<!--

/* Validation to see if something is a Number Function */

function isNumber( thisNumber ) {
	var filter = /\D/;
	var isValid = ( filter.test( thisNumber ) ) ? false : true;
	return isValid;
}
/* --------------------------------------------------------- */



/* Validation to see if Postal Code is valid Function */

function isPostalCode( thisValue ) {
	var filter = /^[a-zA-Z]{1}\d{1}[a-zA-Z]{1}\d{1}[a-zA-Z]{1}\d{1}/;
	var isValid = filter.test( thisValue );
	return isValid;
}
/* --------------------------------------------------------- */



/* Build a list Function */

	function listbuild( lbound, ubound, zeroPad, zeroPadFlag, sortOrder, fieldName, dotPad )
	 {
		var selectBox = "<select name=\"" + fieldName + "\">";
		if( dotPad == 1 ) { selectBox += "<option value=\"\">...</option>"; }

		var optionList = "";
		var zeros = ""; for( var i = 0; i < zeroPad; i++ ) { zeros += "0"; }
		for( var i = lbound; i <= ubound; i++ ) 
	 {
			var strI = new String( ( sortOrder == 1 ) ? lbound + ( ubound - i ) : i );
			var strI2 = strI;
			if( strI.length < zeroPad ) { strI = zeros.substr( 0, zeroPad - strI.length ) + strI; }
			if( zeroPadFlag == 1 ) { strI2 = strI; }
			selectBox += '<option value=' + strI + '>' + strI2 + '</option>\r';
	 }
		selectBox += "</select>";
		document.write( selectBox );
	 }
/* --------------------------------------------------------- */


 /* Preload the Images Function */

	function MM_preloadImages() 
	{
  		var d=document; if(d.images)
	{ if(!d.MM_p) d.MM_p=new Array();
    		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}
	}
	}
/* --------------------------------------------------------- */


 /* Load the Image restore Function */

	function MM_swapImgRestore() 
	{
 	 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
/* --------------------------------------------------------- */


 /* Find a certain Object Function */

	function MM_findObj(n, d) 
	{
  		var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) 
	{
   		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}
  		if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  		for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  		if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
/* --------------------------------------------------------- */


 /* Change the Image on Mouseover Function */

	function MM_swapImage() 
	{
  	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
/* --------------------------------------------------------- */


 /* Change the input type Function */

	function MM_changeProp(objName,x,theProp,theValue) 
	{
  	var obj = MM_findObj(objName);
  	if (obj && (theProp.indexOf("style.")==-1 || obj.style)) eval("obj."+theProp+"='"+theValue+"'");
	}
/* --------------------------------------------------------- */



 /* Goto a Webpage Function */

	function MM_goToURL() 
	{
  	var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  	for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	}
/* --------------------------------------------------------- */


 /* Open a New Window Function */

	function MM_openBrWindow(theURL,winName,features) 
	{
  	window.open(theURL,winName,features);
	}


/* COOKIE STUFF */
function SetCookie( name, value ) {
	var argv = SetCookie.arguments;  
	var argc = SetCookie.arguments.length;  
	var expires = (argc > 2) ? argv[2] : null;  
	var path = (argc > 3) ? argv[3] : null;  
	var domain = (argc > 4) ? argv[4] : null;  
	var secure = (argc > 5) ? argv[5] : false;  
	document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) +  ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : "");
}



function createCookiesfromURL()
{
	
	//set expiration cookie
	var expiryDate1 = new Date(); 
	expiryDate1.setTime(expiryDate1.getTime() + (30*60*1000));	

	var args = new Object();
	var vStart =location.search.indexOf('?');
	var query = location.search.substring(vStart+1);
	var pairs = query.split("&");
				
	for(var i = 0; i < pairs.length; i++) {

		var pos = pairs[i].indexOf('=');
		if (pos == -1) continue;
		var argname = pairs[i].substring(0,pos);
		var value = pairs[i].substring(pos+1);
		SetCookie( argname, value, expiryDate1, "/" );
	}
	
}

// -->
