var topMargin = 10; var originalY = -1; var slideTime = 200; var ns6 = (!document.all && document.getElementById); var ie4 = (document.all); var ns4 = (document.layers); window.setInterval("main()", 10); function getScrollTop() { if (window.pageYOffset) { return window.pageYOffset; } else if (document.documentElement && document.documentElement.scrollTop) { return document.documentElement.scrollTop; } else if (document.body) { return document.body.scrollTop } return 0; } function getClientWidth() { if (window.innerWidth) { theWidth = window.innerWidth; } else if (document.documentElement && document.documentElement.clientWidth) { theWidth = document.documentElement.clientWidth; } else if (document.body) { theWidth = document.body.clientWidth; } } function floatObject() { if (ns4 || ns6) { findHt = getClientWidth(); } else if(ie4) { findHt = getClientWidth(); } } function main() { if (ns4) { this.currentY = document.sky.top; this.scrollTop = getScrollTop(); if (this.originalY <= 0) { this.originalY = getLayerY(sky); } mainTrigger(); } else if(ns6) { this.currentY = (document.getElementById('sky').style.top == "" ? 0 : parseInt(document.getElementById('sky').style.top)); this.scrollTop = getScrollTop(); if (this.originalY <= 0) { this.originalY = getLayerY(document.getElementById('sky')); } mainTrigger(); } else if(ie4) { this.currentY = sky.style.pixelTop; this.scrollTop = getScrollTop(); if (this.originalY <= 0) { this.originalY = getLayerY(sky); } mainTrigger(); } } function mainTrigger() { var newTargetY = 0; if (this.scrollTop > this.originalY) newTargetY = this.scrollTop + this.topMargin - this.originalY; if ( this.currentY != newTargetY ) { if ( newTargetY != this.targetY ) { this.targetY = newTargetY floatStart(); } animator(); } } function floatStart() { var now = new Date() this.A = this.targetY - this.currentY this.B = Math.PI / ( 2 * this.slideTime ) this.C = now.getTime() if (Math.abs(this.A) > this.findHt) { this.D = this.A > 0 ? this.targetY - this.findHt : this.targetY + this.findHt this.A = this.A > 0 ? this.findHt : -this.findHt } else { this.D = this.currentY } } function animator() { var now = new Date() var newY = this.A * Math.sin( this.B * ( now.getTime() - this.C ) ) + this.D newY = Math.round(newY) if (( this.A > 0 && newY > this.currentY ) || ( this.A < 0 && newY < this.currentY )) { if ( ie4 )sky.style.pixelTop = newY if ( ns4 )document.sky.top = newY if ( ns6 )document.getElementById('sky').style.top = newY + "px"; } } function getLayerY(obj) { var curtop = 0; if (obj.offsetParent) { while (obj.offsetParent) { curtop += obj.offsetTop obj = obj.offsetParent; } } else if (obj.y) curtop += obj.y; return curtop; } var info = null; var bBoucle = true; var nim = new Number(-1); var nimurl= new Number(0); var plv = new Number(10000); function ow(theURL,larg,haut) { larg = Math.ceil(screen.width * (larg/100)*(1024/screen.width)); if(larg > screen.width) {larg = Math.ceil(larg*(95/100));} haut = Math.ceil(screen.height * (haut/100)); if (info) { info.close(); info = window.open(theURL,"info","scrollbars=yes,menubar=yes,resizable=yes,width="+ larg +"px,height="+ haut +"px,outerwidth="+ larg +"px,outerheight="+ haut +"px,top=5,left=5,screenX=5,screenY=5"); info.focus(); } else { info = window.open(theURL,"info","scrollbars=yes,menubar=yes,resizable=yes,width="+ larg +"px,height="+ haut +"px,outerwidth="+ larg +"px,outerheight="+ haut +"px,top=5,left=5,screenX=5,screenY=5"); info.focus(); } } //--- Partie Panorama d'images ----------------------------------------------- var imge=new Array(); imge[0]="valid-rss.png"; imge[1]="valid-atom.png"; imge[2]="logosifel100x37-blanc.gif"; var imgname=new Array(); imgname[0]="images/"+imge[0]; imgname[1]="images/"+imge[1]; imgname[2]="images/"+imge[2]; var imgpreload=new Array(); for (i=0;i<=imgname.length-1;i++) { imgpreload[i]=new Image(); imgpreload[i].src=imgname[i]; } var imgurl=new Array(); imgurl[0]="http://www.moroccontact.com"; imgurl[1]="http://www.moroccontact.com"; imgurl[2]="http://www.sifel.com"; var imgdest=new Array(); imgdest[0]="popup"; imgdest[1]="popup"; imgdest[2]="self"; //------- arrêt function stopvaa() { bBoucle = false; nim=0 } //------départ----------- function runvaa(nim) { bBoucle = true; } //------- Changement image : images[0] implique ce soit la 1ère de la page, à changer sinon----------------- function changeImg(nim) { nimurl=nim; document.images[0].src = imgname[nim]; } function runurl(nim) { nim=nimurl; // si le paramètre self a été entré dans les données imgdest -> remplacement document courant if ( imgdest[nim] == "self" ) { document.location.href = imgurl[nim]; if (info) { info.close(); } } else { // si none on ne fait rien if ( imgdest[nim] == "none" ) { void(0); } // sinon on ouvre en 75% de large, 65% de haut else { ow(imgurl[nim],75,65); } } } // fonction plus vite - moins vite function pvite(pmv) { if (pmv == 0) { plv = (plv + 2000); alert((10-plv/1000)/2);} else { if (plv > 1000) {plv = (plv - 2000); pmv = 1;} else {void(0);} alert((10-plv/1000)/2); } } // Initiate, en fait la fonction de rotation des images. function initiate() { // incrémentation du numéro d'image nim++; if (nim>imgname.length-1) { nim=0; } if (bBoucle) { // commande de changement d'image changeImg(nim); } if (bBoucle) { // relance après un certain temps setTimeout("initiate()",plv); } // mise à jour de l'affichage du nom actualise_nomimage(); } function actualise_nomimage() { document.forms[0].elements[0].value = nim + 1; document.forms[0].elements[1].value=imge[nim]; } // JavaScript Document //document.write('
')