var content=new Array();
content[0]='<p>Search all Windows Secrets content.</p>';
content[1]='<p>Search all Windows-related Web sites, powered by Google.com.</p>';

function changetext(whichcontent)
{
	document.getElementById("descriptions").innerHTML=whichcontent;
}


function ActionDetermined()
{
	document.search_form.action = '/sitesearch/?q=' + document.search_form.q.value;
	document.search_form.method = '';
}

function ActionDeterminedArticle(){
   if (document.search_form.q.value != ''){
      document.search_form.action = '/search?q=' + document.search_form.q.value;
	 document.search_form.method = 'POST';
	 document.forms[1].submit();

   }else{
     location.href = '/search/';
   }
}


function showHideItems(myItem){
     var myItem = document.getElementById("advancedOptions");
     var myButton = document.getElementById("button1");
     if (myItem.style.display != "none") {
         //tips are currently displayed, so hide them
         myItem.style.display = "none";
         swapImage(myButton,"plus");
     deletedivcookie()
		}
     else {
         //items are currently hidden, so display them
         myItem.style.display = "block";
         swapImage(myButton,"minus");
         setdivcookie();
         }
}
 //function to swap an image based on its current state
function swapImage(myImage, state) {

	    if (state == "minus") {
           myImage.src = "http://windowssecrets.com/images/less.gif";
               }

        else {

            myImage.src = "http://windowssecrets.com/images/more.gif";
            }

    }

function setdivcookie() {
	exp=new Date();
	plusHour=exp.getHours()+1;
	exp.setHours(plusHour);
	document.cookie="showdiv;expires="+exp.toGMTString();
}

function deletedivcookie() {
  var cookie_date = new Date ( );  // current date & time
  cookie_date.setTime ( cookie_date.getTime() - 1 );
  document.cookie = "showdiv;expires="+cookie_date.toGMTString();
}

window.onload=function() {
	if (document.cookie.indexOf("showdiv")!=-1) {
	document.getElementById("advancedOptions").style.display = "block";
	document.getElementById("button1").src = "http://windowssecrets.com/images/less.gif";
	}
}


