function showCSelBox() {
	$("#fadedBG").css('filter','alpha(opacity=65)');
	$('#fadedBG').fadeIn(0, function() { $('#cSelBox').fadeIn(100); });
}

function changeCountry(cSel,autoSel) {
	var cookies = document.cookie;
	if (cookies.indexOf('pcolcsel') == -1 && !cSel) {
		// User never visited the site before, or never shown preference for country
		// so make them choose.
		$("#fadedBG").css('filter','alpha(opacity=65)');
		$('#fadedBG').delay(500).fadeIn(0, function() { $('#cSelBox').delay(100).fadeIn(200); });
	} else {
		// User has chosen a country, so save a cookie for it and redirect them as applicable
		ajaxUpdate("cSelData","/_shared/ajax/country_select.asp", {	
		   params:"c="+cSel+"&as="+autoSel,
		   meth:"post",
		   async:true,
		   startfunc:"",
		   endfunc:"handleCSel()",
		   errorfunc:"ajaxError()",
		   noauthfunc:"ajaxError()" }
		   );
	}
	
	
}

function handleCSel() {
	$('#cSelBox').fadeOut(0, function () { $('#fadedBG').fadeOut(0); });
	var redirAry = $("#cSelData").html().split('|');
	if (redirAry[0] == '1') {
		//alert("redirecting to "+redirAry[1]+" ("+$("#cSelData").html()+")");	
		window.location = redirAry[1];
	} else {
		//alert("no redirection necessary ("+$("#cSelData").html()+")");	
	}
}
