      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;
      }


// Add Bookmark
function addToFavorites() {
	  window.external.AddFavorite(location.href,document.title);
}

// Make Home page
function makeHomepage(homepage) {
	document.body.style.behavior='url(#default#homepage)';
	document.body.setHomePage(homepage);
}



//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 SendPage(url) {
		window.open(url,"","top=0,left=0,height=300,width=400,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 OpenMailingList(email) {
	url = "mailing.php?email=" + email;
	window.open(url,"","top=0,left=0,height=200,width=500,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes");	
}
function OpenHomepopupPage(page) {
	url = "homepopup/"+page;
	window.open(url,"","top=0,left=0,height=300,width=600,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;
}

