var cogitae_popins = new Array();
function initPopin( popinid, config) {
    var popin = null;
    if (cogitae_popins[popinid]) {
        popin = cogitae_popins[popinid];
    } else {
        popin = new YAHOO.widget.Panel(popinid, {
            visible:false,
            modal: true,
            fixedcenter: true,
            underlay: "shadow",
            draggable: false
            }
        );
        cogitae_popins[popinid] = popin;
        if (config.height) {
            popin.cfg.setProperty( 'height', config.height + 'px' );
        }
        if (config.width) {
            popin.cfg.setProperty( 'width', config.width + 'px' );
        }
	popin.beforeHideEvent.subscribe(function() {
		this.setBody("");
	});	        
        popin.render(document.body);
        if (! config.noclosebutton) {
            popin.close.innerHTML = "Fermer";
        }
    }
    return popin;
}
function openPopin( popinid, config, popincontent) {
    var popin = initPopin( popinid, config );
    popin.setBody( popincontent );
    popin.show();
    var Dom = YAHOO.util.Dom;
    var closeBtn = Dom.getElementsByClassName('container-close')[0];
    closeBtn.blur();
}
function showAideEptica()
{
    openPopin( 'eptica', { 'width': 730 } ,'<iframe id="epticaiframe" src="http://thomascook.epticahosting.com/selfjettours/template-group.do?id=84" marginheight="0" marginwidth="0" frameborder="0"></iframe>');
    return false;
}
function showMailEptica()
{
	openPopin( 'eptica', { 'width': 730 } ,'<iframe id="epticaiframe" src="http://thomascook.epticahosting.com/selfjettours/submit.do" marginheight="0" marginwidth="0" frameborder="0"></iframe>');
	return false;
}
function showDailymotion(film)
{
	var innerhtml = "<object width='620' height='276'>";
	innerhtml += "<param name='movie' value='http://www.dailymotion.com/swf/video/"+film+"?width=560&theme=eggplant&foreground=%23CFCFCF&highlight=%23834596&background=%23000000'></param>";
	innerhtml += "<param name='allowFullScreen' value='true'></param>";
	innerhtml += "<param name='allowScriptAccess' value='always'></param>";
	innerhtml += "<param name='wmode' value='transparent'></param>";
	innerhtml += "<embed type='application/x-shockwave-flash' src='http://www.dailymotion.com/swf/video/"+film+"?width=560&theme=eggplant&foreground=%23CFCFCF&highlight=%23834596&background=%23000000' width='620' height='276' wmode='direct' allowfullscreen='true' allowscriptaccess='always'>";
	innerhtml += "<noembed>Le plugin flash est obligatoire pour visualiser le film</noembed></embed>";
	innerhtml += "</object>";
	innerhtml  = "<iframe frameborder='0' width='640' height='362' src='http://www.dailymotion.com/embed/video/"+film+"'></iframe>";
	openPopin( 'dailymotion', { 'width': 649, 'height': 403, 'fermerTexte': 'X'} ,innerhtml );
	return false;	
}

function showYoutube(film)
{
	var innerhtml = "<iframe width='640' height='390' src='http://www.youtube.com/embed/"+film+"' frameborder='0' allowfullscreen></iframe>";

	openPopin( 'dailymotion', { 'width': 649, 'height': 430, 'fermerTexte': 'X'} ,innerhtml );
	return false;
}

function showVideoClub(iff)
{
	if (typeof DMYT_IFF[iff] != "undefined")
	{
		if (DMYT_IFF[iff] == 'YT')
			return showYoutube(YT_IFF[iff]);
		else if (DMYT_IFF[iff] == 'DM')
			return showDailymotion(DM_IFF[iff]);
	}
		return false;
}
function showVisiteClub(iff)
{
	openPopin( 'visitevirtuelle', { 'width': 800, 'height': 430 } ,'<iframe id="visiteclubiframe" src="http://jettours-catalogue.com/visites-virtuelles/'+iff+'/visite-virtuelle.html" marginheight="0" marginwidth="0" frameborder="0"></iframe>');
	return false;
}

function getCookie(c_name){
	if (document.cookie.length>0){
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1){
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) 
				c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return "";
}

function setCookie(c_name,value,expiretime){
	var exdate= new Date();
	exdate.setTime(exdate.getTime()+expiretime);	
	document.cookie=c_name+ "=" +escape(value)+
	((expiretime == null) ? "" : ";expires="+exdate.toGMTString());
}


function showPopinCookie()
{
}

function showPopinCookieTimer(secondes)
{
	if (typeof(no_popin) != "undefined") return false;
	var popunder=getCookie('popin_eldo');
	if (popunder == null || popunder == ""){	
		var innerhtml;
		if (location.href.substring(0,5) == 'https')
			return false;
		else
		{
			innerhtml = "<a href='http://clubs-eldorador.jettours.com/'><img src='/fileadmin/data/images/visites/JT_neweldo_popin_640x480_v2.jpg' /></a>";
			setTimeout("openPopin( 'popinCookie', { 'width': 650, 'height':520, 'fermerTexte': 'X Fermer'} ,\""+innerhtml+"\")",secondes*1000);		
			setCookie('popin_eldo',true,86400*1000);//delai en milliseconde 
		}
	}
	return popunder;	
}


