
function redirect() {


	var cookieValue = getCookie( "langCookie" );

//alert("Default Loader. Default Cookie Lang: " + cookieValue  );

	if ( cookieValue != null ) {
		if ( cookieValue == "English" ) {
			parent.location = "index_en.asp";
		} else {
			parent.location = "index_fr.asp";
		}
	} else {
		setCookie("langCookie", "Francais");
    		parent.location = "index_fr.asp";
    	}
}

function changeLanguage() {

//alert ( "LANG CHANGE! --> This Page : (" + thispage + ") Extension : " + extension );

	if ( thispage == null || thispage.length == 0 ) {
		thispage="index";
		extension=".html";
	}
	
	if ( extension == null || extension.length == 0 ) {
		thispage="index";
		extension=".html";
	}	
	
	var wLanguage = getCookie("langCookie");
	//alert( "Cookie Lang: " + wLanguage );
	
	if ( wLanguage == "Francais" ) {
		setCookie("langCookie", "English");		
		//alert( "Loading Page: " + thispage + "_en" + extension );
		window.location= thispage + "_en" + extension;
	} else {
		setCookie("langCookie", "Francais");		
			var wLanguage = getCookie("langCookie");
			//alert( "Cookie Lang2: " + wLanguage );

		//alert( "Loading Page: " + thispage + "_fr" + extension );
		window.location = thispage + "_fr" + extension;
	
	}
}

/*
function changeToEnglish() {
	setCookie("langCookie", "English");
	
	window.location = "index_en.asp";
}

function changeToFrench() {
	
	setCookie("langCookie", "Francais");
	window.location = thispage + "_fr" + extension;
}
*/

function setCookie(szName, szValue) {
	var today = new Date();
	var nextMonth = new Date(today.getYear(), today.getMonth()+1, today.getDate());

 	var szCookieText = escape(szName) + '=' + escape(szValue);
	szCookieText +=	 (nextMonth ? '; EXPIRES=' + nextMonth.toGMTString() : '');
	
	document.cookie = szCookieText;
}

function getCookie(szName) {
 	var szValue =  null;
	if(document.cookie)	   //only if exists
	{
       		var arr =   document.cookie.split((escape(szName) + '=')); 
       		if(2 <= arr.length)
       		{
        	   	var arr2 =   arr[1].split(';');
       			szValue  =   unescape(arr2[0]);
       		}
	}
	return szValue;
}

