var flash = {
	init: function(){
		//alert('Flash should be resized');
	}		
}

var popup = {
	open: function(url){
		window.open(url,"Nespresso","menubar=no, status=no, scrollbars=yes, menubar=no, width=850, height=500");
		}
}

/*
var popup = {
	open: function(url){
	window.setTimeout(window.open(url,"Nespresso","menubar=no, status=no, scrollbars=yes, menubar=no, width=850, height=500"),3000);
		}
}

var popup = {
	open: function(url){
		window.open(url,"Nespresso","menubar=no, status=no, scrollbars=yes, menubar=no, width=850, height=500");
		}
}
*/

function updatetitle(titre){
this.document.title=''+titre+'';
//$('title').html('test');
}


function popup_panier(url){
	window.open(url,"Nespresso","menubar=no, status=no, scrollbars=yes, menubar=no, width=466, height=450");
}

function nesclubconnect(login,pass){ 
document.frm_nestor2nesclub.ed_login.value = login;
document.frm_nestor2nesclub.ed_pwd.value = pass;
document.frm_nestor2nesclub.submit();

}



var nespressoTools =
{

	country : "",
	lang : "",
	that : this,
	redirectURL : "",
	computeURL : function(str)
	{	
		//has hash ?
		var posHash = str.indexOf('#');
		if(posHash != -1) // means we have a hash
		{

var UrlFinale=str.split('/#/');

			var hash = str.substring(posHash);
			var occurences = hash.match(/\//g);
			var hash_segments = hash.split("/");
			if(hash_segments[0] == "#" && occurences.length >= 2)
			{


				var country_from_url = (hash_segments[1].length > 3) ? "" : hash_segments[1];
				var lang_from_url = (hash_segments[2].length > 3) ? "" : hash_segments[2];
				

				
				//everything seems almost ok
				if(country_from_url != nespressoTools.country  || lang_from_url != nespressoTools.lang)
					{
					nespressoTools.redirectURL = UrlFinale[1]; 
				}
			}
		}
		
		return nespressoTools.redirectURL;
	}
}
