
var refreshMethod = false;
var urlMehtod = '';

var redirectTimeout;
function homeredirect(redirectDelay) {
  clearTimeout(redirectTimeout);
  redirectTimeout = setTimeout('window.location=\'6630\'',redirectDelay);
}

function menu(menuURL,contentURL) {
  fbGetUrlDiv('menu6630',menuURL,'');
  fbGetUrlDiv('content',contentURL,'');
}

function hidediv(myId) {
    if (document.getElementById) { // DOM3 = IE5, NS6
      if (document.getElementById(myId)) document.getElementById(myId).style.visibility = 'hidden';
    }
    else {
        if (document.layers) { // Netscape 4
          if (document.layer[myId]) document.layer[myId].visibility = 'hidden';
        }
        else { // IE 4
          if (document.all[myId]) document.all[myId].style.visibility = 'hidden';
       }
    }
}

function showdiv(myId) {
    if (document.getElementById) { // DOM3 = IE5, NS6
        if (document.getElementById(myId)) document.getElementById(myId).style.visibility = 'visible';
    }
    else {
        if (document.layers) { // Netscape 4
          if (document.layer[myId]) document.layers[myId].visibility = 'visible';
        }
        else { // IE 4
          if (document.all[myId]) document.all[myId].style.visibility = 'visible';
        }
    }
}

function hidepopupdetails() {
    if (document.getElementById) { // DOM3 = IE5, NS6
        if (document.getElementById('popupmore')) {
          document.getElementById('popupmore').style.width = '0px';
          document.getElementById('popupmore').style.visibility = 'hidden';
        }
    }
    else {
        if (document.layers) { // Netscape 4
          if (document.layer['popupmore']) {
              document.layers['popupmore'].width = '0px';
              document.layer['popupmore'].visibility = 'hidden';
          }
        }
        else { // IE 4
          if (document.all['popupmore']) {
            document.all['popupmore'].style.visibility = 'hidden';
            document.all['popupmore'].style.width = '0px';
          }
       }
    }
}

function showpopupdetails() {
    if (document.getElementById) { // DOM3 = IE5, NS6
        if (document.getElementById('popupmore')) {
          document.getElementById('popupmore').style.width = '660px';
          document.getElementById('popupmore').style.visibility = 'visible';
        }
    }
    else {
        if (document.layers) { // Netscape 4
          if (document.layer['popupmore']) {
              document.layers['popupmore'].width = '660px';
              document.layers['popupmore'].visibility = 'visible';
          }
        }
        else { // IE 4
          if (document.all['popupmore']) {
            document.all['popupmore'].style.width = '660px';
            document.all['popupmore'].style.visibility = 'visible';
          }
        }
    }
}

// Ajax - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function fbGetUrlDiv(id,url,innerhtml) {
  if (document.getElementById(id)) {
    var xReq=getXmlHttpRequest();
    var obj=document.getElementById(id);
    if (innerhtml != '') fbShowWaiting(obj,innerhtml);
    xReq.open("GET",url,true);
    xReq.onreadystatechange=function(){fbEventGetUrlDiv(xReq,id);};
    xReq.send(null);
  }
}

function fbEventGetUrlDiv(xRequest,anId) {
  if (xRequest.readyState==4) {
    document.getElementById(anId).innerHTML=xRequest.responseText;
    if (anId=='content') initAscenseur('content');
    if (anId=='divlogin') {
      if (document.fprocesssignin) document.fprocesssignin.login.focus();
      if (document.fprocessforgotpwd) document.fprocessforgotpwd.login.focus();
    }
    if (anId=='fullshipping' && refreshMethod && document.getElementById('methodshipping') && urlMehtod!='') {
      fbGetUrlDiv('methodshipping',urlMehtod,'');
      refreshMethod = false;
      urlMehtod = '';
    }
  }
}

function fbShowWaiting(obj,innerhtml) {
    obj.innerHTML=innerhtml;
}

function getXmlHttpRequest() {
    if (window.XMLHttpRequest) // Firefox
    {
       return(new XMLHttpRequest());
    }
    else if (window.ActiveXObject) // Internet Explorer
    {
        try
        {
            return(new ActiveXObject("Msxml2.XMLHTTP"));
        } 
        catch (e)
        {
            try
            {
                return(new ActiveXObject("Microsoft.XMLHTTP"));
            }
            catch (e)
            {
                alert("Your browser does not support XMLHTTPRequest...");
            }
        }
    }
    else
    { // XMLHttpRequest non supporté par le navigateur
       alert("Your browser does not support XMLHTTPRequest...");
    }
}

function fbSendAjaxFormTargetDiv(idForm,baseurl,targetId,innerhtml) {
    var xReq=getXmlHttpRequest();
    var i;
    var url="";
    var myForm=document.getElementById(idForm);

    if (myForm) {
        var first=true;
        for(i=0;i<myForm.elements.length;i++) {
            var elmt=myForm.elements[i];
            var type=elmt.nodeName.toLowerCase();
            var ok=true;

            if (type=="input") {
                switch (elmt.type.toLowerCase()) {
                case "radio":
                case "checkbox":
                    if (!elmt.checked) ok=false;
                    break;

                case "submit":
                case "image":
                    ok=false;
                    break;
                }
            }
            else if ((type!="select") && (type!="textarea")) ok=false;
            if (ok) {
                if (first) first=false;
                else url+="&";
                url+=elmt.name+"="+elmt.value.replace(/%/g,"%25").replace(/&/g,"%26").replace(/=/g,"%3D").replace(/ /g,"%20");
            }
        }
    }

    var obj=document.getElementById(targetId);
    if (innerhtml != '') fbShowWaiting(obj,innerhtml);

    xReq.open("POST",baseurl,true);
    xReq.onreadystatechange=function(){fbEventGetUrlDiv(xReq,targetId);};
    xReq.setRequestHeader("Content-type","application/x-www-form-urlencoded"); 
    xReq.send(url);
}

function fbSendSubscribe(idForm,baseurl,targetId) {

    var xReq=getXmlHttpRequest();
    var i;
    var url="";
    var myForm=document.getElementById(idForm);

    if (myForm) {
        var first=true;
        for(i=0;i<myForm.elements.length;i++) {
            var elmt=myForm.elements[i];
            var type=elmt.nodeName.toLowerCase();
            var ok=true;

            if (type=="input") {
                switch (elmt.type.toLowerCase()) {
                case "radio":
                case "checkbox":
                    if (!elmt.checked) ok=false;
                    break;

                case "submit":
                case "image":
                    ok=false;
                    break;
                }
            }
            else if ((type!="select") && (type!="textarea")) ok=false;
            if (ok) {
                if (first) first=false;
                else url+="&";
                url+=elmt.name+"="+elmt.value.replace(/%/g,"%25").replace(/&/g,"%26").replace(/=/g,"%3D").replace(/ /g,"%20");
            }
        }
    }

    xReq.open("POST",baseurl,true);
    xReq.onreadystatechange=function(){fbEventGetUrlDivSubsribe(xReq,targetId);};
    xReq.setRequestHeader("Content-type","application/x-www-form-urlencoded"); 
    xReq.send(url);
}

function fbEventGetUrlDivSubsribe(xRequest,anId) {
    if (xRequest.readyState==4) {
        if (xRequest.responseText!="") document.getElementById(anId).innerHTML=xRequest.responseText;
    }
}

//


var fullMinHeight = 500;

var footerVisible = false;
var footerTimeout;
var footerDelay = 5;
var footerStep = 10;

//var footerHiddenHeight = 50;
var footerHiddenHeight = 60;

function actionFooter(urlC,urlO) {
  clearTimeout(footerTimeout);
  footerVisible = !footerVisible;

  var footerRequiredHeight = 350;
  if (document.getElementById('cartheader') && document.getElementById('cart'))
    footerRequiredHeight = document.getElementById('cartheader').offsetHeight + document.getElementById('cart').offsetHeight;


  if (footerVisible)
    startShowFooter(footerRequiredHeight,urlO);
  else
    startHideFooter(urlC);
}

function actionDisconnect(urlDisconnect) {
  fbGetUrlDiv('loginresume',urlDisconnect,'');
}

function startShowFooter(footerRequiredHeight,urlO) {
  if (window.document.cartlink) window.document.cartlink.src=urlO;
  footerVisible = true;
  showFooter(footerRequiredHeight);
}

function showFooter(footerRequiredHeight) {
  if (document.getElementById('footer')) {
    cHeight = document.getElementById('footer').offsetHeight;
    newHeight = cHeight+footerStep;

    if (newHeight>=footerRequiredHeight) {
      document.getElementById('footer').style.height = footerRequiredHeight+'px';
      document.getElementById('footer').style.top = (footerHiddenHeight-footerRequiredHeight)+'px';
    }
    else {
      document.getElementById('footer').style.height = newHeight+'px';
      document.getElementById('footer').style.top = (footerHiddenHeight-newHeight)+'px';
      footerTimeout = setTimeout('showFooter('+footerRequiredHeight+')',footerDelay);
    }
  }
}

function startHideFooter(urlC) {
  if (window.document.cartlink) window.document.cartlink.src=urlC;
  footerVisible = false;
  hideFooter();
}

function hideFooter() {
  if (document.getElementById('footer')) {
    cHeight = document.getElementById('footer').offsetHeight;
    newHeight = cHeight-footerStep;

    if (newHeight<=footerHiddenHeight) {
      document.getElementById('footer').style.height = footerHiddenHeight+'px';
      document.getElementById('footer').style.top = '0px';
    }
    else {
      document.getElementById('footer').style.height = newHeight+'px';
      document.getElementById('footer').style.top = (footerHiddenHeight-newHeight)+'px';
      footerTimeout = setTimeout('hideFooter()',footerDelay);
    }
  }
}

function s6630OnLoad() {
  goLayout = true;
  s6630SetLayout();
  initAscenseur('content');
}

function s6630OnResize(urlC) {
  footerVisible = false;
  if (window.document.cartlink) window.document.cartlink.src=urlC;
  document.getElementById('footer').style.height = footerHiddenHeight+'px';
  document.getElementById('footer').style.top = '0px';
  s6630OnLoad();
}

var goLayout = false;


function s6630SetLayout() {
  if (goLayout) {
    goLayout = false;
    if (self.innerHeight) // all except Explorer
      h = self.innerHeight;
    else if (document.documentElement && document.documentElement.clientHeight) // Explorer 6 Strict Mode
      h = document.documentElement.clientHeight;
    else if (document.body) // other Explorers
      h = document.body.clientHeight;

    var fullHeight = h;
    if (fullHeight<fullMinHeight) fullHeight = fullMinHeight;
    var contentHeight = fullHeight;

    document.getElementById('page').style.height = fullHeight+'px';
    newContentHeight = fullHeight-document.getElementById('header').offsetHeight-document.getElementById('footer').offsetHeight;
    document.getElementById('content').style.height = newContentHeight+'px';
//    document.getElementById('content_container').style.height = (newContentHeight-5)+'px';

    goLayout = true;
  }
}

function s6630SetCheckoutLayout() {
  if (self.innerHeight) // all except Explorer
    h = self.innerHeight;
  else if (document.documentElement && document.documentElement.clientHeight) // Explorer 6 Strict Mode
    h = document.documentElement.clientHeight;
  else if (document.body) // other Explorers
    h = document.body.clientHeight;

  var fullHeight = h;
  if (fullHeight<fullMinHeight) fullHeight = fullMinHeight;
  var contentHeight = fullHeight;

  document.getElementById('page').style.height = fullHeight+'px';
//  if (document.getElementById('checkoutcontent')) {
//    document.getElementById('page').style.height = fullHeight+'px';
//    document.getElementById('checkoutcontent').style.height = (fullHeight-document.getElementById('cartcheckoutheader').offsetHeight)+'px';
//  }
}

function s6630AddToCart(idP,qt,msg) {
  var xReq=getXmlHttpRequest();
  xReq.open("GET","default.php?fct=addtocart&i="+idP+"&q="+qt,true);
  xReq.onreadystatechange=function(){fbEventRefreshCart(xReq,msg);};
  xReq.send(null);
}

function s6630UpdateQuantityCart(idP,qt) {
  var xReq=getXmlHttpRequest();
  xReq.open("GET","default.php?fct=updatecart&i="+idP+"&q="+qt,true);
  xReq.onreadystatechange=function(){fbEventRefreshCart(xReq,'');};
  xReq.send(null);
}

function fbEventRefreshCart(xRequest,msg) {
  if (xRequest.readyState==4) {
    var xReqResume=getXmlHttpRequest();
    xReqResume.open("GET","default.php?fct=cartresume",true);
    xReqResume.onreadystatechange=function(){fbEventGetUrlDiv(xReqResume,"cartresume");};
    xReqResume.send(null);

    var xReq=getXmlHttpRequest();
    xReq.open("GET","default.php?fct=cart",true);
    xReq.onreadystatechange=function(){fbEventGetUrlCart(xReq,"cart",msg);};
    xReq.send(null);
  }
}

function fbEventGetUrlCart(xRequest,anId,msg) {
    if (xRequest.readyState==4) {
        document.getElementById(anId).innerHTML=xRequest.responseText;
        if (document.getElementById('cartheader') && document.getElementById('cart') && footerVisible) {
          footerRequiredHeight = document.getElementById('cartheader').offsetHeight + document.getElementById('cart').offsetHeight;
          showFooter(footerRequiredHeight);
        }
        if (msg!='') showMessage(msg);
    }
}



function checkoutShippingSelectAddress(urlA,urlM) {
  refreshMethod = true;
  urlMehtod = urlM;
  fbGetUrlDiv('fullshipping',urlA,'');
}

function checkoutShippingAddAddress(urlA,urlM) {
  refreshMethod = true;
  urlMehtod = urlM;
  processShippingSubmitFormDiv(urlA,'save','divmainshipping');
}


function fbSendAjaxFormTargetDiv(idForm,baseurl,targetId,innerhtml) {
    var xReq=getXmlHttpRequest();
    var i;
    var url="";
    var myForm=document.getElementById(idForm);

    if (myForm) {
        var first=true;
        for(i=0;i<myForm.elements.length;i++) {
            var elmt=myForm.elements[i];
            var type=elmt.nodeName.toLowerCase();
            var ok=true;

            if (type=="input") {
                switch (elmt.type.toLowerCase()) {
                case "radio":
                case "checkbox":
                    if (!elmt.checked) ok=false;
                    break;

                case "submit":
                    break;
                case "image":
                    ok=false;
                    break;
                }
            }
            else if ((type!="select") && (type!="textarea")) ok=false;
            if (ok) {
                if (first) first=false;
                else url+="&";
                url+=elmt.name+"="+elmt.value.replace(/%/g,"%25").replace(/&/g,"%26").replace(/=/g,"%3D").replace(/ /g,"%20");
            }
        }
    }

    var obj=document.getElementById(targetId);
    if (innerhtml != '') fbShowWaiting(obj,innerhtml);

    xReq.open("POST",baseurl,true);
    xReq.onreadystatechange=function(){fbEventGetUrlDiv(xReq,targetId);};
    xReq.setRequestHeader("Content-type","application/x-www-form-urlencoded"); 
    xReq.send(url);
}

var divMsgCreated = 0;
var divMsg;
var hideMsgDelay = 3500;

function showMessage(msg) {
  if (divMsgCreated==0) {
    divMsgCreated++;
    divMsg = document.createElement('div');
    divMsg.setAttribute('id', 'divMsg');
    divMsg.style.position = 'absolute';
    document.body.appendChild(divMsg);
    //divMsg.style.backgroundColor = '#FFFFFF';
    //divMsg.style.padding = '10px';
    //divMsg.style.border = '1px solid #636363';
    //divMsg.style.border = '1px solid #B1005D';
  }
  if (divMsg) {
    divMsg.innerHTML = msg;

    if (self.innerHeight) { // all except Explorer
      w = self.innerWidth;
      h = self.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
      w = document.documentElement.clientWidth;
      h = document.documentElement.clientHeight;
    }
    else if (document.body) { // other Explorers
      w = document.body.clientWidth;
      h = document.body.clientHeight;
    }

//    divMsg.style.top = (Math.round((h-divMsg.offsetHeight)/2))+'px';
//    divMsg.style.left = (Math.round((w-divMsg.offsetWidth)/2))+'px';
    //divMsg.style.top = (Math.round(h-divMsg.offsetHeight-document.getElementById('footer').offsetHeight))+'px';
    //divMsg.style.left = (Math.round((w-divMsg.offsetWidth)/2))+'px';
    divMsg.style.top = (h-document.getElementById('footer').offsetHeight+3)+'px';
    divMsg.style.left = (document.getElementById('cartheader').offsetWidth-document.getElementById('cartheader').style.left-divMsg.offsetWidth)+'px';

    divMsg.style.visibility = 'visible';
    showdiv('divMsg');

    //document.getElementById('cartresume').style.fontWeight = 'bold';

    setTimeout('hidediv(\'divMsg\')',hideMsgDelay);
  }
}

function processOrderSubmitForm(btnValue) {
  document.fprocessorder.btn.value = btnValue;
  document.fprocessorder.submit();
}

function processShippingSubmitFormDiv(baseurl,btnValue,div) {
  document.fprocessshipping.btn.value = btnValue;
  fbSendAjaxFormTargetDiv('fprocessshipping',baseurl,div,'');
}



var detailsIdArr = new Array();
var detailsValueArr = new Array();
//var detailsVisible = false;
var detailsTimeout;
var detailsDelay = 5;
var detailsStep = 10;

function actionDetails(idCat,urlC,urlO) {
  clearTimeout(detailsTimeout);

  rank = inArray(detailsIdArr,idCat);
  if (rank>=0)
    detailsValueArr[rank] = !detailsValueArr[rank];
  else {
    rank = detailsIdArr.length;
    detailsIdArr.push(idCat);
    detailsValueArr.push(true);
  }

  if (detailsValueArr[rank]) {
    for(var i=0,l=detailsValueArr.length;i<l;i++) {
      if(detailsValueArr[i]) {
        detailsValueArr[i] = false;
        startHideDetails(detailsIdArr[i],urlC);
      }
    }
    detailsValueArr[rank] = true;
    startShowDetails(idCat,urlO);
  }
  else
    startHideDetails(idCat,urlC);

}

function startShowDetails(idCat,urlO) {
  if (document.getElementById('det_o_'+idCat) && document.getElementById('det_i_'+idCat)) {
    if (document.getElementById('detailslink_'+idCat)) document.getElementById('detailslink_'+idCat).src=urlO;
    reqHeight = document.getElementById('det_i_'+idCat).offsetHeight;
    showDetails(idCat,reqHeight);
  }
}

function showDetails(idCat,reqHeight) {
  cHeight = document.getElementById('det_o_'+idCat).offsetHeight;
  newHeight = cHeight+detailsStep;

  if (newHeight>=reqHeight) {
    document.getElementById('det_o_'+idCat).style.height = reqHeight+'px';
    initAscenseur('content');
  }
  else {
    document.getElementById('det_o_'+idCat).style.height = newHeight+'px';
    detailsTimeout = setTimeout('showDetails('+idCat+','+reqHeight+')',detailsDelay);
  }
}


function startHideDetails(idCat,urlC) {
  if (document.getElementById('det_o_'+idCat) && document.getElementById('det_i_'+idCat)) {
    hideDetails(idCat);
    if (document.getElementById('detailslink_'+idCat)) document.getElementById('detailslink_'+idCat).src=urlC;
  }
}

function hideDetails(idCat) {
  if (document.getElementById('det_o_'+idCat)) {
    cHeight = document.getElementById('det_o_'+idCat).offsetHeight;
    newHeight = cHeight-detailsStep;

    if (newHeight<=0) {
      document.getElementById('det_o_'+idCat).style.height = '0px';
      initAscenseur('content');
    }
    else {
      document.getElementById('det_o_'+idCat).style.height = newHeight+'px';
      detailsTimeout = setTimeout('hideDetails('+idCat+')',detailsDelay);
    }
  }
}

function inArray(myArray,myVal) {
    for(var i=0,l=myArray.length;i<l;i++)
      if(myArray[i]==myVal) return i;
    return -1;
}


function displayAddr(city) {
  if (divMain=document.getElementById('content_main')) {
    if (arrDiv=divMain.getElementsByTagName('div')) {
      for (var i=0;i<arrDiv.length;i++) {
        if (arrDiv[i].id.substring(0,7)=='addr-o-' && arrDiv[i].id!=('addr-o-'+city))
          arrDiv[i].style.height = '0px';
      }
      if (document.getElementById('addr-o-'+city) && document.getElementById('addr-i-'+city)) {
        document.getElementById('addr-o-'+city).style.height = document.getElementById('addr-i-'+city).offsetHeight+'px';
      }
      initAscenseur('content');
    }
  }
}


// Slider text - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

var slider = new Array();
          
// scroll the element vertically based on its width and the slider maximum value
function scrollVertical(value, element, nom) {
  element.scrollTop = Math.round(value*slider[nom].scrollMax);
}

function monter(nom) {
  slider[nom].setValueBy(-40/slider[nom].scrollMax);
}
          
function descendre(nom) {
  slider[nom].setValueBy(40/slider[nom].scrollMax);
}
          
// mouse wheel code from http://adomas.org/javascript-mouse-wheel/
function handle(delta,nom) {
  slider[nom].setValueBy(-(delta*60)/slider[nom].scrollMax);
}
      
function initSlider0(adiv) {
  var max = $(adiv+'_main').scrollHeight-$(adiv+'_main').offsetHeight;
  s = new Control.Slider('content_slider_ascenseur', 'content_slider_chemin', {
    axis: 'vertical',
    onSlide: function(v) { scrollVertical(v, $(adiv+'_main'), 'content');  },
    onChange: function(v) { scrollVertical(v, $(adiv+'_main'), 'content'); }
  });
  s.scrollMax = max;
  slider['content']=s;
}
      
function wheel0(event) { 
  var delta = 0;
  if (!event) /* For IE. */
    event = window.event;
  if (event.wheelDelta) { /* IE/Opera. */
    delta = event.wheelDelta/120;
  /** In Opera 9, delta differs in sign as compared to IE. */
  if (window.opera)
    delta = -delta;
  }
  else if (event.detail) { /** Mozilla case. */
    /** In Mozilla, sign of delta is different than in IE.
      * Also, delta is multiple of 3. */
    delta = -event.detail/3;
  }
      
/** If delta is nonzero, handle it.
  * Basically, delta is now positive if wheel was scrolled up,
  * and negative, if wheel was scrolled down. */
  if (delta)
    handle(delta,'content');
      
/** Prevent default actions caused by mouse wheel.
  * That might be ugly, but we handle scrolls somehow
  * anyway, so don't bother here..
  */
  if (event.preventDefault)
    event.preventDefault();
              
  event.returnValue = false;
}
          
function initMouseWheel0(adiv) {
  // mozilla
  Event.observe(adiv+'_main', 'DOMMouseScroll', wheel0);
  // IE/Opera
  Event.observe(adiv+'_main', 'mousewheel', wheel0);
}
      
function initAscenseur(adiv) {
  if (document.getElementById(adiv+'_container') && document.getElementById(adiv+'_main')
      && document.getElementById(adiv+'_slider') && document.getElementById(adiv+'_slider_chemin')) {

    theHeight = document.getElementById(adiv).offsetHeight;
    document.getElementById(adiv+'_container').style.height = theHeight+'px';
    document.getElementById(adiv+'_main').style.height = theHeight+'px';
    document.getElementById(adiv+'_slider').style.height = theHeight+'px';
    document.getElementById(adiv+'_slider_chemin').style.height = theHeight+'px';

    if ($(adiv+'_main').scrollHeight > $(adiv+'_main').offsetHeight) {
      $(adiv+'_slider').style.display='block';
      //divTexte = $(adiv+'_main');
      //largeur = divTexte.offsetWidth;
      //largeur2 = largeur-10;
      //divTexte.style.width = largeur2+'px';
      initSlider0(adiv);
      initMouseWheel0(adiv);
      showdiv(adiv+'_slider');
    }
    else
      $(adiv+'_slider').style.display='none';
  }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
 
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
 
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

