﻿function redirect (form) {
    var TestVar = form.search.value;
	var newloc = "/search.aspx?query=" + TestVar;
	document.location.href = newloc;
}

function GoogleSearch (form,thiswidth,GoogleCSEID) 
{
    var TestVar = form.searchtext.value;
	var newloc = "/googlesearch.aspx?cx=" + GoogleCSEID + "&cof=FORID%3A11&ie=UTF-8&Width=" + thiswidth + " &q=" + TestVar;
	document.location.href = newloc;
}

function vote (form) {
    var TestVar = 0;
    var PollID = form.PollID.value;
    
    for (i=0; i<form.r1.length; i++)
    {
      if (form.r1[i].checked == true)
      TestVar = form.r1[i].value;
    }
    
	var newloc = "/scripts/vote.aspx?poll=" + PollID + "&vote=" + TestVar + "&location=" + location.href;
	document.location.href = newloc;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function RedirectUser (NewLocation) {
    	document.location.href = NewLocation;
}

function ChangeEditMode (Location) {
    var NewLocation = Location.replace("?SwapEditMode=1","").replace("&SwapEditMode=1","");
    if(NewLocation.indexOf("?") >=0)
    {
    	window.location = NewLocation + "&SwapEditMode=1";       
    }
    else
    {
    	window.location = NewLocation + "?SwapEditMode=1";
	}
}

function showhide(divid) {
	var ActiveDiv = document.getElementById(divid);
	var CurrentDisplay = ActiveDiv.style.display;
	
	if(CurrentDisplay == "none")
	{
		Effect.SlideDown(ActiveDiv);
	}
	else
	{
		Effect.SlideUp(ActiveDiv);
	}
}

function showhideDataList(divid, listLink) {
	var ActiveDiv = document.getElementById(divid);
	var CurrentDisplay = ActiveDiv.style.display;
	
	if(CurrentDisplay == "none")
	{
		Effect.SlideDown(ActiveDiv);
		document.getElementById(listLink).setAttribute("class", "DataListItemLink DataListSelected");
	}
	else
	{
		Effect.SlideUp(ActiveDiv);
		document.getElementById(listLink).setAttribute("class", "DataListItemLink");
	}
}
