function ts(size) {
	var el = document.getElementById('storyBody');
    el.style.fontSize =size;
}


var tabID = 0;
function cycleTabs()
{
	if(currentObj[1] == 5)
		switchBoxDisplay(1, 1)
	else
		switchBoxDisplay(currentObj[1] + 1, 1)
		
   tabID = setTimeout(cycleTabs,8000);
}
function stopCyclingTabs() {
   if(tabID) {
      clearTimeout(tabID);
      tabID  = 0;
   }
}

function toggleEtiquette() {
	var ele = document.getElementById("toggleText");
	var text = document.getElementById("displayText");
	if(ele.style.display == "block") {
    		ele.style.display = "none";
		text.innerHTML = "show";
  	}
	else {
		ele.style.display = "block";
		text.innerHTML = "";
	}
} 



function commentReturnFunction(){
	var obj = document.getElementById('commentPost');
	var message;

	if(status == "APPROVED" || status == "AUTHOR")
		message = "Thank you for posting your comment.  It should appear on the site shortly.";
	else if(status == "NOTAPPROVED")
		message = "Thank you for posting your comment.  It is pending approval.  It should appear on the site in the next 48 hours.";
	else if(status == "FLAGGED")
		message = "Thank you for posting your comment.  Your comment has been flagged.   It will be reviewed in the next 48 hours for approval.";
	else
		message = status;
	
	//alert("Error msg from server " + status + " " + error);
	obj.innerHTML = message;
}

function getCurrentDate(){
	var myDays = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];
	var currentTime = new Date();
	var month = currentTime.getMonth() + 1;
	var day = currentTime.getDate();
	var year = currentTime.getFullYear();
	var dayOfWeek = myDays[currentTime.getDay()];
	
	var returnString = dayOfWeek + ", " + month + "/" + day + "/" + year;
	return returnString
}

function getCurrentTime(){
	var currentTime = new Date();
	var hours = currentTime.getHours();
	var minutes = currentTime.getMinutes();
	
	if (minutes < 10)
		minutes = "0" + minutes;
	
	var returnString
	if(hours > 12){
		returnString = hours - 12 + ":" + minutes + " ";
	}
	else if(hours == 0){
		returnString = "12:" + minutes + " ";
	}
	else{
		returnString = hours + ":" + minutes + " ";
	}
	
	
	
	
	if(hours > 11){
		var returnString = returnString + "pm";
		
	}
	else
		var returnString = returnString + "am";
		
	return returnString
}

function submitSearchForm(form){
	if(form.keywords.value == ""){
		alert("Please enter a keyword.");
		return false;
	}
	else if(form.keywords.value.length <= 3){
		alert("You must enter a keyword at least 4 characters long.");
		return false;
	}
	
	for (i = 0; i < form.radioSearch.length; i++)
	{
		if(form.radioSearch[i].checked){
			if(form.radioSearch[i].checked == true && form.radioSearch[i].value == "region"){
				if(form.searchWSS.selectedIndex == -1)
					form.searchWSS.selectedIndex = 0;
				
				form.action = "/search";
				return true;
			}
			else if(form.radioSearch[i].checked == true && form.radioSearch[i].value == "site"){
				form.searchWSS.selectedIndex = 0;
				form.action = "/search";
				return true;
			}
			else if(form.radioSearch[i].checked == true && form.radioSearch[i].value == "archive"){
								form.action = "http://www.communitynewslink.com";
				alert(form.action);
				return true;
			}
		}			
	}
	
	alert("Please select the radio button for the type of search you would like to run!");
	return false;
}

function preselectItem(ddlID, optionValue)
  {
    // Get a reference to the drop-down
    var ddl = document.getElementById(ddlID);

    // Loop through all the items
    for (i= 0; i< ddl.options.length; i++)
    {    
      if (ddl.options[i].value == optionValue)
      {
        // Item is found. Set its selected property, and exit the loop
        ddl.options[i].selected = true;
        break;
      }
    }

  }


	var currentObj = new Array();

	function switchBoxDisplay(objNum, boxNum)
	{
		if(objNum != currentObj[boxNum])
		{
			document.getElementById("boxNav"+currentObj[boxNum]).style.background = "#b3cddd";
			document.getElementById("boxNav"+currentObj[boxNum]).style.color = "#004477";
			document.getElementById("boxNav"+currentObj[boxNum]).style.borderBottom = "1px solid #006699";
			
			document.getElementById("story"+currentObj[boxNum]).style.display = "none";
			
			document.getElementById("boxNav"+objNum).style.background = "url(http://media.bclocalnews.com/designimages/titleBackground.gif) repeat-x";
			document.getElementById("boxNav"+objNum).style.color = "#000000";
			document.getElementById("boxNav"+objNum).style.borderBottom = "1px solid #FFFFFF";
			
			document.getElementById("story"+objNum).style.display = "inline";
			
			currentObj[boxNum] = objNum;
		}

		return false;
	}
