
//---definir utilisateur comme majeur (sur portail de check legal age)---

function isMajeur(p_langcode,p_zonecode){
	
	HavanaClub.ageLegal(1);	
	HavanaClub.set( { LANGCODE : p_langcode , ZONECODE : p_zonecode } );
	HavanaClub.onComplete = function(){ 
		//window.location.reload(); 
		document.location="http://www.havana-club.com/"+p_zonecode+"/"+p_langcode+"/"+PAGE_ID+".html";
	}

}


//---changement localisation (sur portail de check legal age)---

function gotoLocale( p_langcode, p_zonecode ){
	
	if(p_langcode == "FR" && p_zonecode == "FR" ){
		document.location="http://www.havana-club.fr/FR/FR/"+PAGE_ID+".html";
		return;
	}
	
	if(p_langcode == "DE" && p_zonecode == "AT" ){
		document.location="http://www.havana-club.at/";
		return;
	}
	if(p_langcode == "DE" && p_zonecode == "DE" ){
		document.location="http://www.havana-club.com/DE/DE/"+PAGE_ID+".html";
		return;
	}
	
	if(p_langcode == "EN" && p_zonecode == "UK" ){
		document.location="http://www.havana-club.co.uk/"+PAGE_ID+".html";
		return;
	}
	if( p_langcode == "RU" && p_zonecode == "RU" ){
		document.location="http://www.havana-club.com/ru/ru/"+PAGE_ID+".html";
		return;
	}
	
	if(p_langcode == "FR" ){
		document.location="http://www.havana-club.com/fr/"+PAGE_ID+".html";
		return;
	}
	if( p_langcode == "DE" ){
		document.location="http://www.havana-club.com/de/"+PAGE_ID+".html";
		return;
	}
	if( p_langcode == "ES" ){
		document.location="http://www.havana-club.com/es/"+PAGE_ID+".html";
		return;
	}
	if( p_langcode == "RU" ){
		document.location="http://www.havana-club.com/ru/"+PAGE_ID+".html";
		return;
	}
	if(p_langcode == "EL" ){
		document.location="http://www.havana-club.com/el/"+PAGE_ID+".html";
		return;
	}
	if(p_langcode == "IT" ){
		document.location="http://benvenuto.havana-club.it/"+PAGE_ID+".html";
		return;
	}
	if( p_langcode == "EN" ){
		document.location="http://www.havana-club.com/en/"+PAGE_ID+".html";
		return;
	}
		
	document.location="http://www.havana-club.com/"+p_zonecode+"/"+p_langcode;
	
}

//---POP UPS (sur portail de check legal age)---

var popupWin;
function popup( name , market , langue ){
	var w = 400;
	var h = 400;
	var l = (screen.width - w) / 2;
	var t = (screen.height - h) / 2;
	
	if(popupWin){
		popupWin.close();
	}
	
	if( name == "contact"){
		url = "http://www.havana-club.com/portail/"+name+"/"+market+"/"+langue;
	}else{
		url = "http://www.havana-club.com/portail/page/"+ name +"/" + market + "/" + langue;
	}
			
	popupWin = window.open( url , name , "width="+w+",height="+h+",left="+l+",top="+t+",scrollbars=1,resizable=1");
	
}



//---SWFADDRESS---



function swfa2Flash(str){		
	//flash ne prend pas de / au debut
	if(str.substring(0,1)=="/"){
		str=str.substring(1,str.length)
	}
	//flash ne prend pas de -- comme separateur d'id il prend des ;
	if(str.indexOf(",")>-1){
		str=str.replace(/,/, ";");
	}		
	return str;
}


// swf history manager
function setHistory(h) {
	//on effeace le / au debut
	if(h.substring(0,1)=="/"){
		h=h.substring(1,h.length);
	}
	//les ; sont interpretes bizarement par swfaddress
	if(h.indexOf(";")>-1){
		h=h.replace(/;/, ",");
	}	
	SWFAddress.setStatus(h);
	hash = h;
	SWFAddress.setValue("/"+h)
	if(!PRINT){
		suiviUtilisateurs("navigation",h,LANGCODE,ZONECODE,SITE);
		statistiques_google_analytics(h);
	}
}


function onHistoryChange(event) {
	h=event.path;	
	h=swfa2Flash(h);
	
	if(h=="undefined" || h==undefined || h=="" || h=="/"){
		return;
	}
	
	if (hash != h) {				
		try { 
				hash = h;
				document.getElementById("website").onHistoryChange(h); 
		}catch (err) 
		{}	
	}
}
function setTitle(title_html){
	if(title_html != "null"){
		SWFAddress.setTitle(title_html);
	}
}

//---PRINT---

function ws_print(url_page_print){
	//print_frame.location.href=url_page_print;
	document.title=url_page_print;
	$('print_frame').set('src',url_page_print);
	if (CheckIsIE() == true){
		//document.print_frame.focus();
		document.print_frame.print();
	}else{
		window.frames['print_frame'].focus();
		//window.frames['print_frame'].print();
	}
	//PrintThisPage();	
}
function CheckIsIE(){
	if (navigator.appName.toUpperCase() == 'MICROSOFT INTERNET EXPLORER') { return true;}
	else { return false; }
}


function PrintThisPage()
{

	if (CheckIsIE() == true){
		document.print_frame.focus();
		document.print_frame.print();
	}else{
		window.frames['print_frame'].focus();
		window.frames['print_frame'].print();
	}

} 





