// JavaScript Document

/*******************************************************************************
 * File Name: setCookie.js
 *
 * Purpose:   This JavaScript file holds scripts related to setting cookie data.
 ********************************************************************************
 * Date:        07 / 11 / 2009
 * Author:      Alex Van Leyen
 *              ( foxie.gigglefritz@gmail.com )
 * Version:     1.0
 * Change Log:  Original Version
 *******************************************************************************/
 
/**********************************************
 * setCookie()
 * purpose: Sets the language cookie.
 *
 * inputs:	lang - string value holding the two
 *			letter language code. This function
 *			sets the language cookie.
 *
 * outputs: Language Preference Cookie
 *
 * returns: nothing.
 *			
 * NOTE:	The name of this function does not
 *			reflect it's true purpose. This was
 *			not intentional, I can assure you of
 *			thiat
 **********************************************/
function setCookie( lang ){
	var exdate=new Date();
	var value;
	exdate.setDate(exdate.getDate()+14); // expires in 2 weeks
	switch( lang ){
		case 1: value = "en"; break;
		case 2: value = "fr"; break;
	}
	document.cookie="language_flag=" +escape(value)+ "; expires="+exdate.toGMTString() +"; path=/";
	return;
}

/**********************************************
 * deleteCookie()
 * purpose: this function deletes a cookie
 *
 * inputs:	name - string value holding the name
 *			of the cookie to be deleted
 *
 * outputs: none.
 *
 * returns: nothing.	
 **********************************************/
function deleteCookie( name ){
	var exdate=new Date();
	exdate.setDate(exdate.getDate()-14); // expires in 2 weeks
	document.cookie = name +"=123" + ";expires="+exdate.toGMTString() +"; path=/";
	return;
}