/*Used only on UK and US sites
cannot use the set cookie function across different domains, 
(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, and the user not being able to reset their choice of country on sites
*/

//set cookie and redirect on userEvent of select
function setCookie(){

$('#country').change(function () {
	
	//$.cookie('locationCookie', {expires:null, path: '/'});		
	
var userLocation = $('#country option:selected').val();
	 
if(userLocation == 'us')
{
	$.cookie('locationCookie', 'us',{expires: 180, path: '/'});
	//alert('usSet');
	location.href = '/us/';
} 
else if(userLocation == 'uk')
{
	$.cookie('locationCookie', 'uk',{expires: 180, path: '/'});
	/////////////////////alert('ukSet');
	location.href = 'http://www.whichfranchise.com/';
}
else if(userLocation == 'au')
{
	//$.cookie('locationCookie', 'au',{expires: 180, path: '/'});
	//alert('auSet');
	location.href = 'http://www.whichfranchise.net.au/';
}
else if(userLocation == 'ie')
{
	//$.cookie('locationCookie', 'ie',{expires: 180, path: '/'});
	//alert('ieSet');
	location.href = 'http://www.whichfranchise.ie/';
}
else if(userLocation == 'sa')
{
	//$.cookie('locationCookie', 'sa',{expires: 180, path: '/'});
	//alert('saSet');
	location.href = 'http://www.whichfranchise.co.za/';
}
else if(userLocation == 'fl')
{
	$.cookie('locationCookie', 'fl',{expires: 180, path: '/'});
	//alert('flSet');
	location.href = '/florida/';
}
})
} 
