/*** Javascript file for putting Componnet/Template specific things in*/
window.addEvent('domready', function() {
	
	if (document.getElementById('country-langs') != null) {
		$('country-langs').getElements('a').addEvents({
			'click' : function(){
				$('country-langs').getElements('a').removeClass('selected');
				$(this).addClass("selected");
			}
		});
	}
});

function goToCountry(){
	var countryLang = $('country-langs').getElement('a.selected');
	var brand = $('brands-ul').getElement('a.selected');
	
	if(countryLang != null && brand != null){
		var homePage = $(countryLang).get('rel');
		var brandSelector = $(brand).get('rel');
		
		var fullURL = homePage + ".brand_"+brandSelector+".html";
		
		if(fullURL.indexOf('http://') < 0){
			fullURL = "http://" + fullURL;
		}
		
		if($('remember-country-lang-brand').checked){
			var myCookie  = Cookie.write('PreferredCountryLanguage', fullURL, {duration: 365, path: '/'});
		}
		
		window.location = fullURL;
	}
	return false;
}

function newWindow(url,height,width)
{
	mywindow= window.open (url, "mywindow",
    "location=1,status=1,scrollbars=1,width='"+ width +"',height='"+ height +"'");
	mywindow.moveTo(0,0);
}