     function setCookie(countName){
		var COOKIE_NAME = "AV_country";
		var TARGET_URL = "http://usa.apresvelo.com/?redirect=";
		var EXPIRY = new Date();
		//let it expire after 3 days
		EXPIRY.setTime(EXPIRY.getTime() + (1 * 24 * 60 * 60 * 1000));
		
		
		
        	switch(countName){
				case "United States" :
					var ans = confirm("I am confirming that I am located in the United States");
					if(ans){
						jQuery.cookie(COOKIE_NAME,"United States",{ expires: EXPIRY});
						window.location = TARGET_URL + "US";
					}
					break;
				case "Puerto Rico" :
					var ans = confirm("I am confirming that I am located in Puerto Rico");
					if(ans){
						jQuery.cookie(COOKIE_NAME,"Puerto Rico", {expires: EXPIRY});
						window.location = TARGET_URL + "PR";
					}
					break;
				case "Canada" :
					var ans = confirm("I am confirming that I am located in Canada");
					if(ans){
						jQuery.cookie(COOKIE_NAME,"Canada", {expires: EXPIRY});
						window.location = TARGET_URL + "CAN";
					}
					break;
				case "Australia" :
					var ans = confirm("I am confirming that I am located in Australia");
					if(ans){
						jQuery.cookie(COOKIE_NAME,"Australia", {expires: EXPIRY});
						//window.location="http://apresvelo.com?redirect=au";
					}
					break;
				case "rest of the world":
					var ans = confirm("I am confirming that I am located outside Australia, Canada, Puerto Rico and the United States");
					if(ans){
						jQuery.cookie(COOKIE_NAME,"rest of the world", {expires: EXPIRY});
						//window.location="http://apresvelo.com?redirect=rest";
					}
					break;
			}

    }

	function redirect_onload(){
		var COOKIE_NAME = "AV_country";
		var EXPIRY = new Date();
		//let it expire after 3 days
		EXPIRY.setTime(EXPIRY.getTime() + (1 * 24 * 60 * 60 * 1000));
		var TARGET_URL = "http://usa.apresvelo.com/?redirect=";		

		//if page is loaded via redirect.. 
		if(jQuery.query.get("redirect")){
			var REDIRECT_VAR = jQuery.query.get("redirect");
			//clear landing site cookie
			jQuery.cookie(COOKIE_NAME,null);
			
			//make landing site cookie consistent with source site cookie
			switch(REDIRECT_VAR){
				case "US":
					jQuery.cookie(COOKIE_NAME,"United States", {expires: EXPIRY});
					break;
				case "PR":
					jQuery.cookie(COOKIE_NAME,"Puerto Rico", {expires: EXPIRY});
					break;					
				case "CAN":
					jQuery.cookie(COOKIE_NAME,"Canada", {expires: EXPIRY});
					break;					
				case "AU":
					jQuery.cookie(COOKIE_NAME,"Australia", {expires: EXPIRY});
					break;
				case "REST":
					jQuery.cookie(COOKIE_NAME,"rest of the world", {expires: EXPIRY});
					break;			
			}
		
		}
		//otherwise redirect to US site if cookie info suggests redirection
		else if (jQuery.cookie(COOKIE_NAME) !== null && jQuery.query.get("redirect") == false) {
			var cvalue = jQuery.cookie(COOKIE_NAME);

			switch(cvalue){

				case "United States":
					window.location = TARGET_URL + "US";
					break;
				case "Puerto Rico":
					window.location = TARGET_URL + "PR";
					break;
				case "Canada":
					window.location = TARGET_URL + "CAN";
					break;

				/*
				case "Australia":
					window.location="http://apresvelo.com?redirect=AU";
					break;
				case "rest of the world":
					window.location="http://apresvelo.com?redirect=REST";
					break;				
				*/
			}
		
		}
	}
