
var Contents=new Array(50);
var OriginalLogoSize=0;
var RotateStep=0;

function XorCrypt(data,key)
{
	var result='';
	for(var i=0;i<data.length;i++)
		result+=String.fromCharCode(data.charCodeAt(i)^key.charCodeAt(i%key.length));
	return result;
}

function _E(data)
{
    window.location=XorCrypt(Base64Encoder.Decode(data),'Praestantia');
}

function AddContent(title)
{
	for(i=0;i<Contents.length;i+=2)
		if(Contents[i]==null)
		{
                        var div=getRefToDiv(title);
			Contents[i]=title;
			Contents[i+1]=div.innerHTML;
			//div.innerHTML='';
                        //div.style.visibility='collapse';
			break;
		}
}
function GetContent(title)
{	for(i=0;i<Contents.length;i+=2)
		if(Contents[i]==title)
			return Contents[i+1];	}

function Initialize()
{
	AddContent('Accueil');
	AddContent('Services');	
	AddContent('Compétences');	
	AddContent('Technologies');	
	AddContent('Références');	
	AddContent('RéférencesPlus');	
	AddContent('Contact');	
	getRefToDiv('CurrentContent').innerHTML=GetContent('Accueil');
	OriginalLogoSize=getRefToDiv('Logo').width;
}

function OnTimer()
{
	RotateLogo();
}

function MenuEntry(title)
{	document.write('<tr height=40><td align=center><div onmouseout="this.style.cursor=\'auto\';this.style.fontSize=\'\';" onmouseover="this.style.cursor=\'pointer\';this.style.fontSize=18;" onclick="getRefToDiv(\'CurrentContent\').innerHTML=GetContent(\''+title+'\');" class=MenuEntry>'+title+'</div></td></tr>'); }

function SetPageContent(html)
{	myReference=getRefToDiv('CurrentPage');
	myReference.innerHTML=html;	
}

var logo=null;
function RotateLogo()
{
        if(!logo)
          logo=getRefToDiv('Logo');
	if(logo.width<=0)
		RotateStep=3;
	else if(logo.width>=OriginalLogoSize)
		RotateStep=-3;
	logo.width+=RotateStep;
}

// LOW LEVEL FUNCTION (TOOLS) -----------------------------------------------------------------------------
function getRefToDiv(divID,oDoc) {
    if( !oDoc ) { oDoc = document; }
    if( document.layers ) {
        if( oDoc.layers[divID] ) { return oDoc.layers[divID]; } else {
            //repeatedly run through all child layers
            for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {
                //on success, return that layer, else return nothing
                y = getRefToDiv(divID,oDoc.layers[x].document); }
            return y; } }
    if( document.getElementById ) {
        return document.getElementById(divID); }
    if( document.all ) {
        return document.all[divID]; }
    return false;
}

