//these are the cities that we need in addition to our standard cities
//make sure you insert '_' in the place of spaces
searchCity = new Array();
//cities for FMN, and BTW
searchCity[0] = 'myrtle_beach';
searchCity[1] = 'lumberton';
searchCity[2] = 'florence';

//cities for WSLS, and possibly LNA (if we don't link to WSLS)
searchCity[3] = 'hot_springs';
searchCity[4] = 'danville';
searchCity[5] = 'martinsville';
searchCity[6] = 'blacksburg';
searchCity[7] = 'roanoke';
searchCity[8] = 'smith_mtn_lake';
searchCity[9] = 'lynchburg';

//cities for WNCT
searchCity[10] = 'greenville';
searchCity[11] = 'jacksonville';
searchCity[12] = 'new_bern';
searchCity[13] = 'washington';

//cities for WJWB
searchCity[14] = 'saint_augustine';
searchCity[15] = 'brunswick';

//cities for WJBF
searchCity[16] = 'augusta';
searchCity[17] = 'aiken';

//cities for SRL
searchCity[18] = 'statesville';

//cities for CIT
//Feb 16-04 Removed due to OAS error 
//searchCity[19] = 'concord';

//cities for WSPA
searchCity[20] = 'spartanburg';

//cities for WJHL
searchCity[21] = 'johnson_city';

//cities for WJHL
searchCity[22] = 'charleston';

//cities for NCN
searchCity[23] = 'raleigh';
searchCity[24] = 'durham';
searchCity[25] = 'chapel hill';


function setUser(tempUser1) {
	if (tempUser1 == 'BHC' || tempUser1 == 'DEA' || tempUser1 == 'DRB' || tempUser1 == 'JCF' || tempUser1 == 'LNA' || tempUser1 == 'RTD' || tempUser1 == 'WSJ' || tempUser1 == 'BTW' || tempUser1 == 'WCBD' || tempUser1 == 'WJBF' || tempUser1 == 'WJHL' || tempUser1 == 'WJTV' || tempUser1 == 'WKRG' || tempUser1 == 'WMBB' || tempUser1 == 'NCT' || tempUser1 == 'WSAV' || tempUser1 == 'WSLS' || tempUser1 == 'SPA' || tempUser1 == 'CIT' || tempUser1 == 'MMN' || tempUser1 == 'MNH' || tempUser1 == 'MOT' || tempUser1 == 'SRL'){
		tempProp1='2.0';
	}
	else if (tempUser1 == 'FMN' || tempUser1 == 'MJM' || tempUser1 == 'SCN' || tempUser1 == 'WPN' || tempUser1 == 'KALB' || tempUser1 == 'KBSD' || tempUser1 == 'DBSH' || tempUser1 == 'KBSL' || tempUser1 == 'IMT' || tempUser1 == 'KWCH' || tempUser1 == 'WDEF' || tempUser1 == 'TBO' || tempUser1 == 'WIAT' || tempUser1 == 'WNEG' || tempUser1 == 'WRBL' || tempUser1 == 'WTVQ'){
		tempProp1='1.5';
	}
	else
	{
		tempProp1='Non-IPS';
	}
	return tempProp1;
}

function setPageName(domainName,place) {
	var cityMatched = 0;
	var sitepage = '';

	while (place.indexOf('+') > -1) {
   	place = place.substring(0,place.indexOf('+')) +  '_' + place.substring(place.indexOf('+') + 1);
 	}

	if (place != '') {
		place = place.toLowerCase();
		for (i=0; i<searchCity.length; i++){
			if (searchCity[i] == place){
				sitepage = domainName + '/weather/' + place;
				cityMatched = 1;
				if (place == 'augusta') {
				    var alt = checkQueryString('alt');
				    if ( alt == 'MGIMD_local_doppler') {
				    	sitepage = domainName + "/weather/vipirradar";
				    }
				}
				break;
			}
		}
	}
	else if ((sitepage == '') && (domainName == 'www.wsls.com')){
		sitepage = domainName + '/weather/lynchburg';
	}
	else if ((sitepage == '') && (domainName == 'www.morningnewsonline.com')){
		sitepage = domainName + '/weather/florence';
	}
	else if ((sitepage == '') && (domainName == 'wnct.com')){
		sitepage = domainName + '/weather/greenville';
	}
	else {
		sitepage = domainName + '/weather';
	}
	if (place != '' && !cityMatched) {
		sitepage = domainName + '/weather';
	}

	if ((domainName == 'wkrg.com')){
		//alert('test');
		if (window.location.href.indexOf('MGIMD_local_doppler') > -1)
			sitepage = domainName + '/livedoppler';
	}
	
	return sitepage;
}

function checkQueryString (myKeyName) {
		var queryString = parent.location.search.substring(1);
		args = new Object();
		numKP = 1;
		var hamWxPage = '';
		while (queryString.indexOf('&') > -1) {
		  args[numKP] = queryString.substring(0,queryString.indexOf('&'));
		  queryString = queryString.substring((queryString.indexOf('&')) + 1);
		  numKP++;
	 	}
		 args[numKP] = queryString;
		for (i in args) {
			keyName = args[i].substring(0,args[i].indexOf('='));
		 	keyValue = args[i].substring((args[i].indexOf('=')) + 1);
		 	while (keyValue.indexOf('+') > -1) {
		   	keyValue = keyValue.substring(0,keyValue.indexOf('+')) +  '_' + keyValue.substring(keyValue.indexOf('+') + 1);
		 	}
		 	keyValue = unescape(keyValue);
		 	if (keyName == myKeyName && keyValue!= '' && keyName == 'place'){
		 		hamWxPage = keyValue.toLowerCase();
		 	}
		 	else if (keyName == myKeyName && keyValue!= ''){
		 		hamWxPage = keyValue;
		 	}
		}
	 	return hamWxPage;
}
