// JavaScript Document
function setState(state){
	document.cookie="stateReq="+state
}


function readCookie(cookieName) /** Returns the value of named cookie or "" on failure **/
{
  var  unescFunc=decodeURI||unescape;
  var cValue="";
 
  if(typeof document.cookie!='undefined')
   cValue=(cValue=document.cookie.match(new RegExp("(^|;|\\s)"+cookieName+'=([^;]+);?'))) ? cValue[2] : "";
  
  return unescFunc(cValue);
}

function get_stateReq() {
	var newURL=readCookie("stateReq") + ".shtml";
	if (readCookie("stateReq")== "null"){
		location.href="index.shtml";
	} else if (readCookie("stateReq")== ""){
		location.href="index.shtml";
	} else if (readCookie("stateReq")== "undefined"){
		location.href="index.shtml";
	}else {
		location.href=newURL;
	}

}
