      var panels = new Array('panel1', 'panel2', 'panel3', 'panel4');
      var selectedTab = null;
      function showPanel(tab, name)
      {
        if (selectedTab) 
        {
          selectedTab.style.backgroundColor = '';
          selectedTab.style.paddingTop = '';
          selectedTab.style.paddingBottom = '';
        }
        selectedTab = tab;
        selectedTab.style.backgroundColor = 'white';
        selectedTab.style.paddingTop = '6px';
        for(i = 0; i < panels.length; i++)
        {
          document.getElementById(panels[i]).style.display = (name == panels[i]) ? 'block':'none';
        }
        return false;
      }

//OPENS NEW WINDOW//
function newWin(url,size) {
	if (size == "s"){ var width = 300; var height = 300; var winParms = "" }
	else if (size == "m"){ var width = 450; var height = 400; var winParms = "scrollbars=1" }
	else { var width = 700; var height = 500;  var winParms = "scrollbars=1,resizable=1" }

	var left = Math.floor( (screen.width - width) / 2);
    var top = Math.floor( (screen.height - height) / 2);
    var winParms = winParms + ",top=" + top + ",left=" + left + ",height=" + height + ",width=" + width;
    if (parseInt(navigator.appVersion) >= 4) { window.focus(); }
	window.open(url,'',winParms)
}
function OpenVoteWindow(url) {
	if ((document.all.yourAnswer.value > 0))
	{
			var coll = document.all.item("poll_options");
			if (coll)
			{
				for (var i=0; i<coll.length; i++)
				{
					coll(i).checked = false;
					coll(i).disabled = true;
				}
			}
	
		url = url + "?selected_option=" + document.all.yourAnswer.value + "&type=" + document.all.viewType.value + "&poll_id=" + document.all.poll_id.value;
		var votePartLink = document.all.item("vote_button");
		if (votePartLink)
			votePartLink.removeAttribute("href");
		document.all.yourAnswer.value = 0;
		window.open(url,"","top=0,left=0,height=480,width=590,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes");	
	}
}
function CheckVote(voted) {
	if(voted==1)
	{
		DisableVote();
	}	
}
function DisableVote() {
	var coll = document.all.item("poll_options");
	if (coll)
	{
		for (var i=0; i<coll.length; i++)
		{
			coll(i).checked = false;
			coll(i).disabled = true;
		}
	}
	var votePartLink = document.all.item("vote_button");
	if (votePartLink)
		votePartLink.removeAttribute("href");
		document.all.yourAnswer.value = 0;
}

function OpenResultWindow(url) {
			url = url + "?poll_id=" + document.all.poll_id.value;
		window.open(url,"","top=0,left=0,height=480,width=590,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes");	
}



function restrictinput(maxlength,e,thename,theid){
	theform=theid!=""? document.getElementById(theid) : thename
	placeholder =theform;

	if (window.event&&event.srcElement.value.length>=maxlength)
		return false
	else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
		var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys
		if (pressedkey.test(String.fromCharCode(e.which)))
			e.stopPropagation()
	}
}



function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
//else 
//countfield.value = maxlimit - field.value.length;
}
var checked = true;
function SetAllCheckBoxes(FormName, FieldName)
{
	CheckValue = checked;
	if(!document.forms[FormName])
		return;
	var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
	var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
			objCheckBoxes[i].checked = CheckValue;
	if(checked == false)
		checked = true;
	else
		checked = false;
}

//Confirm Message//
function ConfirmMsg(msg)
{
	if(confirm(msg))
				return true;
			else
				return false;
}
function ShowArea(obj){
	if(obj.style.display=='none')
		obj.style.display='block';
	else
		obj.style.display='none';
}
// Add Bookmark
function addToFavorites(title,url) {
  // Blogger - Replace with <$BlogItemPermalinkURL$> 
  // MovableType - Replace with <$MTEntryPermalink$>
  // WordPress - <?php bloginfo('url'); ?>

	if (window.sidebar) 
	{ // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if(window.external) { // IE Favorite
		window.external.AddFavorite(location.href,document.title);
	} 
//	else if(window.opera && window.print) { // Opera Hotlist
//		return true; 
//	}
}

function IncreaseHieght(obj,incr){
	newHeight=parseInt(obj.style.height)+incr;
	obj.style.height=newHeight;
}

function replacesingle(frm,resultfld,dowhat){
//String containing selected text
  var SelectedString = document.selection.createRange().text;
//  alert(SelectedString);
//String containing updated SelectedString
//  var ReplaceString = "<"+dowhat+">"+SelectedString+"</"+dowhat+">";
  var ReplaceString = dowhat ;
//  alert(ReplaceString);
//assign the replace string value to the selected string
  document.selection.createRange().text = ReplaceString;
}



// ********************* marquee **********************

var delayb4scroll=2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=1 //Specify marquee scroll speed (larger is faster 1-10)
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=''

function scrollmarquee(){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
else
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}

function initializemarquee(obj_vmarquee,obj_marqueecontainer,starting_delay,scroll_speed){
delayb4scroll=starting_delay;
marqueespeed=scroll_speed;
cross_marquee=document.getElementById(obj_vmarquee)
cross_marquee.style.top=0
marqueeheight=document.getElementById(obj_marqueecontainer).offsetHeight
actualheight=cross_marquee.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marquee.style.height=marqueeheight+"px"
cross_marquee.style.overflow="scroll"
return
}
setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)
}

function getImageWidth(myImage) {
	var x, obj;
	if (document.layers) {
		var img = getImage(myImage);
		return img.width;
	} else {
		return getElementWidth(myImage);
	}
	return -1;
}

function getImageHeight(myImage) {
	var y, obj;
	if (document.layers) {
		var img = getImage(myImage);
		return img.height;
	} else {
		return getElementHeight(myImage);
	}
	return -1;
}
function setInnerText(objID,txt){
	if(document.all){document.getElementById(objID).innerText=txt} else{document.getElementById(objID).textContent=txt};
}
function highlightEvent(eventId){
	if(document.getElementById(eventId)){
		a=document.getElementById(eventId);
		a.className="eventDayHighlight";
	}
}
function unhighlightEvent(eventId){
	if(document.getElementById(eventId)){
		a=document.getElementById(eventId);
		a.className="eventDay";
	}
}
