// Nav principale
function mouseOverN(elem)	{$(elem.firstChild).addClass("on");		}
function mouseOutN(elem)	{$(elem.firstChild).removeClass("on");	}
function initNavigationHandlers(){
	$("#nav li").hover(
		function(event)	{	mouseOverN(this);	},
		function(event)	{	mouseOutN(this);	}
	);
}

// Video Home
function openBigVideo(){
	$(".video").html(littleVideoInitContent);
	$("a.popinVideoHD").click();
}

var littleVideoInitContent;
function showLittlePlayerHome(containerId){
	if(!url_video_home_small_mp4 || url_video_home_small_mp4=="" || !url_video_home_small_flv || url_video_home_small_flv==""){
		alert("Impossible de consulter le fichier video !");
	}
	else{
		if((navigator.userAgent.match(/iPad/i)) || (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
			self.location = url_video_home_small_mp4
		}
		else{
			littleVideoInitContent = $(".video").html();
			
			var flashvars = {};
			flashvars.videoSrc = url_video_home_small_flv;
			flashvars.jsFunctionToCall = "openBigVideo";
			flashvars.videoSize = "small"; //small|big
			flashvars.autoRun = "true";
			 
			var params = {};
			params.menu = "false";
			params.allowfullscreen = "true";
			 
			var attributes = {};
			attributes.id = "myVideo";
			attributes.name = "myVideo";
			var timestampAntiBugIE = Math.random();
			swfobject.embedSWF("/swf/playervideo.swf?timestamp="+timestampAntiBugIE, containerId, "294", "165", "9.0.0", "/swf/expressInstall.swf", flashvars, params, attributes);
		}
	}
}

function stripslashes(str){
    return (str + '').replace(/\\(.?)/g, function (s, n1) {
        switch (n1) {
        case '\\':
            return '\\';
        case '0':
            return '\u0000';
        case '':
            return '';
        default:
            return n1;
        }
    });
}

// Global popin
function initPopinLinks(){
	// Popin Video HOME
	$("a.popinVideoHD").popin({	width:714,height:500, className:"popinTexte",opacity: .9,loaderImg : '/img/progress.gif',onExit: function() {}	});
	// Popins footer
	$("a.popin-texte").popin({width:500, height:190, className:"popinTexte",opacity: .9,loaderImg : '/img/progress.gif'});
}

$(document).ready(function() {
	initNavigationHandlers();
	initPopinLinks();
});
