//determination taille ecran
var screenHeight = screen.height;
var screenWidth = screen.width;

//determination taille zone active
var liveScreenHeight = screen.availHeight;
var liveScreenWidth = screen.availWidth;

//marge si screen>1024
function findMargedPageWidth() {
	if (findLivePageWidth()>1024){
		var margedPageWidth = (findLivePageWidth()-1024)/2;
	}else{
		var margedPageWidth = 0;
	}
	if ((isIPHONE)||(isSAF)||(isPIKE)){var margedPageWidth = 0;} 

	return margedPageWidth;
}


//determination taille fenetre
function findLivePageHeight() {
	if (window.innerHeight != null)
		return window.innerHeight; 
	if (document.body.clientHeight != null)
		return document.body.clientHeight;
	return (null);
}
function findLivePageWidth() {
	if (window.innerWidth != null)
		return window.innerWidth;
	if (document.body.clientWidth != null)
		return document.body.clientWidth;
	return (null);
}
function pageHeight() {
	livePageHeight = findLivePageHeight();
	return livePageHeight;

}
function pageWidth() {
	livePageWidth = findLivePageWidth();
	return livePageWidth;
}

//fin de determination taille fenetre

//function de mise en page
function margeRightPageWidth() {
	
	
	if (isIE)	
	{ 
		mrpw=1;
	}
	else if (isLin)
	{
		if (isFF)	
		{ 
			$mrpw=12;
		}
		else 
		{
		mrpw=9;
		}
	}
	else 
	{ 
	mrpw=9;
	}
	
	var margeRightPageWidth=((liveScreenWidth-(liveScreenWidth-mrpw)));
	
	return margeRightPageWidth;
}


function styleCalque(idCalque)
{
  if (document.all) calqueStyle = document.all[idCalque].style;
  if (document.layers) calqueStyle = document.layers[idCalque];
  if (document.getElementById) calqueStyle = document.getElementById(idCalque).style;
  return calqueStyle;
}


function ecritCalque(idCalque,texte)
{
  if (document.all) document.all[idCalque].innerHTML = texte;
  if (document.layers) 
  {
    document.layers[idCalque].document.open();
    document.layers[idCalque].document.write(texte);
    document.layers[idCalque].document.close();
  }
  if (document.getElementById) 
  document.getElementById(idCalque).innerHTML = texte;
}

function creerCalque(idCalque,contenu,top,left,width,height,visibility)
{
  if (document.layers)
  {
    document.layers[idCalque] = new Layer(width);
    document.layers[idCalque].top = top;
    document.layers[idCalque].left =((liveScreenWidth - width)-((liveScreenWidth-findMargedPageWidth())-1024)) - 10;
    document.layers[idCalque].width = width;
    document.layers[idCalque].height = height;
    document.layers[idCalque].visibility = visibility;
    document.layers[idCalque].document.open();
    document.layers[idCalque].document.write(contenu);
    document.layers[idCalque].document.close();
  }
  else
  {

	//placement en fonction du bord à droite de l'ecran 
	//if (idCalque=="calqueDate")	{left = ((liveScreenWidth - width)-(liveScreenWidth-1024)) - 10;}
	if (idCalque=="calqueDate")	{left = ((liveScreenWidth - width)-((liveScreenWidth-findMargedPageWidth())-984));}
	
    strDiv = "<div id='"+idCalque+"' style='position:absolute;top:"+top+"px;left:"+left+"px;width:"+width+";height:"+height+";visibility:"+visibility+";z-index:2;'>"+contenu+"</div>";
    document.body.innerHTML = document.body.innerHTML + strDiv;
  }
}

function deplaceCalque(idCalque,posX,posY)
{
  calqueStyle = styleCalque(idCalque);
  calqueStyle.left = posX;
  calqueStyle.top = posY+9;
}
//scrollText

function deplaceCalqueDe(idCalque,stepX,stepY)
{
  calqueStyle = styleCalque(idCalque);
  calqueStyle.left = parseInt(calqueStyle.left) + stepX;
  calqueStyle.top = parseInt(calqueStyle.top) + stepY;
}
function defileCalqueMot(idCalque,clipTop,clipBottom,direction)
{

  pas = pas + (10*direction);
  
 if ((clipTop-pas>clipTop) && (clipTop-pas<clipBottom+pas))
 {
  
  deplaceCalqueDe(idCalque,0,(10*direction));
  if (document.layers)
  {
    styleCalque(idCalque).clip.top = clipTop - pas;
    styleCalque(idCalque).clip.bottom = clipBottom - pas;
  }
  else styleCalque(idCalque).clip = "rect("+(clipTop-pas)+",auto,"+(clipBottom-pas)+",auto)";
 }else{
  okDefile = 0;
}
 
  
  if (okDefile == 1) 
  setTimeout("defileCalqueMot('"+idCalque+"',"+clipTop+","+clipBottom+","+direction+")",100);
}
function defileCalque(idCalque,clipTop,clipBottom,direction)
{
  okDefile = 1;
  defileCalqueMot(idCalque,clipTop,clipBottom,direction);
}
function stopDefile()
{
  okDefile = 0;
}

okDefile = 0;
pas = 0;

//findClipObject



function clipObject(objectID, clipTop, clipRight, clipBottom, clipLeft) {
var dom = findDOM(objectID,1);
if (dom.clip.left) {
dom.clip.top = clipTop;
dom.clip.right = clipRight;
dom.clip.bottom = clipBottom;
dom.clip.left = clipLeft;
}
dom.clip = 'rect(' + clipTop + ' ' + clipRight + ' ' + clipBottom + ' ' + clipLeft +')';
}



//objet divers
function object(obj,classe,top,left,width,height)
{
creerCalque('calqueDate','',top,left,width,height,'visible');
obj(classe,width,height);
}
//background menu icon
function object1(obj,classe,top,left,width,height)
{
creerCalque('bgIconMenu','',top,left,width,height,'visible');
obj(classe,width,height);
}
//background menu principal
function object2(obj,classe,top,left,width,height)
{
creerCalque('bgMainMenu','',top,left,width,height,'visible');
obj(classe,top,left,width,height);
}
//background menu information
function object3(obj,classe,top,left,width,height)
{
creerCalque('bgInfoMenu','',top,left,width,height,'visible');
obj(classe,top,left,width,height);
}
//background menu option
function object4(obj,classe,top,left,width,height)
{
creerCalque('bgOptionMenu','',top,left,width,height,'visible');
obj(classe,top,left,width,height);
}

function bgScreenAlpha(classe,width,height)
{

 
  base = "<table cellspacing='0' cellpadding='0' border='0' width='100%' height='"+height+"'>		</tr><tr><td valign='top' height='1'><table cellspacing='0' cellpadding='0' border='0' width='130px' height='1px'><tr><td width='130' height='1' bgcolor='black'><? echo \"<img src='$dotpath/function/image.php?l=130&h=1&type=1&r=0&v=0&b=0&a=0' align='top'>\";?></td></tr></table></td></tr><tr><td align='center' class='"+classe+"' width='100%' height='100%' nowrap></td></tr><tr><td valign='top' height='1'><table cellspacing='0' cellpadding='0' border='0' width='130px' height='1px'><tr><td width='130' height='1' bgcolor='black'><? echo \"<img src='$dotpath/function/image.php?l=580&h=1&type=1&r=0&v=0&b=0&a=0' align='top'>\";?></td></tr></table></td></tr></td></tr></table>";

  ecritCalque("bgIconMenu",base);
    
}

function bgScreenAlpha2(classe,top,left,width,height)
{ 

 
  base = "<table cellspacing='0' cellpadding='0' border='0' width='100%' height='"+height+"'>		</tr><tr><td valign='top' height='1'><table cellspacing='0' cellpadding='0' border='0' width='580px' height='1px'><tr><td width='580' height='1' bgcolor='black'><? echo \"<img src='$dotpath/function/image.php?l=580&h=1&type=1&r=0&v=0&b=0&a=0' align='top'>\";?></td></tr></table></td></tr><tr><td align='center' class='"+classe+"' width='100%' height='100%' nowrap></td></tr><tr><td valign='top' height='1'><table cellspacing='0' cellpadding='0' border='0' width='580px' height='1px'><tr><td width='580' height='1' bgcolor='black'><? echo \"<img src='$dotpath/function/image.php?l=580&h=1&type=1&r=0&v=0&b=0&a=0' align='top'>\";?></td></tr></table></td></tr></td></tr></table>";

  ecritCalque("bgMainMenu",base);
    
}

function bgScreenAlpha3(classe,top,left,width,height)
{ 

 
  base = "<table cellspacing='0' cellpadding='0' border='0' width='100%' height='"+height+"'>		</tr><tr><td valign='top' height='1'><table cellspacing='0' cellpadding='0' border='0' width='130px' height='1px'><tr><td width='130' height='1' bgcolor='black'><? echo \"<img src='$dotpath/function/image.php?l=130&h=1&type=1&r=0&v=0&b=0&a=0' align='top'>\";?></td></tr></table></td></tr><tr><td align='center' class='"+classe+"' width='100%' height='100%' nowrap></td></tr><tr><td valign='top' height='1'><table cellspacing='0' cellpadding='0' border='0' width='130px' height='1px'><tr><td width='130' height='1' bgcolor='black'><? echo \"<img src='$dotpath/function/image.php?l=580&h=1&type=1&r=0&v=0&b=0&a=0' align='top'>\";?></td></tr></table></td></tr></td></tr></table>";

  ecritCalque("bgInfoMenu",base);
    
}

function bgScreenAlpha4(classe,top,left,width,height)
{ 

 
  base = "<table cellspacing='0' cellpadding='0' border='0' width='100%' height='"+height+"'>		</tr><tr><td valign='top' height='1'><table cellspacing='0' cellpadding='0' border='0' width='130px' height='1px'><tr><td width='130' height='1' bgcolor='black'><? echo \"<img src='$dotpath/function/image.php?l=130&h=1&type=1&r=0&v=0&b=0&a=0' align='top'>\";?></td></tr></table></td></tr><tr><td align='center' class='"+classe+"' width='100%' height='100%' nowrap></td></tr><tr><td valign='top' height='1'><table cellspacing='0' cellpadding='0' border='0' width='130px' height='1px'><tr><td width='130' height='1' bgcolor='black'><? echo \"<img src='$dotpath/function/image.php?l=580&h=1&type=1&r=0&v=0&b=0&a=0' align='top'>\";?></td></tr></table></td></tr></td></tr></table>";

  ecritCalque("bgOptionMenu",base);
    
}




function changeStyle(objectID,styleName,newVal) 
{
var dom = findDOM(objectID,1);
	dom [styleName] = newVal;
}


function setClass(objectID,newClass) {
var dom = findDOM(objectID,0);
	dom.className = newClass;
}

function changeStyleFrame(objectID,frameName,styleName,newVal) 
{
var domStyle = findDOMFrame(objectID,frameName,1);
	domStyle [styleName] = newVal;
}

function mouseOver(idlink,newColor){
changeStyle(idlink,'color',newColor);
}

function mouseOut(idlink,newColor){
changeStyle(idlink,'color',newColor);
}

function printit(){  
if (isNS) {
    window.print() ;  
} else {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    
	WebBrowser1.outerHTML = "";  
}
}


function description(texte) {
window.status = texte;
return true;
}
function effaceetat() {
window.status="";
}


function PopUp(url,name,t,l,w,h)
{
if (h="0")
 {
  if (isIE)	{ h = liveScreenHeight-46; }
  else		{ h = liveScreenHeight; }
 }

newWindow= window.open( url , name, 'toolbar=no, resizable=yes, menubar=no, scrollbars=yes, directories=no, status=yes, location=no, copyhistory=no, fullscreen=no, top= '+ t +', left='+ l +', width='+ w +', height='+ h +'');
newWindow.moveBy(-4,-4);
newWindow.focus()
}

function trembleFen(objWindow,nbre,dist)

{
  objWindowTremb = objWindow;
  objWindow.moveBy(dist,dist);
  dist = dist * -1;
  if (nbre!=-1) nbre = nbre - 1;
  if ((nbre>0)||(nbre==-1)) 
  setTimeout("trembleFen(objWindowTremb,"+nbre+","+dist+")",5);
}


function resize_frameset_interface_fillScreen()
{
  if (document.layers)
  {
    parent.document.open();
    parent.document.write('<frameset cols="*,1024,*" border="0"><frame name="blankLeft" src="blank.html" scroll="0" frameborder="0" border="0" scrolling="no"><frameset rows="24,*,0,12" border="0" id="frameSet"><frame name="menu" src="<?php echo"menu.php?opt=$opt&idPage=$idPage"; ?>" scroll="0" frameborder="0" border="0" scrolling="no"><frame name="content" src="<?php echo"$idPage.php?opt=$opt&idPage=$idPage"; ?>" scroll="0" frameborder="0" border="0" scrolling="no"><frame name="conf" src="<?php echo"conf.php?opt=$opt&idPage=$idPage"; ?>" scroll="0" frameborder="0" border="0" scrolling="no"><frame name="info" src="<?php echo"inf.php?opt=$opt"; ?>" scroll="0" frameborder="0" border="0" scrolling="no"></frameset><frame name="blankRight" src="blank.html" scroll="0" frameborder="0" border="0" scrolling="no"></frameset>');
    parent.document.close();
  }
  if (document.all)
  {
    parent.document.all["frameSet"].rows = "20,*,0,12";
  }
  if (document.getElementById)
  {
    parent.document.getElementById("frameSet").rows = "24,*,0,12";
  }

}
function resize_frameset_interface_default()
{
  if (document.layers)
  {
    parent.document.open();
    parent.document.write('<frameset cols="*,1024,*" border="0"><frame name="blankLeft" src="blank.html" scroll="0" frameborder="0" border="0" scrolling="no"><frameset rows="*,342,106,12" border="0" id="frameSet"><frame name="menu" src="<?php echo"menu.php?opt=$opt&idPage=$idPage"; ?>" scroll="0" frameborder="0" border="0" scrolling="no"><frame name="content" src="<?php echo"$idPage.php?opt=$opt&idPage=$idPage"; ?>" scroll="0" frameborder="0" border="0" scrolling="no"><frame name="conf" src="<?php echo"conf.php?opt=$opt&idPage=$idPage"; ?>" scroll="0" frameborder="0" border="0" scrolling="no"><frame name="info" src="<?php echo"inf.php?opt=$opt"; ?>" scroll="0" frameborder="0" border="0" scrolling="no"></frameset><frame name="blankRight" src="blank.html" scroll="0" frameborder="0" border="0" scrolling="no"></frameset>');
    parent.document.close();
  }
  if (document.all)
  {
    parent.document.all["frameSet"].rows = "*,342,106,12";
  }
  if (document.getElementById)
  {
    parent.document.getElementById("frameSet").rows = "*,342,106,12";
  }
}






function verify()
{ 	
	msgFR = "Etes-vous sur de vouloir supprimer cette entrée?";
	msgIT = "Conferma l'eliminazioni di questi dati?";
	if (isFR)
	return confirm(msgFR);
	else
	return confirm(msgIT);
}



//diaporama
var counterDiapo ;
var tableImages ;
counterDiapo  = 0;

function changeImage(nomIm,src)
{
  document.images[nomIm].src = src;
}

function diaporama(nomImage,tabImage)
{
  counterDiapo++;
  tableImages = tabImage;
  if (counterDiapo  == tableImages.length) counterDiapo  = 0;
  changeImage(nomImage ,tableImages[counterDiapo].src);
  setTimeout("diaporama('" + nomImage + "',tableImages)",4000);
}



function aleatoire(valeur1,valeur2)
{
  if (valeur2-valeur1 < 0) return 0;
  chiffre = Math.random();
  chiffre = (chiffre * (valeur2 - valeur1)) + valeur1;
  chiffre = Math.round(chiffre);
  return chiffre;
}



function click(e) {
if (document.all) {
if (event.button==2||event.button==3) {
window.status="w  w  w  .  3  w  v  i  s  i  o  n .  n  e  t";

return false;
}
}
if (document.layers) {
if (e.which == 3) {
window.status="w  w  w  .  3  w  v  i  s  i  o  n .  n  e  t";
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;



var domStyle = null;

function pickIt(evt) {
	if (isLayers) {
		var testObject;
		var xPos = evt.pageX;
		var yPos = evt.pageY;
		// Sous Netscape, cycle dans les calques à afficher
		// si le pointeur de la souris se trouve sur l'un d'eux
		for (var i = document.layers.length - 1; i >= 0; i--) {
 			testObject = document.layers[i]
			if ((xPos > testObject.left) &&
			(xPos < testObject.left + testObject.clip.width) &&
			(yPos > testObject.top) &&
			(yPos < testObject.top + testObject.clip.height)) {
				domStyle = testObject;
			}
		}
	} 
	else {
		// accède à l'élément qui génère
		// l'événement et récupère le nom de l'ID
		objectID = event.srcElement.id;
		// vérifie qu'il s'agit de l'un des aimants
		if (objectID.indexOf('menu') != -1){
			domStyle = findDOM(objectID,1);
		}
	}
	if (domStyle) { 
		domStyle.zIndex = 1000;
		return false;
	}
	else {
		domStyle = null;
		return;
	}
}

function dragIt(evt) {
	if (domStyle) {
		if (isLayers) {
			domStyle.left = evt.pageX-20;
			domStyle.top = evt.pageY-20;
		} 
 		else {
			domStyle.left = window.event.x-20;
			domStyle.top = window.event.y-20;
      }
   }
}

function dropIt() {
	if (domStyle) {	
		domStyle.zIndex = 101;
		domStyle = null;
	}
}

function defaultEvents() { 
 	if (isLayers) {
 	//Donne à Navigator 4 une capture événementielle globale
 	      document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
 	}
 	if (isDHTML){
 	//Configure la capture événementielle dans Navigator 4 et Internet Explorer 4 
	document.onmousedown = pickIt;
	document.onmousemove = dragIt;
	document.onmouseup = dropIt;
	}
}











//rollOver

Fig=new Array();
Browser=0;
FigNumero=0;
Source=0;
actuel=' ';
function Figpreload(Numero,NomFichier)
{if (Browser)
{Fig[FigNumero]=new Array(4);
Fig[FigNumero][0]=new Image();
Fig[FigNumero][0].src= NomFichier+".jpg";
Fig[FigNumero][1]=new Image();
Fig[FigNumero][1].src= NomFichier+"_2.jpg";
Fig[FigNumero][2]=new Image();
Fig[FigNumero][2].src= NomFichier+"_3.jpg";
Fig[FigNumero][3]=Numero;
FigNumero ++;
}}
function on(actuel)
{if (Browser)
{for (var i = 0; i <= FigNumero; i++)
{if (Fig[i][3]==actuel)
{document.images[Fig[Source][3]].src = Fig[i][1].src;
Source=i;
i=FigNumero;
}}}}
function off()
{if (Browser)
{document.images[Fig[Source][3]].src = Fig[Source][0].src;
}}
function click(actuel)
{if (Browser)
{for (var i = 0; i <= FigNumero; i++)
{if (Fig[i][3]==actuel)
{if (navigator.appName!="Netscape")
{document.anchors(Fig[i][3]).blur();}
document.images[Fig[i][3]].src=Fig[i][2].src;
t=setTimeout('off()', 500);
Source=i; i=FigNumero;
if (actuel=='Fig1')
{window.location="http://www.3wsk8.com";}
}}}}
Figpreload ("Fig1","../image/3wv100x34x72");
