$(document).ready(function() {   var choosepanel = cookieval("companyName"); // check if cookie called companyName exists   if (choosepanel!=0){ // if it does set menu to cookie value and show ajax display below      $('#ftextboxselect').val(choosepanel);      var querystring="ftextid="+choosepanel;      $.get('candctabs.php', querystring, processResponse);   }   // no cookie set so here's the default jump menu   $('#ftextboxselect').change(function() {      var choosepanel=$('#ftextboxselect :selected').val();      if (choosepanel=='0'){ // not sure we need this bit         alert('Please select a panel');         return false;      }      var querystring="ftextid="+choosepanel;      $.get('candctabs.php', querystring, processResponse);      $('#selectdefault').hide();      setCookie(choosepanel); // menu has changed so write/overwrite companyName cookie   });}); // end document readyfunction cookieval(cookiename){ // find the value of a named cookie   var thiscookie=document.cookie.split("; ");   for (var i=0; i<thiscookie.length; i++){      if(cookiename==thiscookie[i].split("=")[0]){         return thiscookie[i].split("=")[1];      }   }   return 0;}function setCookie(company) { // set a cookie   var expireDate = new Date();   expireDate.setMinutes(expireDate.getMinutes()+15);   document.cookie = "companyName=" + company + ";expires=" + expireDate.toGMTString();   var readcookie = document.cookie.split("=")[1];}function processResponse(data, status) { // ajax stuff   var newHtml;   if (status=='success') {      newHtml=data;   } else {      newHtml='<h3>There has been an error<h3>';   }   $('.container').html(newHtml);}
