/******************************************************************************/
/*   					 			 					 	Javascript By Cco      	  	 				    	    */
/******************************************************************************/

if (window.attachEvent){window.attachEvent("onload", appelFonctions);}
if (window.addEventListener){window.addEventListener("load", appelFonctions, false);}
 
function appelFonctions(){
	myPersonalSpaceBubble('myPersonalSpaceBubble');
}


function myPersonalSpaceBubble(Obt){
	
	var Wh = 350;
	var He = 230;

	var Count = 0;
	var Ccobj_Bubble = document.getElementById(Obt);
	var Ccobj_ActivateBubble = document.getElementById('loginMySpace');
	var Ccobj_Bubble_Str = Ccobj_Bubble.innerHTML;
	var Ccobj_ActivateBubble_Str = '';
	

	Ccobj_ActivateBubble_Str += '<b id="coinA"></b>';
	Ccobj_ActivateBubble_Str += '<b id="coinB"></b>';
	Ccobj_ActivateBubble_Str += '<b id="coinC"></b>';
	Ccobj_ActivateBubble_Str += Ccobj_Bubble_Str;
	Ccobj_ActivateBubble_Str += '<b id="lineA"></b>';
	Ccobj_ActivateBubble_Str += '<b id="coinD"></b>';
	Ccobj_ActivateBubble_Str += '<b id="lineB"></b>';
	Ccobj_ActivateBubble_Str += '<b id="coinE"></b>';
	
	Ccobj_Bubble.innerHTML = Ccobj_ActivateBubble_Str;

	//alert(Ccobj_Bubble.childNodes[0].id);
	//alert(Ccobj_Bubble.childNodes[0].style.width);

	var coinA = document.getElementById('coinA');
	var coinB = document.getElementById('coinB');
	var coinC = document.getElementById('coinC');
	var coinD = document.getElementById('coinD');
	var coinE = document.getElementById('coinE');
	
	var lineA = document.getElementById('lineA');
	var lineB = document.getElementById('lineB');
	
	Ccobj_Bubble.style.display = 'none';
	Ccobj_Bubble.style.position = 'absolute';
	Ccobj_Bubble.style.top = '101px';
	Ccobj_Bubble.style.left = '70px';
	Ccobj_Bubble.style.zIndex = '1';
	Ccobj_Bubble.style.width = Wh + 'px';
	//Ccobj_Bubble.style.height = He + 'px';
	
	Ccobj_ActivateBubble.style.cursor = 'pointer';
	Ccobj_ActivateBubble["onmouseover"] = viewBubble;
	Ccobj_ActivateBubble["onmouseout"] = hideBubble;
	

	function viewBubble() {
		if(Ccobj_Bubble.style.display == 'none'){
			Ccobj_Bubble.style.display = 'block';
			
			coinC.style.left = Ccobj_Bubble.offsetWidth+'px';
			coinD.style.top = Ccobj_Bubble.offsetHeight+'px';
			coinE.style.top = Ccobj_Bubble.offsetHeight+'px';
			coinE.style.left = Ccobj_Bubble.offsetWidth+'px';
			
			lineA.style.height = (Ccobj_Bubble.offsetHeight-9)+'px';
			lineA.style.left = Ccobj_Bubble.offsetWidth+'px';
			
			lineB.style.width = (Ccobj_Bubble.offsetWidth-9)+'px';
			lineB.style.top = Ccobj_Bubble.offsetHeight+'px';

		}
	}
	
	function hideBubble(mouseEvent) {
		
		if (window.attachEvent){Element = event.target || event.srcElement;}
		if (window.addEventListener){Element = (mouseEvent.target)?mouseEvent.target:mouseEvent.srcElement;}
		
		if(Element.tagName != ''){
			//alert(Element.className);
			Ccobj_Bubble["onmouseover"] = function(){
				if(Ccobj_Bubble.style.display == 'none'){
					Ccobj_Bubble.style.display = 'block';
				}
			};
			Ccobj_Bubble["onmouseout"] = function(){
				if(Ccobj_Bubble.style.display == 'block'){
					Ccobj_Bubble.style.display = 'none';
				}
			};
		}
		
		if(Ccobj_Bubble.style.display == 'block'){
			Ccobj_Bubble.style.display = 'none';
		}		
	}
}

/*----------------------------------------------------------------------------*/
/*                         Changement de taille + -                           */
/*----------------------------------------------------------------------------*/

var Taille;
Taille = 1;

function changerTaille(modifTaille) {
	Taille = Taille + modifTaille;
	if(document.getElementById("center_center")){
		document.getElementById("center_center").style.fontSize = Taille + "em";
	}
} 


/*----------------------------------------------------------------------------*/
/*                  		 		 	FONCTION WRITESESSION			                      */
/*----------------------------------------------------------------------------*/

function writeSession(Nom, Valeur){
	var argc = writeSession.arguments.length;
	var argv = writeSession.arguments;

	var Expire			= (argc > 2) ? argv[2] : null;
	var Repertoire	= (argc > 3) ? argv[3] : null;
	var Domaine			= (argc > 4) ? argv[4] : null;
	var Securise		= (argc > 5) ? argv[5] : false;

	document.cookie = Nom+"="+escape(Valeur)+
	((Expire==null) ? "" : ("; expires="+Expire.toGMTString()))+
	((Repertoire==null) ? "" : ("; path="+Repertoire))+
	((Domaine==null) ? "" : ("; domain="+Domaine))+
	((Securise==true) ? "; secure" : "");
}

/*----------------------------------------------------------------------------*/
/*                  		 				FONCTION READSESSION			                    */
/*----------------------------------------------------------------------------*/

function readSession(Nom){
	var Argument	= Nom+"=";
	var ArgLen		= Argument.length;
	var CookLen		= document.cookie.length;
	var Counter		= 0;

	while (Counter<CookLen){
		var Offset = Counter + ArgLen;
		if(document.cookie.substring(Counter, Offset)==Argument){
			return getSessionVal(Offset);
		}
		Counter = document.cookie.indexOf(" ",Counter) + 1;
		if(Counter==0) break;
	}
	return null;
}

/*----------------------------------------------------------------------------*/
/*                  		 			FONCTION GETSESSIONVAL			                    */
/*----------------------------------------------------------------------------*/

function getSessionVal(Offset){
	var EndStr = document.cookie.indexOf (";", Offset);
	if(EndStr == -1){
		EndStr = document.cookie.length;
	}
	return unescape(document.cookie.substring(Offset, EndStr));
}

/*----------------------------------------------------------------------------*/
/*                  		 			FONCTION GETEXPIRESESSION                       */
/*----------------------------------------------------------------------------*/

function getExpireSession(butWhen){
	var LaDate = new Date();
	var heureEnCours = LaDate.getHours();
	
	if(butWhen == 'Tomorrow'){
		LaDate.setSeconds(0);
		LaDate.setMinutes(0);
		LaDate.setHours(heureEnCours + (24 - heureEnCours) + 2);
		//alert(LaDate);
	}
	
	return(LaDate);
}

/*----------------------------------------------------------------------------*/
/*                               Info Bulle                                   */
/*----------------------------------------------------------------------------*/

jQuery.noConflict();
jQuery(document).ready(function(){
	if (jQuery('#einfobulle').length > 0)
	{
	
		dExpire = getExpireSession('Tomorrow');
			
		if(readSession('einfobulle') != 'ok'){
			writeSession('einfobulle','ok',dExpire);
			show_transp();
		

			jQuery('.einfobulle_fermer a').live('click',function(){
				hide_transp();
				return(false);
			})
		
			jQuery(window).resize(function(){
				adjust_transp();						   
			});
			
		}else{
			jQuery('#einfobulle').css('display','none');
		}
	}
	
});


function show_transp(){
	var width = eval (jQuery(window).width());
	var height = eval (jQuery(window).height()+500);
	jQuery("<div>").attr({'id':'transparant_bg','style':'position:absolute; top:0; left: 0;width:'+width+'px;height:'+height+'px;','class':'transparant'}).appendTo("#global"); //.tx-ebulleinfo-pi1
	//jQuery('#bloc_msg').clone().attr({'style':'position: absolute; top:100px; left:100px;display:block;'}).appendTo('#transparant_bg'); 
	 
	
	var oBulle = jQuery('#einfobulle');
	var oBulleW = oBulle.width();
	var oBulleH = oBulle.height();
	
	var nW = (width/2)-(oBulleW/2);
	var nH = (height/4)-(oBulleH/2);
		
	//oBulle.attr({'style':'top:'+nW+'px; left:'+nH+'px;'})
	if (jQuery('#einfobulle').length > 0)
	{
		jQuery('#einfobulle').css('position','absolute'); //fixed
		jQuery('#einfobulle').css('left',nW+'px');
		jQuery('#einfobulle').css('top',nH+'px');
	}
	jQuery('#einfobulle').clone().attr({'id':'einfobulle2'}).appendTo('#global');
	//jQuery('#einfobulle').clone().attr({'id':'einfobulle','style':'position: absolute; top:100px; left:100px;display:block;'}).appendTo('#transparant_bg');
	jQuery('#einfobulle').remove();
	jQuery('#einfobulle2').css('opacity','1');
}

function hide_transp(){
	jQuery('#transparant_bg').remove();
	jQuery('#einfobulle2').remove();
}

function adjust_transp()
{
	var width = eval (jQuery(window).width());
	var height = eval (jQuery(window).height()+500);
	jQuery('#transparant_bg').css({'width':width+'px','height':+height+'px'});
}

/*
//jQuery.noConflict();
jQuery(document).ready(function(){
	show_transp();

	jQuery('.einfobulle_fermer a').live('click',function(){
		hide_transp();
		return(false);
	})	
	
});


function show_transp(){
	var width = eval (jQuery(window).width());
	var height = eval (jQuery(window).height());
	jQuery("<div>").attr({'id':'transparant_bg','style':'width:'+width+'px;height:'+height+'px;','class':'transparant'}).appendTo(".tx-ebulleinfo-pi1");
	jQuery('#bloc_msg').clone().attr({'style':'position: absolute; top:100px; left:100px;display:block;'}).appendTo('#transparant_bg');
	
	var oBulle = jQuery('#einfobulle');
	var oBulleW = oBulle.width();
	var oBulleH = oBulle.height();
	
	var nW = (width/2)-(oBulleW/2);
	var nH = (height/2)-(oBulleH/2);
		
	//oBulle.attr({'style':'top:'+nW+'px; left:'+nH+'px;'})
	document.getElementById('einfobulle').style.position = 'fixed';
	document.getElementById('einfobulle').style.left = nW+'px';
	document.getElementById('einfobulle').style.top = nH+'px';
}

function hide_transp(){
	jQuery('#transparant_bg').remove();
}

*/