//Genuine code by Corneliu Lucian 'Kor' RUSU corneliulucian[at]gmail[dot]com

//Applied upon the box "Speed contact"
AttachEvent(window,'load',attachContactez,false);
AttachEvent(window,'load',attachMenu,false);
function attachContactez(){
var txt=[
['<span style="font-size:18px">01 46 65 63 50</span>','Contact immédiat <br>via Skype'],
['<span style="font-size:18px;color:#fff">01 46 65 63 50</span>','<span style="font-size:18px;color:#fbda70">01 46 65 63 50</span>'],
['<span style="font-size:18px;color:#fff">01 46 65 63 50</span>','<span style="font-size:18px;color:#fff">01 46 65 63 50</span>']
]

var divs=document.getElementById('con_sus').getElementsByTagName('div');
for(var i=0;i<divs.length-1;i++){
divs[i].ind=i;	
divs[i].onmouseover=function(){changeContactez(this,txt)};
}
}
function changeContactez(obj,txt){
var divs=obj.parentNode.getElementsByTagName('div');
for(var i=0;i<divs.length-1;i++){
divs[i].style.backgroundColor=divs[i]==obj?'#c4ddf9':'#98c4f5';
}
var div=document.getElementById('con_jos');
div.innerHTML=txt[obj.ind][1];
obj.onmouseout=function(){document.getElementById('con_jos').innerHTML=txt[this.ind][0]}
}

//Applied upon the horizontal to menu
function attachMenu(){
var divs=document.getElementById('menu_up').getElementsByTagName('div'), i=0, d;
while(d=divs[i++]){
	if(d.className=='mm'){
	d.onmouseover=rollOnMenu;
	d.onmouseout=rollOffMenu;
	}
	
}
/*var links=document.getElementById('menu_up').getElementsByTagName('a'), j=0, l;
while(l=links[j++]){
	if(l.className.match(/men_mm/)){
	l.onclick=function(){return false}
	}
}*/
}
function rollOnMenu(){
var divs=this.parentNode.getElementsByTagName('div'), i=0, d;
while(d=divs[i++]){

	if(d.className=='sub_mm'){
	d.style.display=d.parentNode==this?'block':'none';
	}
}
}
function rollOffMenu(){
this.getElementsByTagName('div')[0].style.display='none';
}

// show/hide references in References page
function rollOnPop(obj){
rollOffRef();
var div=obj.parentNode.parentNode.getElementsByTagName('div')[0];
if(div.className=='refe_pop'){
div.style.display='block';
}
}


// show/hide references in Experiences metiers page
var setExpe;
function rollOnRef(obj){
rollOffRef();
var div=obj.parentNode.getElementsByTagName('div')[0];
if(div.className=='expe_app'){
	div.style.display='block';
	obj.onmouseout=function(){
		setExpe=setTimeout(function(){rollOffRef()},1000)}
	div.onmouseover=function(){clearTimeout(setExpe)}
	div.onmouseout=function(){
		setExpe=setTimeout(function(){rollOffRef()},1000)
		}
}
}

function rollOffRef(){
if(setExpe){clearTimeout(setExpe)}
var divs=document.getElementById('expe_allrows').getElementsByTagName('div'), i=0, d;
while(d=divs[i++]){
d.className=='expe_app'||d.className=='refe_pop'?d.style.display='none':null;
}
}
// Microsoft certification

AttachEvent(window,'load',setMicrosoft,false);

function setMicrosoft(){
var objOn=document.getElementById('fade1');
objOn.onmouseover=rollOnMS;
//objOn.onmouseout=setTimeout(function(){rollOffMS()},2000);
}
function rollOnMS(){
var obj=document.getElementById('fade2');
obj.W=parseInt(obj.style.width,10);
obj.L=parseInt(obj.style.left,10);
var W=[40,30,20,10,10,10,10,5,5,5,2,2,1];
var L=[40,30,20,10,10,10,10,5,5,5,2,2,1];
var delay=50;
this.onmouseover=function(){null}
moveMS(this,obj,W,L,delay,0);
}

function moveMS(objON,obj,W,L,delay,q){
if(q==13){
	setTimeout(function(){moveMSback(objON,obj,W,L,delay,0)},2000)
}
	else{
	obj.style.width=(obj.W+W[q])+'px';
	obj.style.left=(obj.L-L[q])+'px';
	q++;
	obj.W=parseInt(obj.style.width,10);
	obj.L=parseInt(obj.style.left,10);
	setTimeout(function(){moveMS(objON,obj,W,L,delay,q)},delay);
	}
}

function moveMSback(objON,obj,W,L,delay,q){
	if(q==13){setMicrosoft()
	}
	else{
	obj.style.width=(obj.W-W[q])+'px';
	obj.style.left=(obj.L+L[q])+'px';
	q++;
	obj.W=parseInt(obj.style.width,10);
	obj.L=parseInt(obj.style.left,10);
	setTimeout(function(){moveMSback(objON,obj,W,L,delay,q)},delay);
	}
}
function getdate(){
var TODAY={};
var today=new Date();
TODAY.yyyy=today.getFullYear();
TODAY.mm=today.getMonth()+1;
TODAY.dd=today.getDate();
TODAY.mm<10?TODAY.mm='0'+TODAY.mm:null;
TODAY.dd<10?TODAY.dd='0'+TODAY.dd:null;
//writeDate(TODAY.yyyy,TODAY.mm,TODAY.dd);
return TODAY;
}
