﻿window.addEvent('domready', function() { 

var lastmenu=null;

for (var i=0;i<document.getElementsByTagName('*').length;i++) 
{ 
    if (document.getElementsByTagName('*')[i].id.substr(0,3)=='cat')
    {
        var num=document.getElementsByTagName('*')[i].id.substr(3,document.getElementsByTagName('*')[i].id.length-3);
        
        if (document.getElementById('subMenu'+num)) 
        {    
           
            var taille=(($('menucat'+num).getElementsByTagName('a').length-1)*24+60);
           
            eval("$('menucat"+num+"').addEvent('mouseover',function(e) { e.stop(); $('cat"+num+"').style.backgroundImage='none'; $('cat"+num+"').style.backgroundColor='white';  hideThem('menucat"+num+"');   var effect=new Fx.Morph('menucat"+num+"',{duration: 'short', transition: Fx.Transitions.Sine.easeIn}); effect.start({ 'height': [($('menucat"+num+"').style.height)?$('menucat"+num+"').style.height:'60px','"+taille+"px'] });  });");
            eval("$('menucat"+num+"').addEvent('mouseout',function(e) { e.stop();   $('menucat"+num+"').style.height='60px'; })"); 
            eval("$('menucat"+num+"').addEvent('mousemove',function(e) { e.stop(); })");
            eval("$('cat"+num+"').addEvent('mouseout',function(e) { e.stop(); })");
            //eval("$('subcat"+num+"').addEvent('mouseover',function(e) { })");
           //eval("var osubMenu"+num+"=$('subMenu"+num+"');")            
           //eval("$('cat"+num+"').addEvent('mouseover', function(e) { e.stop(); if ((lastmenu!=null)&&(lastmenu!='subMenu"+num+"')) {  var oldEffect = new Fx.Morph(lastmenu, {duration: 'short', transition: Fx.Transitions.Sine.easeIn});  oldEffect.start({ 'height': [eval(lastmenu).style.height, 0] }); } var myEffect = new Fx.Morph('subMenu"+num+"', {duration: 'short', transition: Fx.Transitions.Sine.easeIn});  myEffect.start({ 'height': [eval('subMenu"+num+"').style.height, 60] }); lastmenu='subMenu"+num+"'; });"); 
        }
     }
}

$('body').addEvent('mousemove',function(e) { e.stop(); hideThem0('');  });


});


function hideme(name)
{
    alert(name);
    var effect=new Fx.Morph(name,{duration: 'short', transition: Fx.Transitions.Sine.easeIn});
    effect.start({ 'height': [(eval(name).style.height)?eval(name).style.height:60,60] });
   
}

function hideThem(name)
{
    for (var i=0;i<document.getElementsByTagName('*').length;i++) 
    { 
        if ((document.getElementsByTagName('*')[i].id.substr(0,7)=='menucat')&&(document.getElementsByTagName('*')[i].id!=name))
        {
      
            //eval(document.getElementsByTagName('*')[i].id).style.height='60px';
            var effect=new Fx.Morph(document.getElementsByTagName('*')[i].id,{duration: 'short', transition: Fx.Transitions.Sine.easeIn});
            effect.start({ 'height': [($(document.getElementsByTagName('*')[i].id).style.height)?$(document.getElementsByTagName('*')[i].id).style.height:60,60] });
            $(document.getElementsByTagName('*')[i].id.substr(4,document.getElementsByTagName('*')[i].id.length-4)).style.backgroundImage='url(/images/menuCatalog.png)'; 
            $(document.getElementsByTagName('*')[i].id.substr(4,document.getElementsByTagName('*')[i].id.length-4)).style.backgroundColor='transparent';
        }
    }
  
    
}

function hideThem0(name)
{
    for (var i=0;i<document.getElementsByTagName('*').length;i++) 
    { 
        if ((document.getElementsByTagName('*')[i].id.substr(0,7)=='menucat')&&(document.getElementsByTagName('*')[i].id!=name))
        {
      
            $(document.getElementsByTagName('*')[i].id).style.height='60px';
            $(document.getElementsByTagName('*')[i].id.substr(4,document.getElementsByTagName('*')[i].id.length-4)).style.backgroundImage='url(/images/menuCatalog.png)'; 
            $(document.getElementsByTagName('*')[i].id.substr(4,document.getElementsByTagName('*')[i].id.length-4)).style.backgroundColor='transparent';
            //var effect=new Fx.Morph(document.getElementsByTagName('*')[i].id,{duration: 'short', transition: Fx.Transitions.Sine.easeIn});
            //effect.start({ 'height': [(eval(document.getElementsByTagName('*')[i].id).style.height)?eval(document.getElementsByTagName('*')[i].id).style.height:60,60] });
        }
    }
}

window.onload=function() {
	if (window.innerHeight && window.scrollMaxY) {// Firefox
        yWithScroll = window.innerHeight + window.scrollMaxY;
        xWithScroll = window.innerWidth + window.scrollMaxX;
    } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
        yWithScroll = document.body.scrollHeight;
        xWithScroll = document.body.scrollWidth;
    } else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
        yWithScroll = document.body.offsetHeight;
        xWithScroll = document.body.offsetWidth;
    }
	
	var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }

	if (myHeight<yWithScroll)
	{
		document.getElementById('bottom').style.top=yWithScroll+'px';
		document.getElementById('accueilbtn').style.top=yWithScroll+25+'px';
	}
	else
	{
		document.getElementById('bottom').style.bottom=0;
		document.getElementById('accueilbtn').style.bottom='25px';
	}
	var rnd=Math.round(Math.random()*4)+1;
	var ajout="";
	var taille="";
	if (xWithScroll<myWidth) xWithScroll=myWidth;
	if (xWithScroll<=1280) taille='1280';
	if (xWithScroll<=1024) taille='1280';
	if ((window.location.href=="http://www.bleco.be/Front/c2-141/Bleco---Vente-de-mobilier-de-bureau-haut-de-gamme.aspx")||(window.location.href=="http://www.bleco.com/Front/c2-141/Bleco---Vente-de-mobilier-de-bureau-haut-de-gamme.aspx")||(window.location.href=="http://www.bleco.com/Front/Render.aspx")||(window.location.href=="http://www.bleco.com/Front/c2-141/Accueil.aspx")||(window.location.href=="http://www.bleco.be/Front/Render.aspx")||(window.location.href=="http://www.bleco.be/Front/c2-141/Accueil.aspx"))
	   ajout='b';
	document.body.style.backgroundImage='url(/images/fond'+rnd+ajout+taille+'.jpg)';
	document.getElementById('bt1').className='';
    document.getElementById('bt2').className='';
    document.getElementById('bt3').className='';
    document.getElementById('bt4').className='';
    document.getElementById('bt5').className='';
    document.getElementById('bt'+rnd).className='on';
}
window.onresize=function() {
	window.location.reload(true);
}

function showfond(id)
{
    if (window.innerHeight && window.scrollMaxY) {// Firefox
        yWithScroll = window.innerHeight + window.scrollMaxY;
        xWithScroll = window.innerWidth + window.scrollMaxX;
    } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
        yWithScroll = document.body.scrollHeight;
        xWithScroll = document.body.scrollWidth;
    } else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
        yWithScroll = document.body.offsetHeight;
        xWithScroll = document.body.offsetWidth;
    }
	
	var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }

    var ajout="";
    var taille="";
    if (xWithScroll<myWidth) xWithScroll=myWidth;
    if (xWithScroll<=1280) taille='1280';
	if (xWithScroll<=1024) taille='1280';
	if ((window.location.href=="http://www.bleco.be/Front/c2-141/Bleco---Vente-de-mobilier-de-bureau-haut-de-gamme.aspx")||(window.location.href=="http://www.bleco.com/Front/c2-141/Bleco---Vente-de-mobilier-de-bureau-haut-de-gamme.aspx")||(window.location.href=="http://www.bleco.com/Front/Render.aspx")||(window.location.href=="http://www.bleco.com/Front/c2-141/Accueil.aspx")||(window.location.href=="http://www.bleco.be/Front/Render.aspx")||(window.location.href=="http://www.bleco.be/Front/c2-141/Accueil.aspx"))
	   ajout='b';
    document.body.style.backgroundImage='url(/images/fond'+id+ajout+taille+'.jpg)';
    document.getElementById('bt1').className='';
    document.getElementById('bt2').className='';
    document.getElementById('bt3').className='';
    document.getElementById('bt4').className='';
    document.getElementById('bt5').className='';
    document.getElementById('bt'+id).className='on';
    
}