function setStartPage () {	
	setCookie('ywsStartPage', window.location.href);
}

function clearStartPage () {	
	document.cookie='ywsStartPage=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
}

function goToStartPage () {
	cookieStart=document.cookie.indexOf('ywsStartPage' + '=');
	
	if (cookieStart!=-1) {
		cookieValueStart=cookieStart + 13;
		cookieValueEnd=document.cookie.indexOf(";",cookieValueStart);
	    if (cookieValueEnd==-1) {
	    	cookieValueEnd=document.cookie.length;
	    }
	    if (document.location.href!=unescape(document.cookie.substring(cookieValueStart,cookieValueEnd))){
	    	var oldpage=document.location.href;
	    	document.location.href=unescape(document.cookie.substring(cookieValueStart,cookieValueEnd));
	    	var response=confirm('You have been redirected to the bookmark you set last time.  Click OK to stay or Cancel to clear the bookmark.');	    	
	    	if (response==false){
	    		clearStartPage();
	    		document.location.href=oldpage;
	    	}
	    }	
  	}	
}


