function BagParam (param)
{
	var paramArray = param.split(' ');
	var newParam = '';
	for (i=0; i< paramArray.length; i++) {
		newParam += paramArray[i];
		if (i+1 != paramArray.length) {
			newParam += "~"
		}
	}

	return newParam;
}
				
function CallWeatherUrl(formElementValue, theForm)
{
	if (formElementValue == "") {
		alert("Please enter a city.");
		return false;
	}

	dataParam 		= BagParam(formElementValue);
	var myForm 		= eval(theForm);
	url 			= myForm.action;
	arrayOfStrings 	= url.split("^");
	myForm.action 	= arrayOfStrings[0];
	myForm.action 	+= dataParam;
	myForm.action 	+= arrayOfStrings[1];
	myForm.submit();
}

// popup window 
function popupStaticWindow(pageSource, title, windowWidth, windowHeight) 
{ 
	var openString = "width=" + windowWidth + ",height=" + windowHeight + ",scrollbars=0,resizeable=0";
	window.open(pageSource, title, openString );
}

// popup window allowing scrollbars
function popupScrollableWindow(pageSource, title, windowWidth, windowHeight) 
{ 
	var openString = "width=" + windowWidth + ",height=" + windowHeight + ",scrollbars=1,resizeable=1";
	window.open(pageSource, title, openString );
}

function jumpMenu(formname,elementname,hiddenVariableName){ 

	/* This function sets the listbox to its selected value and
	the form is submitted to the target page.*/
	
	//formname - The name of the form that is using this function.
	//elementname - The name of the listbox.
	//hiddenVariableName - The name of the hidden variable into which the 
	//						index text is set
	
	// Construct the objects that you require to perform an operation on.
	
	var sObject;
	var sForm;
	var sObjectHidden;
	
	sFormName = 'document.' + formname;
	sForm = eval(sFormName);

	sObjectName = 'document.' + formname + '.' + elementname;
	sObject = eval(sObjectName);

	if (hiddenVariableName != "") {
		sObjectHiddenName = 'document.' + formname + '.' + hiddenVariableName;
		sObjectHidden = eval(sObjectHiddenName);
	
		// set the hidden variable to the current selected item
		sObjectHidden.value = sObject.options[sObject.selectedIndex].text;	
	}
		
	// based on the value of the option box send it to the appropriate location.
	
	sForm.action = sObject.options[sObject.selectedIndex].value;	
	sForm.submit();	
	
}

function BackToPrevious(){
	if (navigator.appName.indexOf("Netscape") != -1){
		window.history.back();
	}
	if (navigator.appName.indexOf("Microsoft") != -1){
		window.history.go(-1);
	}
}

// close active window 
function CloseWindow() 
{ 
	window.close();
}


function args(keyName) {
	
	var queryString = window.location.search;
	if (!queryString.length) return "";
	
	queryString 	= queryString.substring(1);
	var keyValues	= queryString.split("&");
	
	// We may have nothing;
	if (!keyValues.length) return '';
	
	for (var i = 0; i < keyValues.length; i++) {
		var thisPair	= keyValues[i].split("=");
		if (!thisPair.length) continue;
		
		var thisKey 	= thisPair[0];
		var thisValue	= thisPair[1];
		
		if (thisKey == keyName) return unescape(thisValue);
	}
	
	return "";
}

// Javascript for browser cache defeating
	var begin = new Date();
	var startYear = new Date("January 1, 1970");
	startYear.setYear(begin.getYear());
	var ord = (begin.getTime() - startYear.getTime()) + "?";