document.write('<style type="text/css">.regional {visibility: hidden;}</style>');

$(document).ready(function () { 
	
	// run only if the page contains regional content
	if ( $(".regional").length > 0 ) { 
		var city = getCookie('city');
		if (!city || city=="" || city==null) { cityprompt('/english/change-city.html?keepThis=true&TB_iframe=true&height=150&width=200'); }
		else {
			$(".regional").hide();
			$(".regional").css("visibility","visible");
			var curcity = "."+city;
			$(curcity).show();
		}
	}
	
	
});


function insert_photonav() {
	
	var where = ""+window.location;
	var plang = "english";
	if (where.match("francais")!=null) {plang = "francais";}
	document.write('<ul id="photos-by-year">');
        document.write('<li class="regional va to mo ca ot"><a href="../../'+plang+'/photos/2010.html" rel="nofollow">2010</a></li>');
	document.write('<li class="regional va to mo ca"><a href="../../'+plang+'/photos/2009.html" rel="nofollow">2009</a></li>');
	document.write('<li class="regional to ca mo"><a href="../../'+plang+'/photos/2008.html" rel="nofollow">2008</a></li>');
	document.write('<li class="regional to mo"><a href="../../'+plang+'/photos/2007.html" rel="nofollow">2007</a></li>');
	document.write('<li class="regional to mo"><a href="../../'+plang+'/photos/2006.html" rel="nofollow">2006</a></li>');
	document.write('<li class="regional to mo"><a href="../../'+plang+'/photos/2005.html" rel="nofollow">2005</a></li>');
	document.write('<li class="regional to mo"><a href="../../'+plang+'/photos/2004.html" rel="nofollow">2004</a></li>');
	document.write('<li class="regional to"><a href="../../'+plang+'/photos/2003.html" rel="nofollow">2003</a></li>');
	document.write('<li class="regional to"><a href="../../'+plang+'/photos/2001.html" rel="nofollow">2001</a></li>');

	if (where.match("francais")!=null) {
		document.write('<li class="regional ed ot" style="font-size: 10px; color: #000000;">D&#233;sol&#233;, mais il n\'y a pas de photos disponibles pour nos &#233;v&#233;nements &#224; EDMONTON et OTTAWA. en attendant, prenez le temps de visualiser cette COLLECTION de PHOTOS prises lors de nos tournois &#224; TORONTO, MONTR&#201;AL, CALGARY et VANCOUVER.</li>');
	}
	else {
		document.write('<li class="regional ed ot" style="font-size: 10px; color: #000000;">There are no photos available for Edmonton and Ottawa. Instead, please enjoy this collection of photos taken from our Toronto, Montreal, Calgary and Vancouver tournaments.</li>');
	}
	

	document.write('</ul>');	
	
	

}

function xmltoload(year) {
	var city = getCookie('city');
        
	if (year=="latest")
	{
            if (city=="va" || city=="ot") { year="2010"; }
            else if (city=="to" || city=="mo" || city=="ca") { year="2009"; }
            else {year="2008";}
	}
	
	var rparam = "";
	if (city=="to") { rparam="loadXmlFile="+year+"-toronto.xml"; }
	else if (city=="mo") { rparam="loadXmlFile="+year+"-montreal.xml"; }
	else if (city=="ca") { rparam="loadXmlFile="+year+"-calgary.xml"; }
	else if (city=="va") { rparam="loadXmlFile="+year+"-vancouver.xml"; }
        else if (city=="ot") { rparam="loadXmlFile="+year+"-ottawa.xml"; }
	else { rparam="loadXmlFile=all-cities.xml"; }
	return rparam;
}

function setcity() {
	var chosenoption = $("select#cityselect").val();
	setCookie('city', chosenoption, '', '/');
	city_remove(); 
}

function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + '=' + escape(value) + ((expires) ? '; expires=' + expires.toGMTString() : '') + ((path) ? '; path=' + path : '') + ((domain) ? '; domain=' + domain : '') + ((secure) ? '; secure' : '');
	document.cookie = curCookie;
}

function getCookie(name) {
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	}
	else begin += 2;
	var end = document.cookie.indexOf(";", begin);
	if (end == -1) end = dc.length;
	return unescape(dc.substring(begin + prefix.length, end));
}

function deleteCookie(name, path, domain) {
	var value = getCookie(name);
	if (value != null) document.cookie = name + '=' + ((path) ? '; path=' + path : '') + ((domain) ? '; domain=' + domain : '') + '; expires=Thu, 01-Jan-70 00:00:01 GMT';
	return value;
}

function showCookie() {
	var showcity = getCookie('city');
	alert(showcity);
}