// JavaScript Document

function pickIssue (iObj,hObj) {
	hObj.value = iObj.options[iObj.selectedIndex].value;
}

function convertissues () {

//Establish variables, get issue on search results page and convert to lowercase

var displayissue="";
//var resultissue=$&(meta.issue).toLowerCase;
//moved to html page so variable will work


if (resultissue!="") {

//If issue doesn't need special conversion, just give it initial caps. This should work for issues that are one word.
var index;
var tmpStr;
var tmpChar;
var preString;
var postString;
var strLen;
var r="";

tmpStr = resultissue;
strLen = tmpStr.length;

//Remove plus signs and quotes from some issue names. Not necessary with with a cms that was created in this century.

for (inl=0; inl < strLen; inl++) {
    if (tmpStr.charAt(inl) != '+' && tmpStr.charAt(inl) != '\"' && tmpStr.charAt(inl) != '\'')
      {
      r += tmpStr.charAt(inl);
      }
    }
	
	resultissue=r;
	tmpStr=resultissue;
	strLen = tmpStr.length;

if (strLen > 0)  {
for (index = 0; index < strLen; index++)  {
if (index == 0)  {
tmpChar = tmpStr.substring(0,1).toUpperCase();
postString = tmpStr.substring(1,strLen);
tmpStr = tmpChar + postString;
}
else {
tmpChar = tmpStr.substring(index, index+1);
if (tmpChar == " " && index < (strLen-1))  {
tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
preString = tmpStr.substring(0, index+1);
postString = tmpStr.substring(index+2,strLen);
tmpStr = preString + tmpChar + postString;
         }
      }
   }
}
	
	displayissue=tmpStr;

if (resultissue.indexOf("auto")!=-1) {displayissue="Autos";}

if (resultissue.indexOf("frederick")!=-1) {if (resultissue.indexOf("cty")!=-1 || resultissue.indexOf("county")!=-1) {displayissue="Frederick County";} else {displayissue="Frederick";}}
																																		
if (resultissue.indexOf("montgomery")!=-1) {if (resultissue.indexOf("village")!=-1) {displayissue="Montgomery Village";} else {displayissue="Montgomery County";}}

if (resultissue.indexOf("prince")!=-1) {displayissue="Prince George's County";}

if (resultissue.indexOf("carroll")!=-1) {displayissue="Carroll County";}
						
if (resultissue.indexOf("break")!=-1) {displayissue="Breaking News";}						

if (resultissue.indexOf("chevy")!=-1) {displayissue="Chevy Chase";}
						
if (resultissue.indexOf("college")!=-1) {displayissue="College Park";}

if (resultissue.indexOf("mount")!=-1) {displayissue="Mount Airy";}

if (resultissue.indexOf("washington")!=-1) {displayissue="Fort Washington";}

if (resultissue.indexOf("new")!=-1 && resultissue.indexOf("carr")!=-1) {displayissue="New Carrollton";}

if (resultissue.indexOf("new")!=-1 && resultissue.indexOf("mark")!=-1) {displayissue="New Market";}

if (resultissue.indexOf("north")!=-1 && resultissue.indexOf("pot")!=-1) {displayissue="North Potomac";}

if (resultissue.indexOf("portt")!=-1) {displayissue="Port Towns";}

if (resultissue.indexOf("silver")!=-1) {displayissue="Silver Spring";}

if (resultissue.indexOf("upper")!=-1) {displayissue="Upper Marlboro";}

if (resultissue.indexOf("aspen")!=-1) {displayissue="Aspen Hill";}

}

document.write(displayissue);
}
