﻿/*function searchSubmit () {
	alert($F("recherche"));
}*/


var myBookmark = new Bookmark("http://www.mondadoripub.fr","Mondadori France publicité");


function globalInit () {
	//Event.observe($("searchBtn"),"click",searchSubmit);
	
	// Table style
	if($('lineGenLeft') && $('lineGenRight')){
	    var maxGenHeight = ($('lineGenLeft').offsetHeight > $('lineGenRight').offsetHeight)? $('lineGenLeft').offsetHeight : $('lineGenRight').offsetHeight;
	    maxGenHeight = maxGenHeight-18;
	    $('lineGenLeft').style.height = maxGenHeight+'px';
	    $('lineGenRight').style.height = maxGenHeight+'px';
	}
	if($('lineGenLeft2') && $('lineGenRight2')){
	    var maxGenHeight = ($('lineGenLeft2').offsetHeight > $('lineGenRight2').offsetHeight)? $('lineGenLeft2').offsetHeight : $('lineGenRight').offsetHeight;
	    maxGenHeight = maxGenHeight-18;
	    $('lineGenLeft2').style.height = maxGenHeight+'px';
	    $('lineGenRight2').style.height = maxGenHeight+'px';
	}
	// table style
}

PopAlert = Class.create();
PopAlert.prototype = {
	
	initialize: function (popup,button,input) {
		this.popup = popup;
		this.input = input;
		Event.observe($(button),"click",this.open.bindAsEventListener(this));
		Event.observe($$("#"+popup+" .close")[0],"click",this.close.bindAsEventListener(this));
		Event.observe($$("#"+popup+" .btn")[0],"click",this.submitMail.bindAsEventListener(this));
	},
	
	open: function () {
		$(this.popup).style.display = "block";
	},
	
	close: function () {
		$(this.popup).style.display = "none";
	},
	
	submitMail: function (e) {
		var myForm = new FormCheck();
		if ($F(this.input)=="") alert("Vous devez renseigner votre e-mail");
		else if (!myForm.validEmail($F(this.input))) alert("Vous devez renseigner un e-mail valide");
		else {
			/* Ajax submit mail */
			this.close();
			$(this.input).value = "";
		}
	}
	
}


function sendFriend()
{
    var pageLocation = document.location.href;
    var StartText = 'Bonjour, %0D%0A%0D%0AUn ami souhaite vous faire d%E9couvrir une page du site internet de Mondadori Publicit%E9, pour cela il vous suffit de cliquer sur le lien ci-dessous %0D%0A%0D%0A';
    var EndText = '%0D%0A%0D%0ABonne visite et %E0 bient%F4t sur www.mondadoripub.fr'
    window.location = 'mailto:&body='+StartText+pageLocation+EndText;
}


function writeFlash(url,id,w,h,o){
	var tempFlashContent = '';
	var flashOptionsTab = new Array();
	flashOptionsTab = o.split('|');
	tempFlashContent += '\n<object id="'+id+'" type="application/x-shockwave-flash" data="'+url+'" width="'+w+'" height="'+h+'">\n';
	tempFlashContent += '\t<param name="movie" value="'+url+'" />\n';
	for(i=0; i<flashOptionsTab.length; i++){
		var tempParam = flashOptionsTab[i].split('#')[0];
		var tempValue = flashOptionsTab[i].split('#')[1];
		tempFlashContent += '\t<param name="'+tempParam+'" value="'+tempValue+'" />\n';
	}
	tempFlashContent += '</object>\n';
	document.write(tempFlashContent);
}


function openPop (target) {
	$(target).style.display = "block";
}


function closePop (target) {
	$(target).style.display = "none";
}


Event.observe(window,"load",globalInit);