/*
cannot use the set cookie function across different domains, only with a domain such as this - the .com
(i.e remember what site the user picked on last visit,) because each domain sets its own cookie.
Therefore each cookie could well end up with different value which potentially could result in 
the user being bounced around like a squash ball.
*/

function checkCookie(){
	//read cookie and redirect to us site if value is us
	//no need to check for UK, and doing so sends users into a continous redirect anyway.	
	
	cookieVal = $.cookie('locationCookie');
	
	if (cookieVal == 'us') {
		
		location.href = '/us/index.cfm';
	}
	
	
	//else if(cookieVal == 'fl') 
	//{
	//alert("sending to fl");
	//location.href = 'http://www.whichfranchise.com/florida/';
	//}
	//else if(cookieVal == 'ie') 
	//{
	//alert("sending to ie");
	//location.href = 'http://www.whichfranchise.ie/';
	//}
	//else if(cookieVal == 'sa') 
	//{
	//alert("sending to sa");
	//location.href = 'http://www.devSa.com/';
	//}



};


//first checks if cookie already set, if so will then redirect
//if no cookie pointing to an other site this then allows cookie to be set by user on this site
$(document).ready(function()
{
	checkCookie();
	setCookie();
		
});