function SetCookie (name, value, expires, path, domain, secure) {
         szCookie = name + "=" + escape (value) +
                  ((expires) ? "; expires=" + expires.toGMTString() : "") +
                  ((path) ? "; path=" + path : "") +
                  ((domain) ? "; domain=" + domain : "") +
                  ((secure) ? "; secure" : "");
                  document.cookie = szCookie;
}

function GetCookie (name) {
         if ( document.cookie) { // Le cookie est-il valide ?
                  index = document.cookie.indexOf( name);
                  if ( index != -1) {
                           nDeb = (document.cookie.indexOf( "=", index) + 1);
                           nFin = document.cookie.indexOf( ";", index);
                           if (nFin == -1) {nFin = document.cookie.length;}
                           return unescape(document.cookie.substring(nDeb, nFin));
                  }
         }
         return null;
}

function initPlayer() {
	// Set up the player
	HDAPlayer.flashRoot = "http://www.progiweb.net/design/progiweb/flash/";
	//HDAPlayer.flashRoot = "http://progiwebdev.progiweb.net/design/standard/swf/";
	HDAPlayer.initFlashProxy("hda-playerHda");//added
	HDAPlayer.registerListeners(HDAListeners);
	//HDAPlayer.sendMeta();
	// Start the player
	HDAPlayer.start("hda-playerHda");


  //HDAPlayer.flashRoot = "http://progiwebdev.progiweb.net/design/standard/swf/";
 /* HDAPlayer.initFlashProxy("hda-playerHda");
  //expandFrame();
  showButtons();
  //HDAPlayer.sendMeta();
  HDAPlayer.start("hda-playerHda");*/
}
function initChrome() {
		HDAChrome.initialize();
}

function showPlayer(node){
	document.getElementById('hda').style.display = "block";
}

function hidePlayer(node){
	document.getElementById('hda').style.display = "none";
}

function sendEvent(node) {
	HDAPlayer.skip();
	HDAPlayer.sendEvent(node, '');
}

function initChat(){
	var img = document.getElementById('click_to_chat');
	if(!img)
		return;
	img.onclick=function(){
		javascript:webChatPop('Template=261916');
	}
	img.onmouseover=function(){
		img.style.cursor='pointer';
	}
	img.onmouseout=function(){
		img.style.cursor='default';
	}
}

function initCall(){
	var img = document.getElementById('click_to_call');
	if(!img)
		return;
	img.onclick=function(){
		javascript:webVoicePop('Template=261626');
	}
	img.onmouseover=function(){
		img.style.cursor='pointer';
	}
	img.onmouseout=function(){
		img.style.cursor='default';
	}
}

window.onload=function() {
	if(document.getElementById("hda-player")){
		HDAPlayer.sendMeta();
		HDAChrome.initialize();
	}
}


function firstVisite(){
	if (GetCookie("isFirstTime")=="false"){
		sendEvent("2b");
	}else{
		SetCookie("isFirstTime","false");
	}
}

HDATool={
	/*
		Affiche le player utilisé principalement pour eZPublish
	*/
	showPlayer:function (node){
		document.getElementById('hda').style.display = "block";
	},

	/*
		cache le player utilisé principalement pour eZPublish
	*/
	hidePlayer:function (){
		document.getElementById('hda').style.display = "none";
	},

	sendEvent: function (node) {
		HDAPlayer.skip();
		HDAPlayer.sendEvent(node, '');
	},

	initChrome:function () {
		HDAChrome.initialize();
	},

	/*
		Cette fonction permet d'initialiser le player.
	*/
	initPlayer:function () {
		// Set up the player
		HDAPlayer.flashRoot = "http://www.progiweb.net/design/progiweb/flash/";
		//HDAPlayer.flashRoot = "http://progiwebdev.progiweb.net/design/standard/swf/";
		HDAPlayer.registerListeners(HDAListeners);
		// Start the player
		HDAPlayer.start("hda-playerHda");
	}
}
