/* ------------------------------------------------------------------- */
function setCookie(NameOfCookie,value) {
	
 var ExpireDate=new Date();
 var temp_value=value;
 
 if (NameOfCookie=="language")
 	ExpireDate.setTime(ExpireDate.getTime() + 90*24*3600*1000);
 	
 else
	{	// March, 1st 2007.
		ExpireDate.setDate(1);
		ExpireDate.setMonth(3);
		ExpireDate.setYear(2007);
		
		// check if cookie exists
		var value_returned=getCookie(NameOfCookie);
		
		if (value_returned!=null)
			delCookie(NameOfCookie);
 	} // end of else statement
	
 document.cookie = NameOfCookie + "=" + escape(temp_value) + ";expires=" + ExpireDate.toGMTString() + ";path=/";

	if (temp_value=="english")
		location.replace("ercc_welcome.html");
	else if (temp_value=="french")
		location.replace("ercc_welcome_f.html");
 
 // Check for content of the FAQ cookie
 if ((temp_value!="english") && (temp_value!="french")) {

	// verify cookie
	var check_cookie_set=getCookie("faq");
	if(check_cookie_set==null) {
		alert("Your browser is not enabled to accept cookies.  In order to view the FAQ page, please enable your browser to accept cookies from the ERCC web site.");
		return false;
 	}
	else
		return true;
 }

} // end of function setCookie
/* ------------------------------------------------------------------- */

function getCookie(NameOfCookie) {
 
 if(document.cookie.length > 0) {
 	
	var start = document.cookie.indexOf(NameOfCookie+"=");
	
	if (start!=-1) {
		
		start+=NameOfCookie.length + 1;
		var end = document.cookie.indexOf(";",start);
		if(end==-1)
			end=document.cookie.length;
		return unescape(document.cookie.substring(start,end));
	
	} //end of inner if statement	 
 
 } //end of outter if statement
 
 return null;

} // end of function getCookie
/* ------------------------------------------------------------------- */

function delCookie(NameOfCookie) {

 if(getCookie(NameOfCookie)){
	document.cookie=NameOfCookie+"="+";expires= Thu, 01-Jan-70 00:00:01 GMT";
 }

} // end of function delCookie