var isKonqueror   = (navigator.appName=="Konqueror");
var isWanadooNav  = (navigator.appVersion.indexOf("NaviWoo") > -1);
var isInternetExplorer = (navigator.appName.indexOf( "Microsoft" ) > -1);
var aFlashElement  = new Array();    
var nDownloadImgTimeout = 50;      
var nFaddingIntrvl  = 1;          
var nFaddingImg   = 25;          
var nFaddingTime  = 1000 * nFaddingIntrvl / nFaddingImg;  
var nFaddingStep  = 100 / nFaddingImg;      
var sTrace    = "";
var bStreamViewer  = null;
var nWindowMinWidth  = 880;   
var nWindowMaxWidth  = 990;   
var nNavWidth   = 150;   
var nBordureWidth  = 12;   
var nCarrePubWidth  = 300;   
var sManchetteMinWidth = "280";  
var sManchetteMaxWidth = "349";  
var sManchetteMinHeight = "199";  
var sManchetteMaxHeight = "250";  
var nInfoSpeed   = 2;   
var nInfoMinSpeed  = 2;   
var nInfoMaxSpeed  = 14;   
var nTimeForNextSequence = 15;   
var bFixedOrder   = false;
var nHeadlineHeight  = 23;   
var nImgSequenceId  = 0;   
var bInitManchette  = false;  
var oDisplayGrid = null;    
window.onresize = function() {
try { oDisplayGrid.resize(); } catch(e) {}
try { manchetteResize();} catch (e) { }
try {
var screenPlayer = o_hGetById("ScreenPlayer").component;           
screenPlayer.aSequence[screenPlayer.nCurrentSequence].hImg.resize();
} catch (e) { }
try { flashResize2();         } catch(e) { }
}
window.onload = function Window_onLoad() { 
try{
window.onresize();
if (o_hGetById('rech')) o_hGetById('rech').focus();
if (window.bActivMonitoring) profilerData.postData(); 
putTime();
} catch(e) {}       
}
function manchetteResize(){
try{
if (document.body.clientWidth > 993){
o_hGetById("o_manchette").style.width = sManchetteMaxWidth; 
o_hGetById("o_manchette").style.height = sManchetteMaxHeight; 
o_hGetById("o_manchette").parentNode.style.width = o_hGetById("o_manchette").style.width;
o_hGetById('o_infos').style.height = "90px"; 
if (document.body.clientWidth > 1004){ 
o_hGetById('infoDepecheCote').style.width = "179"; 
o_hGetById('infoDepecheCote').style.pixelwidth = "179"; 
if (o_hGetById('btnInfo')) o_hGetById('btnInfo').style.marginLeft = "149";
} else { 
var nInfoWidth = 991 - nNavWidth - nBordureWidth - nCarrePubWidth - sManchetteMaxWidth; 
o_hGetById('infoDepecheCote').style.width = nInfoWidth+"px"; 
o_hGetById('infoDepecheCote').style.pixelwidth = nInfoWidth+"px"; 
if (o_hGetById('btnInfo')) o_hGetById('btnInfo').style.marginLeft = (nInfoWidth-30) + "px";
} 
o_hGetById('infoVilleCote').style.display = ""; 
o_hGetById('infosDepecheBas').style.display = "none"; 
} else { 
o_hGetById("o_manchette").style.width = sManchetteMinWidth; 
o_hGetById("o_manchette").style.height = sManchetteMinHeight; 
o_hGetById("o_manchette").parentNode.style.width = o_hGetById("o_manchette").style.width;
o_hGetById('o_infos').style.height = "125px"; 
if (document.body.clientWidth < 880){ 
o_hGetById('infoDepecheCote').style.width = "138px"; 
o_hGetById('infoDepecheCote').style.pixelwidth = "138px"; 
if (o_hGetById('btnInfo')) o_hGetById('btnInfo').style.marginLeft = "108px";
} else { 
var nInfoWidth = document.body.clientWidth - nNavWidth - nBordureWidth - nCarrePubWidth - sManchetteMinWidth;
o_hGetById('infoDepecheCote').style.width = nInfoWidth+"px"; 
o_hGetById('infoDepecheCote').style.pixelwidth = nInfoWidth+"px"; 
if (o_hGetById('btnInfo')) o_hGetById('btnInfo').style.marginLeft = (nInfoWidth-30) + "px";
} 
o_hGetById('infoVilleCote').style.display = "none"; 
o_hGetById('infosDepecheBas').style.display = ""; 
} 
o_hGetById('infoDepecheCote').style.visibility = "";
return true;
} catch(e) {}
}
function flashResize2(){
try{
for (var i = 0; i < aFlashElement.length; i++){
var iFlash    = aFlashElement[i][0]; 
var nNbCol    = aFlashElement[i][1]; 
var nRatioWidthHeight = aFlashElement[i][2]; 
if ( o_hGetById(iFlash) ){
var nGridWidth = (document.body.clientWidth - nNavWidth ) * nNbCol / oDisplayGrid.nCellsPerLine;
nGridWidth = Math.max( nGridWidth , (nWindowMinWidth - nNavWidth) * nNbCol / oDisplayGrid.nCellsPerLine);
nGridWidth = Math.min( nGridWidth , (nWindowMaxWidth - nNavWidth ) * nNbCol / oDisplayGrid.nCellsPerLine);
nGridWidth -= 12;
if ( ! document.all ){
var hEmbedNode = o_hGetById(iFlash).getElementsByTagName("embed")[0];
hEmbedNode.width = nGridWidth;
hEmbedNode.height = nGridWidth * nRatioWidthHeight;
} else {
o_hGetById(iFlash).width = nGridWidth;
o_hGetById(iFlash).height = nGridWidth * nRatioWidthHeight;
}
}
}
return true;
} catch (e) {}
}
function changeAllLinks(iBalise) {
try {
var grilleStart = 0;
var rStartNode = window.document;
if ( iBalise !=  null) rStartNode = document.getElementById(iBalise);
scanTreeForChangeUrls( rStartNode, null );                     
for( var i=0; i<oScreenPlayer.aSequence.length; i++ ) {   
var sequenceNode = oScreenPlayer.aSequence[i].hDiv;
scanTreeForChangeUrls( sequenceNode, null );
}
return true;
} 
catch( exception ) { }
}
function scanTreeForChangeUrls( o_rNode, hasAddRef ) {
try{
if (o_rNode == null || typeof(o_rNode) != "object") return;                                               
try {
if (o_rNode.addRef) hasAddRef = o_rNode.addRef;              
else if (o_rNode.attributes && o_rNode.attributes["addRef"]) hasAddRef = o_rNode.attributes["addRef"].value;   
} catch( e ) { }
if ( o_rNode.childNodes ) {  
for(var i=0; i<o_rNode.childNodes.length; i++) 
{ scanTreeForChangeUrls( o_rNode.childNodes[i], hasAddRef ); }
}
var goodUrlReferrer = (hasAddRef==null ? sUrlReferrer : sUrlReferrer + "_" + hasAddRef);              
if (o_rNode.tagName == null) return;
if (window.bActivMonitoring == true) {
if (o_rNode.tagName.toUpperCase() == "A" && o_rNode.href) {                                               
if (! o_rNode.attributes["notChanged"]) o_rNode.href = changeOneUrl( o_rNode.href, goodUrlReferrer );
profilerData.addLnk( o_rNode );
} else if (o_rNode.tagName.toUpperCase() == "FORM" && o_rNode.action) {                                   
if (! o_rNode.attributes["notChanged"]) o_rNode.action = changeOneUrl( o_rNode.action, goodUrlReferrer );
} else if (o_rNode.tagName.toUpperCase() == "IMG") {
profilerData.addImg( o_rNode );
} else if (o_rNode.tagName.toUpperCase() == "SCRIPT") {
profilerData.addScript( o_rNode );
} else if (o_rNode.tagName.toUpperCase() == "LINK") {
profilerData.addStyle( o_rNode );
} else if (o_rNode.tagName.toUpperCase() == "EMBED") {
profilerData.addEmbed( o_rNode );
}        
} else {
if (o_rNode.tagName.toUpperCase() == "A" && o_rNode.href) {                                               
if (! o_rNode.attributes["notChanged"]) o_rNode.href = changeOneUrl( o_rNode.href, goodUrlReferrer );
} else if (o_rNode.tagName.toUpperCase() == "FORM" && o_rNode.action) {                                   
if (! o_rNode.attributes["notChanged"]) o_rNode.action = changeOneUrl( o_rNode.action, goodUrlReferrer );
}
}
return true;
} catch (e) {}
}
function changeOneUrl(sUrl,sUrlRef){
try { 
var sOldUrl = sUrl, sRef = "";
var sFrameCgiUrl = "http://www.orange.fr/bin/frame.cgi?url="; 
if ( (sUrl.substring(0,sFrameCgiUrl.length) != sFrameCgiUrl) && (sUrl.indexOf("http://r.orange.fr") == -1) && (sUrl.indexOf(".orange.fr") > 0 || sUrl.indexOf(".wanadoo.fr") > 0) && (sUrl.indexOf("http://externe") ==-1) && (sUrl.indexOf("http://www.orange.fr") ==-1) && (sUrl.indexOf(".orange.fr") ==-1) && (sUrl.indexOf(".dev.orange.fr") ==-1)){ 
sUrl = sFrameCgiUrl + escape(sUrl);
}
var sAddRef = o_sExtractVar('addRef',sUrl);
if (sAddRef != null){
sUrlRef = sUrlReferrer + "_" + sAddRef;
nAddRefPos = sUrl.indexOf('addRef');
sUrl = sUrl.substring(0,nAddRefPos-1); 
}
if (sUrl.substring(0, 20) == "http://r.orange.fr/r") { 
if (sUrl.indexOf('ref=') == -1){
var nPosInterrogation = sUrl.indexOf("?");
if (nPosInterrogation > -1) sUrl = sUrl.substring(0, nPosInterrogation+1) + "ref=" + sUrlRef + "&" + sUrl.substring(nPosInterrogation+1, sUrl.length);
else sUrl += "?ref=" + sUrlRef;
}
} else if (sUrl.indexOf('wanadooregie') != -1) {
} else if (sUrl.indexOf('externe.shopping.orange.fr') != -1  || sUrl.indexOf('ads-click') != -1 || sUrl.indexOf('doubleclick') != -1 ||  sUrl.indexOf('fluxlc') != -1 ||  sUrl.indexOf('fluxlr') != -1 ||  sUrl.indexOf('mediaplex') != -1) {
var nPosRef = sUrl.indexOf("?ref=");
if (nPosRef > -1) {
var sRef = escape(sUrl.substring(nPosRef+1, sUrl.length));
sUrl = escape(sUrl.substring(0, nPosRef));
sUrl = "http://r.orange.fr/r?" + sRef + "&url=" + sUrl;
} else {
var sOldUrl = escape( sUrl );
sUrl = "http://r.orange.fr/r?ref=" + sUrlRef + "&url=" + sOldUrl;
}
} else {
var nPosRef = sUrl.indexOf("?ref=");
if (nPosRef > -1) {
var sRef = escape(sUrl.substring(nPosRef+1, sUrl.length));
sUrl = escape(sUrl.substring(0, nPosRef));
} else {
var sOldUrl = escape(sUrl);
if ((sUrl.indexOf("javascript") ==-1)) sUrl = "http://r.orange.fr/r?ref=" + sUrlRef + "&url=" + sOldUrl;
}
}
return sUrl; 
} catch(e) { return sOldUrl; } 
}
function globalTimeoutExpired() {
try{ 
var aDocImage = window.document.images; 
for( var i = 0; i<aDocImage.length; i++ ) {
var hImg = aDocImage[i];
if (  hImg.complete == false ) {
stopDownloadTimer(hImg);  
}
}
return true;
} catch (e){}
}
function stopDownloadTimer(hImg) {
try{
if ( hImg.complete == false ){
if (hImg.lowsrc) hImg.src = hImg.lowsrc;
else hImg.src = "http://i5.woopic.com/I/z.gif";
}
if (hImg.clockId) clearTimeout(hImg.clockId);
hImg.clockId = null;
return true;
} catch (e) {}
}
function startDownloadTimers() {
try{
var aDocImg = window.document.images;
for( var i=0; i<aDocImg.length; i++ ) {
var hImg = aDocImg[i];
if ( hImg.id && hImg.attributes["timeout"] && hImg.complete == false ) {
var nTimeout = hImg.attributes["timeout"].value * 1; 
hImg.clockId = setTimeout( "stopDownloadTimer( o_hGetById('" + hImg.id + "') );", nTimeout * 1000 );
}
}
setTimeout( "globalTimeoutExpired();", nDownloadImgTimeout * 1000 ); 
return true;
} catch (e){}
}
function startJsDownloadTimer(iScript,nTimeout){
try{
window.scriptClockId = window.setTimeout( "stopJavascriptDownload( '" + iScript + "', true );", nTimeout*1000 );
return true;
} catch (e) {}
}
function stopJsDownload(iScript,bAutoClose ) {
try{
if ( bAutoClose == null ) { 
if ( window.scriptClockId != null ) window.clearTimeout( window.scriptClockId ); 
} else { 
var hScript = o_hGetById(iScript); 
hScript.src = "/Js/Nothing.js"; 
} 
window.scriptClockId = null; 
return true;
} catch(e){}
} 
function initUrlReferrer(){
try{
if (! window.sUrlReferrer ) sUrlReferrer ="W3ACC"; 
var nHour = (new Date()).getHours();    
var sPeriod = '0003';
if  ( nHour <= 3 ) sPeriod = '0003'; 
else if ( nHour <= 6 ) sPeriod = '0306'; 
else if ( nHour <= 9 ) sPeriod = '0609'; 
else if ( nHour <= 12) sPeriod = '0912'; 
else if ( nHour <= 15) sPeriod = '1215'; 
else if ( nHour <= 18) sPeriod = '1518'; 
else if ( nHour <= 21) sPeriod = '1821'; 
else      sPeriod = '2124'; 
sUrlReferrer = sUrlReferrer +'_'+ sPeriod ;
return true;
} catch (e){}
}
function getIEAppVersionNumber() { 
var appVersion = navigator.appVersion; 
var msiePos = appVersion.indexOf("MSIE") + 5; 
var appVersionNumber = appVersion.substring(msiePos, msiePos+3) * 1; 
return appVersionNumber; 
} 
function infoMoveDown(){
try{
var crossobj = o_hGetById('content');
var contentheight=crossobj.offsetHeight;
if (parseInt(crossobj.style.top)>=(contentheight*(-1)+100)) crossobj.style.top=parseInt(crossobj.style.top)-nInfoSpeed;
hInfoMoveDown = setTimeout("infoMoveDown()",100);
return true;
} catch(e) {}
}
function infoMoveUp(){
try{
var crossobj = o_hGetById('content');
var contentheight=crossobj.offsetHeight;
if (parseInt(crossobj.style.top)<=0) crossobj.style.top=parseInt(crossobj.style.top)+nInfoSpeed;
hInfoMoveUp = setTimeout("infoMoveUp()",100);
return true;
} catch(e) {}
}
function selectOneLabel( hLabelNode, sUnivers, sService, sPathDistinct, sPage, sZone ) {
try{
var sEtComm = /&/g,    sAmp = /amp;/g;
sPage = sPage.replace(sEtComm, "__");
sZone = sZone.replace(sEtComm, "__");
var aLabel  = hLabelNode.getElementsByTagName("div"); 
var nNbLabel = aLabel.length;       
var sCookieName = 'newRotation' + sService + sPathDistinct; 
var nRndId  = 0;          
var sOldLblId = o_sGetCookie(sCookieName);  
if (nNbLabel > 1) {
do { nRndId = Math.floor(Math.random()*nNbLabel); } while( nRndId == sOldLblId );
}
var hDataNode = o_hGetById( '_' + sUnivers + '_' + sService + '_' + sPathDistinct + '_' + nRndId );
o_hGetById( "title_" + sUnivers + "_" + sService + '_' + sPathDistinct ).innerHTML = hDataNode.attributes["titre"].value;
o_hGetById( "link1_" + sUnivers + "_" + sService + '_' + sPathDistinct ).href  = hDataNode.attributes["href"].value;
o_hGetById( "link2_" + sUnivers + "_" + sService + '_' + sPathDistinct ).href  = hDataNode.attributes["href"].value;
for ( var i=0; i<hDataNode.childNodes.length; i++ ) {
var hChildNode = hDataNode.childNodes[i];
if ( hChildNode.tagName && hChildNode.tagName == "SPAN") {
switch( hChildNode.attributes["pos"].value * 1 ) { 
case 0:  
o_hGetById( "image_" + sUnivers + "_" + sService + '_' + sPathDistinct ).src    = hChildNode.innerHTML;
break;
case 1:  
o_hGetById( "titre_" + sUnivers + "_" + sService + '_' + sPathDistinct ).innerHTML   = hChildNode.innerHTML;
break;
case 2:  
o_hGetById( "description_" + sUnivers + "_" + sService + '_' + sPathDistinct ).innerHTML = hChildNode.innerHTML;
break;
case 3:  
var sVignette = hChildNode.innerHTML;
sVignette = sVignette.replace(sEtComm, "__");
sVignette = sVignette.replace(sAmp, "");
var sSrcImgStat = 'http://i4.woopic.com/Shopping/z.gif?param=' + sPage + '||' + sZone + '||' + sVignette;
var sImgNode = '<img notResize="true" onload="window.tps_shopping = new Date ();" src="' + sSrcImgStat + '" width="1" height="1" border="0">';
o_hGetById( "forZImage_" + sUnivers + "_" + sService + '_' + sPathDistinct ).innerHTML = sImgNode;
}
}
}
o_bSetCookie(sCookieName,nRndId);
} catch(e) {}
}
function displayTagShopping (numero) {
try{
sInnerHTML = o_hGetById(tag_id+numero).innerHTML;
sInnerHTML = sInnerHTML.replace(sEtComm, "__");
sInnerHTML = sInnerHTML.replace(sAmp, "");
o_hGetById(tag_main_id).innerHTML  = 
'<img notResize="true" onload="window.tps_shopping = new Date ();" src="' + tag_racine + '?param=' + tag_page + '||' + tag_zone + '||' + sInnerHTML + '" width="1" height="1" border="0">';
try {o_hGetById(tag_main_id).innerHTML += '<img notResize="true" onload="window.tps_shopping = new Date ();" src="' + tag_racine2 + '?param=' + tag_page + '||' + tag_zone + '||' + sInnerHTML + '" width="1" height="1" border="0">';} catch( e ) {  }
img_vignette = o_hGetById(tag_id+'img_'+numero);
if (img_vignette && img_vignette.innerHTML.indexOf("<img") == -1) {
img_vignette.innerHTML  = '<img src="' + img_vignette.innerHTML + '" alt="" half="true" align="left" class="half" border="0" notResize="true">';
img_vignette.style.display = 'inline';
}
} catch(e) {}
}
function GoStart() { 
try{
var verif_id = o_sGetCookie(cookieName);
var random_div = 0; 
if (nbr_div > 1) { 
do { random_div = Math.floor(Math.random()*nbr_div); } while(random_div == verif_id); 
} 
for(var index=0; index<nbr_div; index++) { 
o_hGetById(div_id + index).style.display = (random_div==index) ? 'block' : 'none'; 
} 
displayTagShopping (random_div); 
o_bSetCookie(sCookieName,random_div);
} catch(e) {}
} 
function changeOpacity(hNode,nOpacity ){
try{
hNode.style.filter   = "alpha(opacity=" + nOpacity + ")";  
hNode.style.MozOpacity  = nOpacity / 100;      
hNode.style.KHTMLOpacity = nOpacity / 100;      
hNode.style.opacity   = nOpacity / 100;      
return true;
} catch(e){}
}
function Fadding( hBGNode, hFGNode, hCallBackFct) {
try { window.clearInterval( window.currentFadding.faddingClock ); } catch( e ) { } 
window.currentFadding = this;
this.hcallbackFunction = hCallBackFct;  
this.hBackgroundNode = hBGNode;   
this.hForegroundNode = hFGNode;    
this.nOpacityRate  = 0;    
changeOpacity(this.hBackgroundNode, 0);
changeOpacity(this.hForegroundNode, 100);
this.hFaddingTimeout = window.setInterval( "window.currentFadding.nextStep()", nFaddingTime );
this.nextStep = function Fadding_nextStep() {
try{
this.nOpacityRate += nFaddingStep;
if ( this.nOpacityRate > 100 ) this.nOpacityRate = 100;
var nBackGroundOpacity = Math.floor( this.nOpacityRate );
var nForeGroundOpacity = Math.floor( 100 - this.nOpacityRate );
changeOpacity( this.hBackgroundNode, nBackGroundOpacity );
changeOpacity( this.hForegroundNode, nForeGroundOpacity );
if ( this.nOpacityRate == 100 ) {
window.clearInterval( window.currentFadding.hFaddingTimeout ); 
if ( this.hcallbackFunction != null ) this.hcallbackFunction();
}
return true;
} catch( e ) { } 
}
}
function displayErr(oError) {
try{
alert ( "erreur js : "+ oError.description +
"\n message : " + oError.message +
"\n nom : " + oError.name +
"\n # : " + oError.number);
return true;
} catch( e ) { } 
}
function sequenceResize() {
try{
if (this.parentNode == null) return;                            
this.style.display = "block";
if (isKonqueror) {                   
var hImgNode   = document.createElement("IMG");          
hImgNode.src   = this.src;
hImgNode.resize   = this.resize;
hImgNode.sequence  = this.sequence;
hImgNode.sequence.hImg = hImgNode;
hImgNode.noBorder = hImgNode.attributes["noBorder"] = true;
this.parentNode.appendChild( hImgNode );
this.parentNode.removeChild( this );
this.sequence.hDiv.style.top = 99; 
this.sequence.hDiv.style.width = this.width;
this.sequence.hDiv.style.height = this.height;
return;
}
if (this.width>290) this.height = "227";
else this.height = "176";
var hMainStyle   = this.previousSibling.style;
var hAlphaParam   = this.sequence.oAlphaParam;
var hAlphaLayerStyle = this.sequence.hAlphaLayer.style;
var hLeftBtnStyle  = this.sequence.hLeftBtn.style;
var hRightBtnStyle  = this.sequence.hRightBtn.style;
if ( document.all ) {
hMainStyle.pixelTop  = this.offsetTop - nHeadlineHeight; 
hMainStyle.pixelLeft = this.offsetLeft;
if (getIEAppVersionNumber() <= 5) { 
if (hMainStyle.pixelLeft*1 == 0) {
hMainStyle.pixelLeft = -1000;
window.setTimeout("window.onresize();", 10);
}
}
hAlphaLayerStyle.pixelLeft  = 0;
hAlphaLayerStyle.pixelBottom = 0;
if (this.sequence.screenPlayer.aSequence.length > 1) { 
hLeftBtnStyle.pixelTop  = nHeadlineHeight + 5;
hRightBtnStyle.pixelTop  = nHeadlineHeight + 5;
hLeftBtnStyle.pixelLeft  = this.width - 45;
hRightBtnStyle.pixelLeft = this.width - 24;
} else { 
hLeftBtnStyle.display = "none";
hRightBtnStyle.display = "none";
}
} else {
hMainStyle.top = this.y - nHeadlineHeight; 
hMainStyle.left = this.x;    
hAlphaLayerStyle.left = 0;
hAlphaLayerStyle.bottom = 0;
if (this.sequence.screenPlayer.aSequence.length > 1) { 
hLeftBtnStyle.top = nHeadlineHeight + 5;
hRightBtnStyle.top = nHeadlineHeight + 5;
hLeftBtnStyle.left = this.width - 45;
hRightBtnStyle.left = this.width - 24;
} else {
hLeftBtnStyle.display = "none";
hRightBtnStyle.display = "none";
}
}
hMainStyle.height = this.height + nHeadlineHeight; 
hMainStyle.width = this.width;
hMainStyle.display = 'block';       
if (! document.all && this.height>this.width*0.69) { 
hMainStyle.height = this.width * 0.68 + nHeadlineHeight;
setTimeout("window.onresize();", 1);
}
hAlphaLayerStyle.width = 280;
var faddingNode = this.sequence.screenPlayer.hFaddingImg;
faddingNode.style.top    = nHeadlineHeight + 1*(document.all ? hMainStyle.pixelTop : sSubPx(hMainStyle.top));
faddingNode.style.left    = document.all ? hMainStyle.pixelLeft : sSubPx(hMainStyle.left);
faddingNode.style.width    = document.all ? hMainStyle.pixelWidth : sSubPx(hMainStyle.width);
faddingNode.firstChild.style.width = document.all ? hMainStyle.pixelWidth : sSubPx(hMainStyle.width);
faddingNode.style.height   = (document.all ? hMainStyle.pixelHeight : sSubPx(hMainStyle.height)) - nHeadlineHeight;
return true;
} catch(e) {  }
}
function sSubPx(sWithPx){
try{
var sPx = "px";
var iPosPx = sWithPx.lastIndexOf(sPx);
if (iPosPx > -1) return sWithPx.substr(0,iPosPx);
else return sWithPx;
} catch( e ) { } 
}
function AlphaParam(sAlphaParam) {
try{
var aAlphaParam  = sAlphaParam.split("-");
this.bckgColor  = aAlphaParam[0];
return true;
} catch( e ) { } 
}
function Sequence(imageSrc, iSequence, iAlphaLayer, sAlphaParam) {
try{
this.imageSrc  = imageSrc;
this.iSequence  = iSequence;
this.oAlphaParam = new AlphaParam(sAlphaParam);
this.hAlphaLayer = o_hGetById(iAlphaLayer);
this.hDiv = o_hGetById(this.iSequence); 
this.hDiv.parentNode.removeChild( this.hDiv );   
this.hDiv.style.position = "absolute";
this.hDiv.style.overflow = "hidden";
this.hDiv.sequence = this;        
this.hTopLnk = document.createElement("DIV");
this.hTopLnk.style.cssText = "font-size: 2";
this.hTopLnk.style.height = nHeadlineHeight;
if (navigator.appName.indexOf("Microsoft") > -1){
var idName = "Image" + (nImgSequenceId++);            
document.write("<IMG class='backGroundImg' noBorder='true' hspace='0' border='0' id='" + idName + "' style='display: none' />");
this.hImg = o_hGetById(idName);                             
this.hImg.parentNode.removeChild(this.hImg);
this.hImg.style.width = "100%";
} else {                    
this.hImg = document.createElement("IMG");
this.hImg.className = "backGroundImg";
this.hImg.attributes["noBorder"] = true;
this.hImg.border = 0;
this.hImg.style.width = "100%";
}
this.hImg.ssrc = this.imageSrc;
this.hImg.resize = sequenceResize;                 
this.hImg.sequence = this;                                                 
this.hAlphaLayer.style.position  = "absolute";
this.hAlphaLayer.style.background = this.oAlphaParam.bckgColor;              
changeOpacity( this.hAlphaLayer, 75 );          
this.hDiv.appendChild( this.hAlphaLayer );                                
this.hAlphaLayer.sequence = this;
if (navigator.appName.indexOf("Microsoft") > -1){
document.write("<img src='http://i5.woopic.com/I/manchetteArrowLeft.gif' notResize='true' id='btnLeft' style='position:absolute;' />");
this.hLeftBtn = o_hGetById('btnLeft');
this.hLeftBtn.parentNode.removeChild(this.hLeftBtn);
document.write("<img src='http://i5.woopic.com/I/manchetteArrowRight.gif' notResize='true' id='btnRight' style='position:absolute;' />");
this.hRightBtn = o_hGetById('btnRight');
this.hRightBtn.parentNode.removeChild(this.hRightBtn);
} else {
this.hLeftBtn     = document.createElement("IMG");
this.hLeftBtn.src    = "http://i5.woopic.com/I/manchetteArrowLeft.gif";
this.hLeftBtn.notResize   = true;
this.hLeftBtn.style.position = "absolute";
this.hRightBtn     = document.createElement("IMG");
this.hRightBtn.src    = "http://i5.woopic.com/I/manchetteArrowRight.gif";
this.hRightBtn.notResize  = true;
this.hRightBtn.style.position = "absolute";
}
this.hDiv.appendChild(this.hLeftBtn);
this.hDiv.appendChild(this.hRightBtn);
this.hLeftBtn.onclick  = function () { oScreenPlayer.prevSequence(); }      
this.hRightBtn.onclick = function () { oScreenPlayer.nextSequence(); }      
return true;
} catch( e ) { } 
}
function ScreenPlayer() {
this.aSequence = new Array();        
this.nCurrentSequence = 0;         
this.iScreenPlayer = o_hGetById("ScreenPlayer");
this.iScreenPlayer.component = this;
this.iScreenPlayer.position  = "relative";
this.iScreenPlayer.overflow  = "hidden";
this.hFaddingImg    = document.createElement( "DIV" );
this.hFaddingImg.innerHTML  = "<img width='100%' height='100%' src='http://i5.woopic.com/I/z.gif' />";
this.hFaddingImg.style.cssText = "position: absolute;";
this.iScreenPlayer.parentNode.appendChild( this.hFaddingImg );
changeOpacity( this.hFaddingImg, 0 );
this.launchTimer = function ScreenPlayer_launchTimer() {
try{
if (nTimeForNextSequence > 0) {        
if (this.clockId) window.clearInterval(this.clockId); 
this.clockId = window.setInterval("oScreenPlayer.nextSequence()", nTimeForNextSequence * 1000); 
}
return true;
} catch( e ) { } 
}
this.addSequence = function ScreenPlayer_addSequence( sequence ) {
try{
this.aSequence[this.aSequence.length] = sequence;
sequence.screenPlayer = this;
return true;
} catch( e ) { } 
}
this.prevSequence = function ScreenPlayer_getPreviousSequence() {
try{
if ((--this.nCurrentSequence) == -1) this.nCurrentSequence = this.aSequence.length-1;
this.generateHTML();
return true;
} catch( e ) { } 
}
this.nextSequence = function ScreenPlayer_getNextSequence() {
try{
if ((++this.nCurrentSequence) == this.aSequence.length) this.nCurrentSequence = 0;
this.generateHTML();
return true;
} catch( e ) { } 
}
this.generateHTML = function ScreenPlayer_generateHTML() {
try{
if (this.aSequence.length == 0) {
alert("You must add sequences to the ScreenPlayer");
throw true;
}
var sequence  = this.aSequence[this.nCurrentSequence];
sequence.hImg.src = sequence.hImg.ssrc;
try {
this.iScreenPlayer.removeChild( this.iScreenPlayer.firstChild );
this.iScreenPlayer.removeChild( this.iScreenPlayer.firstChild );
if ( this.aSequence.length > 1 ) {
changeOpacity( this.hFaddingImg, 100 );
}
this.iScreenPlayer.removeChild( this.iScreenPlayer.firstChild );
} catch( e ) { }
if ( this.aSequence.length > 1 ) {
changeOpacity( sequence.hImg, 0 );
} else {
this.hFaddingImg.style.display = "none";
}
this.iScreenPlayer.appendChild( sequence.hTopLnk );
this.iScreenPlayer.appendChild( sequence.hDiv );                                   
this.iScreenPlayer.appendChild( sequence.hImg );
o_bSetCookie("lastSequence", this.nCurrentSequence);                   
this.launchTimer();
window.onresize();
if ( this.aSequence.length > 1 ) {
new Fadding(sequence.hImg,this.hFaddingImg,faddingFinished);
}
return true;
} catch( e ) { } 
}
this.start = function ScreenPlayer_start() {
try{
this.nCurrentSequence = o_sGetCookie("lastSequence"); 
if (this.nCurrentSequence == null || this.nCurrentSequence>=this.aSequence.length || bFixedOrder == true)
this.nCurrentSequence = -1;
this.nextSequence();
return true;
} catch( e ) { } 
}
}
function faddingFinished() {
try{
oScreenPlayer.hFaddingImg.firstChild.src = oScreenPlayer.aSequence[oScreenPlayer.nCurrentSequence].hImg.src;
if (navigator.userAgent.indexOf('Opera 8') != -1 || navigator.userAgent.indexOf('Opera 7') != -1) {
oScreenPlayer.hFaddingImg.style.display = "none";
}
return true;
} catch( e ) { } 
}
function GridManager(nCellsPerLine){
this.aCells   = new Array();  
this.nCellsPerLine = nCellsPerLine; 
this.nCurrentX  = 0;    
this.nCurrentY  = 0;    
this.nInsertLineNb = 0;    
this.insertLine = function GridManager_insertLine() {
try{
var newLine = new Array();
for(var i=0; i<this.nCellsPerLine; i++) newLine[i] = false;
this.aCells[this.aCells.length] = newLine;
return true;
} catch( e ) { } 
}
this.markCell = function GridManager_markCell(nPosX, nPosY) {
try{
if (this.aCells.length <= nPosY) {
for (var i=this.aCells.length; i <= nPosY; i++) this.insertLine();
}
if (nPosX >= this.nCellsPerLine) {
throw "Bad index for CellMatrix";
}
this.aCells[nPosY][nPosX] = true;
return true;
} catch( e ) { } 
}
this.markCells = function GridManager_markCells(nColspan, nRowspan) {
try{
for (var nX = 0; nX < nColspan; nX++) {
for (var nY=0; nY < nRowspan; nY++) {
this.markCell(this.nCurrentX, this.nCurrentY + nY);
}
this.nCurrentX++;
}
if (this.nCurrentX == this.nCellsPerLine) {
this.nInsertLineNb ++;
this.nCurrentX = 0;
this.nCurrentY++;
if (this.aCells.length<=this.nCurrentY) this.insertLine();
}
while(this.aCells[this.nCurrentY][this.nCurrentX] == true) {
this.nCurrentX++;
if (this.nCurrentX == this.nCellsPerLine) {
this.nInsertLineNb ++;
this.nCurrentX=0;
this.nCurrentY++;
if (this.aCells.length<=this.nCurrentY) this.insertLine();
}
}
return true;
} catch( e ) { } 
}
this.displayMatrix = function GridManager_displayMatrix() {
try{
var theString = "";
for(var line=0; line<this.aCells.length; line++) {
for(var column=0; column<this.nCellsPerLine; column++) {
theString += (this.aCells[line][column] ? "true " : "false") + " - ";
}
theString += "\n";
}
alert(theString);
return true;
} catch( e ) { } 
}
return this;
}
function DisplayGrid(nCellsPerLine) {
this.nCellsPerLine = nCellsPerLine;  
this.currentPos  = 1;
this.oGridManager = new GridManager(this.nCellsPerLine);
oDisplayGrid = this;
document.writeln("<TABLE class='grid' cellspacing='0' cellpadding='0' border='0' id='grid'><TR></TR></TABLE>");
this.hGrid = o_hGetById("grid");
this.hCurrentLine = this.hGrid.firstChild.lastChild;
this.addCell = function DisplayGrid_addCell(iCell, nColspan, nRowspan) {
try{
while (this.oGridManager.nInsertLineNb > 0) {
this.hCurrentLine = document.createElement("TR");
this.hGrid.firstChild.appendChild(this.hCurrentLine); 
this.oGridManager.nInsertLineNb --;
}
var hTd = document.createElement("TD"); 
hTd.gridMarker = true;     
hTd.colSpan = nColspan;
hTd.rowSpan = nRowspan;
var hCell = o_hGetById(iCell);
hCell.parentNode.removeChild(hCell);
hTd.appendChild(hCell); 
hCell.style.height = "100%";
hTd.className = "gridCell";
this.hCurrentLine.appendChild(hTd); 
this.currentPos += nColspan;
this.oGridManager.markCells(nColspan, nRowspan); 
if (bStreamViewer == true) {                                              
var titleNode = hTd.getElementsByTagName("H5");                    
titleNode[0].innerHTML += "<BR><SPAN style='text-transform: lowercase;'>( " + iCell + " )</SPAN>";
}
return true;
} catch( e ) { }
}
this.resize = function DisplayGrid_resize(){
var aGridImg = this.hGrid.getElementsByTagName("IMG");
for(var i = 0; i < aGridImg.length; i++) {
try {
var hImg = aGridImg[i];
if (hImg.attributes["notResize"] || hImg.notResize) continue; 
var hTd = hImg.parentNode;
while(hTd.gridMarker != true) hTd = hTd.parentNode; 
var nColSpan = hTd.colSpan;  
var nBordWidth = (nColSpan-1); 
var nGridWidth = document.body.clientWidth;
if (nGridWidth < nWindowMinWidth){
nGridWidth = nWindowMinWidth;
} else if (nGridWidth > nWindowMaxWidth) {
nGridWidth = nWindowMaxWidth;
o_hGetById("SubBody").style.width = nWindowMaxWidth;
} else {
o_hGetById("SubBody").style.width = "100%";
}
var nImgWidth = ((nGridWidth - nNavWidth) / this.nCellsPerLine) * nColSpan - nBordWidth;
var nTdWidth = nImgWidth;
if (hImg.attributes["half"] || hImg.half) nImgWidth /= 2; 
if (hImg.attributes["shopping"] || hImg.shopping) nImgWidth /= 2.28 ;   
if (!(hImg.attributes["noBorder"] || hImg.noBorder) && !(hImg.attributes["boxService"] || hImg.boxService) && hImg.className != 'backGroundImg'){
nImgWidth -= 12; 
}
hTd.style.width    = Math.ceil(nImgWidth-0.5);
if (document.all){
hImg.style.width  = Math.ceil(nImgWidth-0.5);
} 
} catch(e) { }
}
return true;
}
return this;
}
function i2h(id) {
try{
handler = (document.getElementById(id))?document.getElementById(id):false;
return handler;
} catch( e ) { } 
}
function addSelectOption( Hselect, index, title, value) {
try{
Hselect.options[index] = new Option( title, value);
return true;
} catch( e ) { } 
}
function ShowCalendar(dt,iDivCalendar) {
try{
var tDate = new Date( yearToday, monthToday-1, dayToday);
var calDate = new Date(dt);
calDate.setDate(1);
calDate.setHours(23);
calDate.setMinutes(59);
calDate.setSeconds(59);
var uDate = new Date(tDate);    
uDate.setDate(uDate.getDate()+lastDate); 
tDate.setDate(tDate.getDate()+firstDate); 
var cyear = calDate.getFullYear();
var isLeapYear = (((cyear % 4 == 0) && (cyear % 100 != 0)) || (cyear % 400 == 0));
mDays[1] = (isLeapYear)?29:28;
var calStr = '<table cellpadding="0" cellspacing="1" border="0" style="width:100%;background-color:#FFFFFF;">';
calStr += '<tr>';
calStr += '<td colspan="7" class="titre" style="vertical-align:middle;">';
if (calDate>tDate){
calDate.setMonth(calDate.getMonth()-1); 
calStr +='<div class="prec"><a href="javascript:ShowCalendar(\''+calDate.getFullYear()+'/'+(calDate.getMonth()+1)+'/'+calDate.getDate()+'\',\''+iDivCalendar+'\')"><img src="http://i5.woopic.com/I/Voyages/prev.gif" alt="Calendrier '+mNames[calDate.getMonth()]+'" title="Calendrier '+mNames[calDate.getMonth()]+'"/>&nbsp;</a></div>';
calDate.setMonth(calDate.getMonth()+1); 
} else calStr += '<div class="prec">&nbsp;</div>'
calStr += '<div class="mois">'+mNames[calDate.getMonth()]+' '+calDate.getFullYear()+'</div>';
calDate.setMonth(calDate.getMonth()+1);
if (calDate<uDate){
calStr +='<div class="next">&nbsp;<a href="javascript:ShowCalendar(\''+calDate.getFullYear()+'/'+(calDate.getMonth()+1)+'/'+calDate.getDate()+'\',\''+iDivCalendar+'\')"><img src="http://i5.woopic.com/I/Voyages/next.gif" alt="Calendrier '+mNames[calDate.getMonth()]+'" title="Calendrier '+mNames[calDate.getMonth()]+'"/></div>';
} else calStr += '<div class="next">&nbsp;</div>'
calDate.setMonth(calDate.getMonth()-1);
calStr += '<div class="fermer"><a href="" onclick="cl.style.display=\'none\'; selectState( false);return false;" class="close" alt="Fermer le calendrier" title="Fermer le calendrier"><img src="http://i5.woopic.com/I/Voyages/close.gif" /> Fermer</a></div>';
calStr += '</td>';
calStr += '</tr><tr class="nomJour">';
for(var x=0;x<dNames.length;x++) calStr += '<td>'+dNames[x]+'</td>';
calStr+='</tr>';
var nJourSem = 0,clDate = (calDate.getDay()==0)?6:calDate.getDay()-1; 
for(var x=0;x<clDate;x++) {
if (nJourSem == 0) calStr += '<tr class="jour">'; 
calStr += '<td class="invalide">&nbsp;</td>';
nJourSem++;
}
var nJourMoisActuel = mDays[calDate.getMonth()];
for(var x=0;x < nJourMoisActuel;x++) {
calDate.setDate(x+1);
if(calDate >= tDate && calDate <= uDate) {
calStr+=(nJourSem==0)?'<tr class="jour"><td class="valide">':'<td class="valide">';
calStr +='<a href="javascript:setDay(\''+(((calDate.getMonth()+1)<10)?0+''+(calDate.getMonth()+1):(calDate.getMonth()+1))+'-'+calDate.getFullYear()+'\',\''+(((x+1)<10)?0+''+(x+1):(x+1))+'\'); selectState(false);">'+(x+1)+'</a></td>';
} else {
calStr +=(nJourSem==0)?'<tr class="jour"><td class="invalide">':'<td class="invalide">';
calStr+=(x+1)+"</td>"
}
nJourSem++;
if(nJourSem == 7) {
calStr +='</tr>';
nJourSem=0;
}
}
while (nJourSem < 7 && nJourSem != 0){
calStr+='<td class="invalide">&nbsp;</td>';
if( nJourSem == 6) {
calStr+='</tr>';
}
nJourSem++;
}
calStr+= "</table>";
cl = document.getElementById(iDivCalendar);
cl.style.display='';
cl.innerHTML=calStr;
} catch( e ) { } 
}
function Calendar( Day, Month, dateFld,iDivCalendar) {
try{
cMonthYearField=Month;
cMonthYearFieldVal = document.getElementById(Month).options[document.getElementById(Month).selectedIndex].value;
cDateField=Day;
cDayFieldVal = document.getElementById(Day).options[document.getElementById(Day).selectedIndex].value;
cDayField = dateFld;
newDate = new Date(cMonthYearFieldVal.substr(3,4)+"/"+cMonthYearFieldVal.substr(0,2)+"/"+cDayFieldVal);
selectState(true);
ShowCalendar(newDate,iDivCalendar);
} catch( e ) { } 
}
function setDay(MYnm,Dnm) {
try{
element1 = i2h(cMonthYearField);
element2 = i2h(cDateField);
cl.style.display='none';
setDDValue( element1, MYnm);
setDDValue( element2, Dnm);
if (cDayField) {
calcDay( cDateField, cMonthYearField, cDayField);
}
upDate();
return true;
} catch( e ) { } 
}
function calcDay(nm,nm2,day) {
try{
dateVal = i2h(nm).options[i2h(nm).selectedIndex].value;
monthVal = i2h(nm2).options[i2h(nm2).selectedIndex].value;
var isLeapYear = (((monthVal.substr(3,4) % 4 == 0) && (monthVal.substr(3,4) % 100 != 0)) || (monthVal.substr(3,4) % 400 == 0));
mDays[1] = (isLeapYear)?29:28;
if(dateVal > mDays[monthVal.substr(0,2)-1]) {
setDDValue(i2h(nm),mDays[monthVal.substr(0,2)-1]);
dateVal = i2h(nm).options[i2h(nm).selectedIndex].value;
}
newDate = new Date(monthVal.substr(3,4)+"/"+monthVal.substr(0,2)+"/"+dateVal);
i2h(day).innerHTML = days[newDate.getDay()];
return true;
} catch( e ) { } 
}
function rSetCal(day,month,year) {
try{
dateCal = day+'-'+month+'-'+year;
dayCal = (day.length < 2)?'0'+day:day;
monthCal = month;
yearCal = year;
return true;
} catch( e ) { } 
}
function today_date(plusdays) { 
try{
if ((typeof plusdays == 'undefined') || (plusdays == '')) {
plusdays=0;
}
var date = new Date(yearToday,monthToday*1-1, dayToday);
date.setDate(date.getDate() + plusdays);
var d  = date.getDate();
var day = (d < 10) ? '0' + d : d;
var m = (date.getMonth()*1)+1;
var month = (m < 10) ? '0' + m : m;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;
rSetCal(day, month, year);
return(day + "-" + month + "-" + year);
} catch( e ) { } 
}
function initFormVol() {
try{
i2h("sArrivalDate").value = today_date(9);
i2h("sDepartDate").value = today_date(8);
return true;
} catch( e ) { } 
}
function init2FormVol() {
try{
var dateD = i2h("sDepartDate").value;
var dateA = i2h("sArrivalDate").value;
setDDValue(i2h("sArrivalDate2"), dateA.substr(3,7));
setDDValue(i2h("sArrivalDate1"), dateA.substr(0,2));
calcDay('sArrivalDate1','sArrivalDate2','DDayOfWeek');
setDDValue(i2h("sDepartDate2"), dateD.substr(3,7));
setDDValue(i2h("sDepartDate1"), dateD.substr(0,2));
calcDay('sDepartDate1','sDepartDate2','DepartDayOfWeek');
return true;
} catch( e ) { } 
}
function upDate() {
try{
dateD = new Date(i2h("sDepartDate2").value.substr(3,4),i2h("sDepartDate2").value.substr(0,2),i2h("sDepartDate1").value);
dateA = new Date(i2h("sArrivalDate2").value.substr(3,4),i2h("sArrivalDate2").value.substr(0,2),i2h("sArrivalDate1").value);
if (dateA < dateD) {
var dateG = dateD;
dateG.setDate(dateG.getDate() + 0); 
var d  = dateG.getDate();
var day = (d < 10) ? '0' + d : d;
var m = dateG.getMonth();
var month = (m < 10) ? '0' + m : m;
var yy = dateG.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;
var good_monthyear = month + '-' + year;
var good_day = day;
setDDValue(i2h("sArrivalDate2"), good_monthyear);
setDDValue(i2h("sArrivalDate1"), good_day);
calcDay('sArrivalDate1','sArrivalDate2','DDayOfWeek');
}
i2h("sDepartDate").value = i2h("sDepartDate1").value + '-' + i2h("sDepartDate2").value;
i2h("sArrivalDate").value = i2h("sArrivalDate1").value + '-' + i2h("sArrivalDate2").value;
return true;
} catch( e ) { } 
}
function validFormVol() {
try{
var strAlert = '';
if(i2h('psAdults').value=='0' && i2h('psChildren').value=='0')
strAlert += "Le nombre de passagers ne peut être nul.\n";
if(i2h('sDepartLocation').value=="")
strAlert += "La ville de départ doit être spécifiée.\n";
if(i2h('sArrivalLocation').value=="") strAlert += "La ville d'arrivée doit être spécifiée.\n";
currentDate = new Date();
v_departDate = new Date(i2h('sDepartDate').value.substr(6,4),i2h('sDepartDate').value.substr(3,2)-1,i2h('sDepartDate').value.substr(0,2));
if(currentDate.getTime()>v_departDate.getTime()) strAlert += "La date de départ doit être postérieure à la date courante.\n";
if (document.form_vol.psFareType) var psFareType = (document.form_vol.psFareType.checked)?"S":"R";
else var psFareType = "R";
if (strAlert.length > 0) {
alert(strAlert);
} else {
var url = "http://r.orange.fr/r?ref=W3ACC_hp_rechercher_vol&url=http://lr.voyages.orange.fr/FLIGHT/pages/invokeServlet.php?sTazzooFor=Orange";
url+= "&sDepartDate=" + document.form_vol.sDepartDate.value;
url+= "&sArrivalDate=" + document.form_vol.sArrivalDate.value;
url+= "&sDepartLocation=" + document.form_vol.sDepartLocation.value;
url+= "&sArrivalLocation=" + document.form_vol.sArrivalLocation.value;
url+= "&psAdults=" + document.form_vol.psAdults.value;
url+= "&psChildren=" + document.form_vol.psChildren.value;
url+= "&psBabies=0";
url+= "&psFareType=" + psFareType;
document.location.href = url;
}
return false;
} catch( e ) { } 
}
function selectState(hidden) {
try{
var state = (hidden)?'hidden':'visible';
i2h('form_vol').style.visibility = state;
} catch( e ) { } 
}
function addSelectDate( champsJour, champsMois) {
try{
for( i=1; i<=31; i++) {
addSelectOption( champsJour, i-1, i, (i<10)?"0"+i:i);
}
champsJour.options[dayCal-1].selected = true;
for(i=0; i<13; i++) {
mois = monthCal*1 + i - 1;
mois = (mois<=0)?12+mois:mois;
annee = (mois>12)?yearCal+1:yearCal;
mois = (mois>12)?mois-12:mois;
if (typeof noYear != "undefined" && noYear){
addSelectOption( champsMois, i, mNamesShort[mois-1], ((mois<10)?"0"+mois:mois)+"-"+annee);
} else {
addSelectOption( champsMois, i, mNamesShort[mois-1]+" "+annee, ((mois<10)?"0"+mois:mois)+"-"+annee);
}
}
champsMois.options[1].selected = true;
return true;
} catch( e ) { } 
}
function setDDValue(oDropDown, sValue) {
try{
for(var iIndex=0; iIndex<oDropDown.options.length; ++iIndex) {
if(oDropDown.options[iIndex].value == sValue) {
oDropDown.selectedIndex = iIndex;
break;
}
}
return true;
} catch( e ) { } 
}
function sejShowCalendar(dt,iDivCalendar) {
try{
var tDate = new Date( sejYearToday, sejMonthToday-1, sejDayToday);
var calDate = new Date(dt);
calDate.setDate(1);
calDate.setHours(23);
calDate.setMinutes(59);
calDate.setSeconds(59);
var uDate = new Date(tDate);
uDate.setDate(uDate.getDate()+sejLastDate);
tDate.setDate(tDate.getDate()+sejFirstDate);
var cyear = calDate.getFullYear();
var isLeapYear = (((cyear % 4 == 0) && (cyear % 100 != 0)) || (cyear % 400 == 0));
sejMDays[1] = (isLeapYear)?29:28;
var calStr = '<div class="calend" align="center"><table border="0" cellspacing="0" cellpadding="0" class="c-crmonthcell">';
calStr += '<tr>';
calDate.setMonth(calDate.getMonth()-1);
tDate.setMonth(tDate.getMonth()-1);
calStr +='<td align=center class="c-titledaycell" width="100%">';
if (calDate>tDate){
calStr +='<a href="javascript:sejShowCalendar(\''+calDate.getFullYear()+'/'+(calDate.getMonth()+1)+'/'+calDate.getDate()+'\',\''+iDivCalendar+'\')"><image src="http://i5.woopic.com/I/Voyages/prev.gif" border="0" width=13 notResize="true"></a>&nbsp;';
}
tDate.setMonth(tDate.getMonth()+1);
calDate.setMonth(calDate.getMonth()+1);
calStr += '<span style="width:90px">'+sejMNames[calDate.getMonth()]+' '+calDate.getFullYear()+'</span>';
calDate.setMonth(calDate.getMonth()+1);
if (calDate<uDate){
calStr +='&nbsp;<a href="javascript:sejShowCalendar(\''+calDate.getFullYear()+'/'+(calDate.getMonth()+1)+'/'+calDate.getDate()+'\',\''+iDivCalendar+'\')"><image src="http://i5.woopic.com/I/Voyages/next.gif" notResize="true" border="0" width=13>';
}
calStr += '</td>';
calStr += '<td align="right" class="c-titledaycell"><a href="#" onclick="sejCl.style.display=\'none\'; sejSelectState( false);return false;" class="close"><img src="http://i5.woopic.com/I/Voyages/close.gif" style="vertical-align:middle" notResize="true" border="0" width=13/>&nbsp;'+sejCalClose+'</a></td>';
calStr += '</tr>';
calStr += '<tr><td colspan=2>';
calStr += '<table width="100%" border="0" cellspacing="1" cellpadding="0" class="c-alldaycell">';
calDate.setMonth(calDate.getMonth()-1);
for(var x=0;x<dNames.length;x++) {
calStr += (x==0)
?'<tr><td align=center class="c-titledaycell">'+dNames[x]+'</td>'
:'<td align=center class="c-titledaycell">'+dNames[x]+'</td>';
}
calStr+='</tr>';
calStr+= '<tr>';
var cnt = 0,clDate = (calDate.getDay()==0)?6:calDate.getDay()-1;
for(var x=0;x<clDate;x++) {
calStr += '<td class="c-prevdaycell">&nbsp;</td>';
cnt++;
}  
for(var x=0;x<sejMDays[calDate.getMonth()];x++) {
calDate.setDate(x+1);
if(calDate >= tDate && calDate <= uDate) {
if(cnt > 4) {
calStr+=(cnt==0)
?'<tr><td width="14" align="center" class="c-crdaycell">'
:'<td width="14" align="center" class="c-crdaycell">';
} else {
calStr+=(cnt==0)
?'<tr><td width="14" align="center" class="c-crdaycell">'
:'<td width="14" align="center" class="c-crdaycell">';
}
calStr +='<a href="javascript:sejSetDay(\''+(((calDate.getMonth()+1)<10)?0+''+(calDate.getMonth()+1):(calDate.getMonth()+1))+'-'+calDate.getFullYear()+'\',\''+(((x+1)<10)?0+''+(x+1):(x+1))+'\'); sejSelectState(false);" class="c-jourclic">'+(x+1)+'</a></td>';
} else {
calStr +=(cnt==0)
?'<tr><td width="14" align="center" class="c-prevdaycell">'
:'<td width="14" align="center" class="c-prevdaycell">';
calStr+=(x+1)+"&nbsp;</td>"
}
cnt++;
if(cnt == 7) {
calStr +='</tr>';
cnt=0;
}
}
if(cnt<7) {
for( j=1; j<=7-cnt; j++) {
calStr+='<td class="c-prevdaycell">&nbsp;</td>';
if( j==7-cnt) {
calStr+='</tr>';
}
}
}
calStr+='</table></div>';
sejCl = document.getElementById(iDivCalendar);
sejCl.style.display='';
sejCl.innerHTML=calStr;
} catch( e ) { } 
}
function sejCalendar( Day, Month, dateFld,iDivCalendar) {
try{
sejCMonthYearField=Month;
cMonthYearFieldVal = document.getElementById(Month).options[document.getElementById(Month).selectedIndex].value;
sejCDateField=Day;
cDayFieldVal = document.getElementById(Day).options[document.getElementById(Day).selectedIndex].value;
sejCDayField = dateFld;
newDate = new Date(cMonthYearFieldVal.substr(3,4)+"/"+cMonthYearFieldVal.substr(0,2)+"/"+cDayFieldVal);
sejSelectState(true);
sejShowCalendar(newDate,iDivCalendar);
} catch( e ) { } 
}
function sejSetDay(MYnm,Dnm) {
try{
element1 = i2h(sejCMonthYearField);
element2 = i2h(sejCDateField);
sejCl.style.display='none';
sejSetDDValue( element1, MYnm);
sejSetDDValue( element2, Dnm);
if (sejCDayField) {
sejCalcDay( sejCDateField, sejCMonthYearField, sejCDayField);
}
} catch( e ) { } 
}
function sejCalcDay(nm,nm2,day) {
try{
dateVal = i2h(nm).options[i2h(nm).selectedIndex].value;
monthVal = i2h(nm2).options[i2h(nm2).selectedIndex].value;
var isLeapYear = (((monthVal.substr(3,4) % 4 == 0) && (monthVal.substr(3,4) % 100 != 0)) || (monthVal.substr(3,4) % 400 == 0));
sejMDays[1] = (isLeapYear)?29:28;
if(dateVal > sejMDays[monthVal.substr(0,2)-1]) {
sejSetDDValue(i2h(nm),sejMDays[monthVal.substr(0,2)-1]);
dateVal = i2h(nm).options[i2h(nm).selectedIndex].value;
}
newDate = new Date(monthVal.substr(3,4)+"/"+monthVal.substr(0,2)+"/"+dateVal);
i2h(day).value = sejDays[newDate.getDay()];
i2h(day).title = sejDays2[newDate.getDay()];
} catch( e ) { } 
}
function sejRSetCal(day,month,year) { 
try{
dateCal = day+'-'+month+'-'+year;
dayCal = (day.length < 2)?'0'+day:day;
monthCal = month;
yearCal = year;
} catch( e ) { } 
}
function sejToday_date(plusdays) {
try{
if ((typeof plusdays == 'undefined') || (plusdays == '')) {
plusdays=0;
}
var date = new Date(sejYearToday,sejMonthToday*1-1, sejDayToday);
date.setDate(date.getDate() + plusdays);
var d  = date.getDate();
var day = (d < 10) ? '0' + d : d;
var m = (date.getMonth()*1)+1;
var month = (m < 10) ? '0' + m : m;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;
sejRSetCal(day, month, year);
return(day + "-" + month + "-" + year);
} catch( e ) { } 
}
function sejInitForm() {
try{
i2h("sejDepartDate").value = sejToday_date(8);
} catch( e ) { } 
}
function sejInit2Form() {
try{
var dateD = i2h("sejDepartDate").value;
sejSetDDValue(i2h("sejDepartDate2"), dateD.substr(3,7));
sejSetDDValue(i2h("sejDepartDate1"), dateD.substr(0,2));
sejCalcDay('sejDepartDate1','sejDepartDate2','sejDepartDayOfWeek');
} catch( e ) { } 
}
function sejValidForm() {
try{
var url; var where;
var batch_id; var sDepartLocation; var sDepartDate; var iDateSpread; var iDuration; var iPrice; var sMinPrice; var sMaxPrice; var sDestinationCountry;
currentDate = new Date();
sDepartDate = i2h('sejDepartDate').value;
if (sDepartDate == 'Indifférent') {
sDepartDate = '';
wantedDate = '';
} else {
wantedDate = new Date(sDepartDate.substr(6,4),sDepartDate.substr(3,2)-1,sDepartDate.substr(0,2));
}
url = 'http://rl.orange.fr/r?ref=wvoyages_rechercher_sejours&url=http://lr.voyages.orange.fr/VACATION/pages/results.php?sTazzooFor=Orange';
sDepartLocation = i2h('sejDepartLocation').value;
batch_id = i2h('sDestinationCountry').value;
iDuration = i2h('iDuration').value;
strAlert = "";
if(sDestinationCountry == '')
strAlert += "Le pays d'arrivée doit être spécifié.\n";
if((sDepartDate == ''))
strAlert += "La date de départ doit être précisée.\n";
if((sDepartDate != '') && (currentDate.getTime()>wantedDate.getTime()))
strAlert += "La date de départ doit être postérieure à la date courante.\n";
if(strAlert) {
alert(strAlert);
} else {
url = url + "&iDuration=" + iDuration + "&batch_id=" + batch_id + "&sDepartDate=" + sDepartDate;
location.href = url;
}
return false;
} catch( e ) { } 
}
function sejSelectState(hidden) {
try{
var state = (hidden)?'hidden':'visible';
i2h("validFormSejour").style.visibility = state;
i2h("formulaireSejour").style.visibility = state;
} catch( e ) { } 
}
function sejAddSelectDate( champsJour, champsMois) {
try{
for( i=1; i<=31; i++) {
addSelectOption( champsJour, i-1, i, (i<10)?"0"+i:i);
}
champsJour.options[dayCal-1].selected = true;
for(i=0; i<13; i++) {
mois = monthCal*1 + i - 1;
mois = (mois<=0)?12+mois:mois;
annee = (mois>12)?yearCal+1:yearCal;
mois = (mois>12)?mois-12:mois;
addSelectOption( champsMois, i, sejMNamesShort[mois-1]+" "+annee, ((mois<10)?"0"+mois:mois)+"-"+annee);
}
champsMois.options[1].selected = true;
} catch( e ) { } 
}
function sejSetDDValue(oDropDown, sValue) {
try{
for(var iIndex=0; iIndex<oDropDown.options.length; ++iIndex) {
if(oDropDown.options[iIndex].value == sValue) {
oDropDown.selectedIndex = iIndex;
break;
}
}
} catch( e ) { } 
}
function franceBresil(){
try{
var nTemps = (new Date(2006,6,9,20,0,0).getTime() - new Date().getTime())/1000;
var nDay = Math.floor(nTemps/86400);
var nHeure = Math.floor(nTemps/3600);
var nMinute = Math.floor((nTemps - nHeure*3600)/60);
var text = 'France-Italie ';
if (nDay >= 1 ) text += 'j-'+ nDay;
else if (nHeure >= 1 ) text += 'dans '+ nHeure +'h';
else if (nHeure >= 0 ) text += 'dans '+ nMinute +'m';
else if(nHeure > -2) {}
else text = "Coupe du Monde";
return text;
} catch( e ) { } 
}

