// JavaScript Document

var windowOnLoad = new Array();

init = function(){
	for(var i = 0; i < windowOnLoad.length; i++)
	{ 
		windowOnLoad[i]();
	}
}


caleFooter = function() {
	
	if(window.innerHeight && document.getElementById)
	{
		var margeBas = window.innerHeight - document.getElementById("page").clientHeight;
		
		if(margeBas > 0)
		{
			var centre = document.getElementById("centre");
			if(centre) centre.style.height = (centre.clientHeight + margeBas) + "px";
		}
	}
}


afficheBordures = function()
{var name = navigator.appName;
if(name=="Microsoft Internet Explorer"){

	if(document.getElementById("main"))
	{
		var main = document.getElementById("main");	
		var mainW = main.clientWidth - main.offsetParent.style.paddingLeft;
		var mainH = main.clientHeight - main.offsetParent.style.paddingTop;
		var w = (mainW + 27);
		var h = (mainH + 27);
	/*	var top = main.offsetTop - 16;
		var left = main.offsetLeft - 12;*/
		var top = 94;
		var left = 208;

		/*var bordures = document.createElement("div");
		bordures.id = "bordures";
		bordures.style.width = w + "px";
		bordures.style.height = h + "px";
		bordures.style.top = (main.offsetTop - 12)+"px";
		bordures.style.left = (main.offsetLeft - 12)+"px";*/
		var bordures = document.body;
		
		var bordH = document.getElementById("bordH") ? document.getElementById("bordH") : document.createElement("div");	
		bordH.id = "bordH";
		bordH.className = "bordurePng";
		bordH.style.top = top+4+"px";
		/*bordH.style.left = (main.offsetLeft+8)+"px";*/
		bordH.style.left = (left+20)+"px";
		bordH.style.backgroundPosition="right";
		bordH.style.width = (main.clientWidth) + "px";
		bordH.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'http://www.vahine.fr/fileadmin/template/images/bord_haut.png\',sizingMethod=\'scale\')";
		bordures.appendChild(bordH);


		var cBordH =document.getElementById("cBordH") ? document.getElementById("cBordH") : document.createElement("div");
		cBordH.id = "cBordH";
		cBordH.className = "bordurePng";
		cBordH.style.top = top+4+"px";
		cBordH.style.left = left+"px";
		cBordH.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'http://www.vahine.fr/fileadmin/template/images/coin_bord_haut.png\',sizingMethod=\'scale\')";
		bordures.appendChild(cBordH);
		
		var bordB =document.getElementById("bordB") ? document.getElementById("bordB") : document.createElement("div");
		bordB.id = "bordB";
		bordB.className = "bordurePng";
		bordB.style.top = (top + h - 11)+"px";
		/*bordB.style.left = (main.offsetLeft-11)+"px";*/
		bordB.style.left = (left+1)+"px";
		bordB.style.width=(main.clientWidth-5)+"px";
		bordB.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'http://www.vahine.fr/fileadmin/template/images/bord_bas.png\',sizingMethod=\'scale\')";
		bordures.appendChild(bordB);
		
		var cBordB = document.getElementById("cBordB") ? document.getElementById("cBordB") :document.createElement("div");
		cBordB.id = "cBordB";
		cBordB.className = "bordurePng";
		cBordB.style.top = (top + h - 11)+"px";
		cBordB.style.left = (left + w - 31)+"px";
		cBordB.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'http://www.vahine.fr/fileadmin/template/images/coin_bord_bas.png\',sizingMethod=\'scale\')";
		bordures.appendChild(cBordB);
		
		var bordG =document.getElementById("bordG") ? document.getElementById("bordG") : document.createElement("div");
		bordG.id = "bordG";
		bordG.className = "bordurePng";
		bordG.style.top = (top + 12)+"px";
		bordG.style.left = left+"px";
		bordG.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'http://www.vahine.fr/fileadmin/template/images/bord_gauche.png\',sizingMethod=\'scale\')";
		bordures.appendChild(bordG);
		
		var bordD = document.getElementById("bordD") ? document.getElementById("bordD") :document.createElement("div");
		bordD.id = "bordD";
		bordD.className = "bordurePng";
		bordD.style.top = (top + h - 11 - 420)+"px";
		bordD.style.left = (left + w - 15)+"px";
		bordD.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'http://www.vahine.fr/fileadmin/template/images/bord_droit.png\',sizingMethod=\'scale\')";
		bordures.appendChild(bordD);
/*
		if(w > 572)
		{
			var fBordH = document.createElement("div");
			fBordH.id = "fBordH";
			fBordH.className = "bordurePng";
			fBordH.style.width = (w - 572) + "px";
			fBordH.style.top = top+"px";
			fBordH.style.left = (left + 20)+"px";
			bordures.appendChild(fBordH);
		}

		if(w > 574)
		{
			var fBordB = document.createElement("div");
			fBordB.id = "fBordB";
			fBordB.className = "bordurePng";
			fBordB.style.width = (w - 574) + "px";
			fBordB.style.top = (top + h - 15)+"px";
			fBordB.style.left = (left + 543)+"px";
			bordures.appendChild(fBordB);
		}*/
		
		if(h > 390)
		{
			var fBordG = document.getElementById("fBordG") ? document.getElementById("fBordG") :document.createElement("div");
			fBordG.id = "fBordG";
			fBordG.className = "bordurePng";
			fBordG.style.height = (h - 413) + "px";
			fBordG.style.top = (top+402)+"px";
			fBordG.style.left = left+"px";
			fBordG.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'http://www.vahine.fr/fileadmin/template/images/fond_bord_gauche.png\',sizingMethod=\'scale\')";
			bordures.appendChild(fBordG);
		}
		
		if(main.clientHeight>420)
		{
			var fBordD = document.getElementById("fBordD") ? document.getElementById("fBordD") :document.createElement("div");
			fBordD.id = "fBordD";
			fBordD.className = "bordurePng";
			fBordD.style.height = (h - 447) + "px";
			fBordD.style.top = (top+16)+"px";
			fBordD.style.left = (left + w - 15)+"px";
			fBordD.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'http://www.vahine.fr/fileadmin/template/images/fond_bord_droit.png\',sizingMethod=\'scale\')";
			bordures.appendChild(fBordD);
		}

		//document.body.appendChild(bordures);
	}
   }
   else{

	if(document.getElementById("main"))
	{
		var main = document.getElementById("main");
	
		var mainW = main.clientWidth - main.offsetParent.style.paddingLeft;
		var mainH = main.clientHeight - main.offsetParent.style.paddingTop;
		var w = (mainW + 27);
		var h = (mainH + 27);
		var top = main.offsetTop - 12;
		var left = main.offsetLeft - 12;

		/*var bordures = document.createElement("div");
		bordures.id = "bordures";
		bordures.style.width = w + "px";
		bordures.style.height = h + "px";
		bordures.style.top = (main.offsetTop - 12)+"px";
		bordures.style.left = (main.offsetLeft - 12)+"px";*/
		var bordures = document.body;
		
		var bordH = document.getElementById("bordH") ? document.getElementById("bordH") : document.createElement("div");	
		bordH.id = "bordH";
		bordH.className = "bordurePng";
		bordH.style.top = top+"px";
		bordH.style.left = (main.offsetLeft+8)+"px";
		bordH.style.backgroundPosition="right";
		bordH.style.width = (main.clientWidth) + "px";
		bordures.appendChild(bordH);


		var cBordH =document.getElementById("cBordH") ? document.getElementById("cBordH") : document.createElement("div");
		cBordH.id = "cBordH";
		cBordH.className = "bordurePng";
		cBordH.style.top = top+"px";
		cBordH.style.left = left+"px";
		bordures.appendChild(cBordH);
		
		var bordB =document.getElementById("bordB") ? document.getElementById("bordB") : document.createElement("div");
		bordB.id = "bordB";
		bordB.className = "bordurePng";
		bordB.style.top = (top + h - 15)+"px";
		bordB.style.left = (main.offsetLeft-15)+"px";
		bordB.style.width=(main.clientWidth-1)+"px";
		bordures.appendChild(bordB);
		
		var cBordB = document.getElementById("cBordB") ? document.getElementById("cBordB") :document.createElement("div");
		cBordB.id = "cBordB";
		cBordB.className = "bordurePng";
		cBordB.style.top = (top + h - 15)+"px";
		cBordB.style.left = (left + w - 31)+"px";
		bordures.appendChild(cBordB);
		
		var bordG =document.getElementById("bordG") ? document.getElementById("bordG") : document.createElement("div");
		bordG.id = "bordG";
		bordG.className = "bordurePng";
		bordG.style.top = (top + 12)+"px";
		bordG.style.left = left+"px";
		bordures.appendChild(bordG);
		
		var bordD = document.getElementById("bordD") ? document.getElementById("bordD") :document.createElement("div");
		bordD.id = "bordD";
		bordD.className = "bordurePng";
		bordD.style.top = (top + h - 15 - 420)+"px";
		bordD.style.left = (left + w - 15)+"px";
		bordures.appendChild(bordD);
/*
		if(w > 572)
		{
			var fBordH = document.createElement("div");
			fBordH.id = "fBordH";
			fBordH.className = "bordurePng";
			fBordH.style.width = (w - 572) + "px";
			fBordH.style.top = top+"px";
			fBordH.style.left = (left + 20)+"px";
			bordures.appendChild(fBordH);
		}

		if(w > 574)
		{
			var fBordB = document.createElement("div");
			fBordB.id = "fBordB";
			fBordB.className = "bordurePng";
			fBordB.style.width = (w - 574) + "px";
			fBordB.style.top = (top + h - 15)+"px";
			fBordB.style.left = (left + 543)+"px";
			bordures.appendChild(fBordB);
		}*/
		
		if(h > 390)
		{
			var fBordG = document.getElementById("fBordG") ? document.getElementById("fBordG") :document.createElement("div");
			fBordG.id = "fBordG";
			fBordG.className = "bordurePng";
			fBordG.style.height = (h - 417) + "px";
			fBordG.style.top = (top+402)+"px";
			fBordG.style.left = left+"px";
			bordures.appendChild(fBordG);
		}
		
		if(h > 420)
		{
			var fBordD = document.getElementById("fBordD") ? document.getElementById("fBordD") :document.createElement("div");
			fBordD.id = "fBordD";
			fBordD.className = "bordurePng";
			fBordD.style.height = (h - 447) + "px";
			fBordD.style.top = (top+12)+"px";
			fBordD.style.left = (left + w - 15)+"px";
			bordures.appendChild(fBordD);
		}

		
		//document.body.appendChild(bordures);
	}}

	
}

ssmenuDossier = function(){

	var ssmenu = document.getElementById('menudossier');
	if(ssmenu)
	{
		if(ssmenu.className=='right nomargin'){
			var onglet = ssmenu.getElementsByTagName('li');
			if(onglet.length <4){
				ssmenu.className="ssmenu_court";
				}
				
			if(onglet.length ==4){
				ssmenu.className="ssmenu_court2";
				}
			
	
		}
      var liens = ssmenu.getElementsByTagName('a');
      
      for (i=0;i<liens.length;i++)
      {
        if (liens[i].href.search('forum') != -1) {
          liens[i].onclick = function () {
            // height=1024, width=768, top=100, left=100,
            window.open(this.href, '', 'toolbar=no, menubar=yes, location=no, resizable=yes, scrollbars=yes, status=yes, fullscreen=yes');
            return false;
          }
          liens[i].target = '_blank';
        }
      } 
    }
}


window.onload = init;

//window.onresize = caleFooter;
//windowOnLoad.push(caleFooter);
windowOnLoad.push(afficheBordures);
windowOnLoad.push(ssmenuDossier);

