// JavaScript Document

	var imagesPath = "/skins/default/images/";
    var rootDir = "/";
	var lang = "fr";
    var PLang = (lang=='fr')?'/':'/'+lang+'/'; 

// Appends Get Vars into js Vars

	var url = String(self.location);
	var tmp = url.split("?");
	if (tmp[1]) {
		var queryString = tmp[1];
		vars = queryString.split('#');
		vars = vars[0].split('&');

		var _GET = new Array();

		for (var i = 0 ; i < vars.length; ++i ) {
			tmp = vars[i].split('=');
			_GET[tmp[0]] = tmp[1];
		}
	}
    
// on va cacher les images du menu & more
var imgs = new Array();
var imgsIds = new Array();


for (idd in imgsIds) {
imgs[imgsIds[idd]] = { on: new Image(), off:new Image() };
imgs[imgsIds[idd]].on.src = 'imgs/menu'+imgsIds[idd]+'on.gif';
imgs[imgsIds[idd]].off.src = 'imgs/menu'+imgsIds[idd]+'off.gif';
}

function Traduction(id) {
 if (textes[lang] && textes[lang][id]) return textes[lang][id];
 else textes['fr'][id];
}

var textes = new Array();
textes['fr'] = {
 panierOK: 'Le produit a &eacute;t&eacute; ajouter &agrave; votre panier.',
 panierCookie: 'Vous devez activer les &laquo;cookies&raquo; dans les pr&eacute;f&eacute;rences de votre navigateur pour pouvoir demander un devis.<br><br><a href="aide-cookies.html">Cliquez ici pour savoir comment activer les cookies.</a>',
 nbProduct: 'produit dans votre panier',
 nbProducts: 'produits dans votre panier',
 panierVider: 'Vider votre panier',
 panierVide: 'Votre panier est vide',
 panierValider: 'Valider votre commande',
 panier: 'panier'
 };

textes['en'] = {
 panierOK: 'This product has been succefuly added to your cart.',
 panierCookie: 'Vous devez activer les &laquo;cookies&raquo; dans les pr&eacute;f&eacute;rences de votre navigateur pour pouvoir demander un devis.<br><br><a href="aide-cookies.html">Cliquez ici pour savoir comment activer les cookies.</a>',
 nbProduct: 'product in your cart',
 nbProducts: 'products in your cart',
 panierVider: 'Empty your cart',
 panierVide: 'Your cart is empty',
 panierValider: 'Checkout Now',
 panier: 'cart'
 };
 
 
 	function linkify (text) {
		text = text.replace(/[é;è;ê;ë]/g,'e');
		text = text.replace(/à/g,'a');
		text = text.replace(/ç/g,'c');
		text = text.replace(/[,; ;';"]/g,'+');
		text = text.replace(/[?;&]/g,'');
		return text;
	}
	
	function rechercheRapide(){
		if (_Elem('mot_clef').value.length > 0) {
			self.location = '/recherche/'+linkify(_Elem('mot_clef').value)+'/';
		}
	}
    
    var dx = -1;
    var pas = 10;
    var x = -145;
    var Xmin = -145;
    var Xmax = 555;
    
    function moveCoup2coeur() {
        if (dx == 1) {
        // montre
        x = x + dx*pas ;
        _Elem('coup2coeur').style.left = x+'px';
        if (x <= Xmax-dx*pas) setTimeout("moveCoup2coeur()",10);
        else _Elem('coup2coeurPannelI').src = _Elem('coup2coeurPannelI').src.replace(/open/,'close');

        } else if (dx == -1 ) {
        // cache
        x = x + dx*pas ;
        _Elem('coup2coeur').style.left = x+'px';
        if (x >= Xmin - dx*pas) setTimeout("moveCoup2coeur()",10);
        else _Elem('coup2coeurPannelI').src = _Elem('coup2coeurPannelI').src.replace(/close/,'open');

        } else {
            // fini
        }
        
    }
    
    function showCoup2coeur() {        
        Xmax = (parseInt(document.body.clientWidth) - 1000) / 2;
        if (dx==-1) {
            if ( (x >= Xmin) && (x < Xmax) ) {
            dx = 0 - dx ;
            setTimeout("moveCoup2coeur()",10);
            }
        } else {        
            if ( (x <= Xmax) && (x > Xmin) ){
            dx = 0 - dx ;
            setTimeout("moveCoup2coeur()",10);
            }
        }
    }
    function hideCoup2coeur() {
        Xmax = (parseInt(document.body.clientWidth) - 155 ) / 2;
        if ( (x <= Xmax) && (x > Xmin) ){
        dx = -1;
        setTimeout("moveCoup2coeur()",10);
        }
    }
    
    
// JavaScript Document
var sAgent = navigator.userAgent.toLowerCase() ;
if (sAgent.indexOf("msie") == -1) {
  var IE = 0;
} else { var IE = 1; }

var mouseX = 0;
var mouseY = 0;
function getMouseXY() {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  /*mouseX = tempX;
  mouseY = tempY;*/
  return {x:tempX, y:tempY};
  //alert(mouseX+'x'+mouseY);
}
var mousePos;
if (!IE) { document.onmousemove = mouseMove; }
function mouseMove(ev){
	ev           = ev || window.event;
	mousePos = mouseCoords(ev);
}

function mouseCoords(ev){
	if(ev.pageX || ev.pageY){
		return {x:ev.pageX, y:ev.pageY};
	}
	return {
		x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
		y:ev.clientY + document.body.scrollTop  - document.body.clientTop
	};
}

// surcharge de la fonction getElementById pour simplifer le codage
function _Elem(id) {
  return document.getElementById(id);
}

function Show() {
	for (var i = 0; i < arguments.length; ++i) {
		_Elem(arguments[i]).style.display = 'block';
		_Elem(arguments[i]).style.visibility = 'visible';
	}
}

function Hide() {
	for (var i = 0; i < arguments.length; ++i) {
		_Elem(arguments[i]).style.display = 'none';
		_Elem(arguments[i]).style.visibility = 'hidden';
	}
}

function showHide(id) {
	if (_Elem(id).style.display != 'none')
		Hide(id);
	else
		Show(id);
		
}

function ucFirst(str) {
   return str.substr(0,1).toUpperCase() + str.substr(1,str.length);
}

function checkMail(adresse){

var regEx = /([a-z0-9]+([-_]?[a-z0-9]+)*.)*[a-z0-9]+([-_]?[a-z0-9]+)*@([a-z0-9]+([-_]?[a-z0-9]+)*.)+[a-z]{1,4}/gi;  

if (adresse.match(regEx) != adresse ) {

 return false;

} else {

 return true;

}

}

var cp = '';
var old_cp = '';
var villePrx = '';
function doVilles(prx) {
	var remoteVilles = new villes(villesCallBack);
  cp = _Elem(prx+'code_postal').value;
  if (cp != old_cp){
    if (cp) { remoteVilles.getvilles(cp); }
    old_cp = cp ;
	villePrx = prx;
  }
}

var villesCallBack = {
  getvilles: function (aryVilles) {
    var sel = _Elem(villePrx+'ville_id');
    sel.length=0;

	if (!aryVilles) {
		var res = document.createElement('option');
        res.value=0;
        res.innerHTML='Pas de villes pour ce Code postal';
        sel.appendChild(res);
	}
    else {
      for (var i = 0; i < aryVilles.length; ++i) {
        var res = document.createElement('option');
        res.value=aryVilles[i]['ville_id'];
        res.innerHTML=aryVilles[i]['commune'];
        sel.appendChild(res);
      }
      }
    }
  }

function checkMaquette() {
  nbErr = 0;
  fieldToFocus = 'none';
  aryReq = new Array('nom','telephone','email','delais');
  for (i=0; i<aryReq.length; i++) {
    if (_Elem(aryReq[i]).value) {
      _Elem(aryReq[i]).style.borderColor = "#666666";
    } else {
      _Elem(aryReq[i]).style.borderColor = "#cc0000";
      nbErr++;
      if (fieldToFocus == 'none') fieldToFocus = aryReq[i];
    }
  }
  
  if (nbErr > 0) _Elem(fieldToFocus).focus();
  else return true;
  return false;
}

function checkContact() {
  nbErr = 0;
  fieldToFocus = 'none';
  aryReq = new Array('nom','telephone','email','message');
  for (i=0; i<aryReq.length; i++) {
    if (_Elem(aryReq[i]).value) {
      _Elem(aryReq[i]).style.borderColor = "#432110";
		_Elem(aryReq[i]).style.backgroundColor = "#ffffff";
    } else {
      _Elem(aryReq[i]).style.borderColor = "#ff0000";
		_Elem(aryReq[i]).style.backgroundColor = "#EACEB5";
      nbErr++;
      if (fieldToFocus == 'none') fieldToFocus = aryReq[i];
    }
  }
  
  if (nbErr > 0) _Elem(fieldToFocus).focus();
  else return true;
  return false;
}

function checkMdp() {
  nbErr = 0;
  fieldToFocus = 'none';
  aryReq = new Array('mdp1','mdp2');
  for (i=0; i<aryReq.length; i++) {
    if (_Elem(aryReq[i]).value) {
      _Elem(aryReq[i]).style.borderColor = "#000000";
		_Elem(aryReq[i]).style.backgroundColor = "#ffffff";
    } else {
      _Elem(aryReq[i]).style.borderColor = "#ff0000";
		_Elem(aryReq[i]).style.backgroundColor = "#EACEB5";
      nbErr++;
      if (fieldToFocus == 'none') fieldToFocus = aryReq[i];
    }
  }
  if (_Elem('mdp1').value && _Elem('mdp2').value && (_Elem('mdp1').value == _Elem('mdp2').value)) {  
	_Elem('mdp1').style.borderColor = "#cecece";
	_Elem('mdp1').style.backgroundColor = "#ffffff";
	_Elem('mdp2').style.borderColor = "#cecece";
	_Elem('mdp2').style.backgroundColor = "#ffffff";
  } else {
	_Elem('mdp1').style.borderColor = "#ff0000";
	_Elem('mdp1').style.backgroundColor = "#EACEB5";
	_Elem('mdp2').style.borderColor = "#ff0000";
	_Elem('mdp2').style.backgroundColor = "#EACEB5";
	nbErr++;
	if (fieldToFocus == 'none') fieldToFocus = 'ville_id';
  }
  if (nbErr > 0) _Elem(fieldToFocus).focus();
  else return true;
  return false;
}

function checkCoordonnee(isCrea) {
  nbErr = 0;
  fieldToFocus = 'none';
  if (isCrea) aryReq = new Array('email','pwd1','pwd2','nom','adresse1','code_postal','telephone');
  else aryReq = new Array('email','nom','adresse1','code_postal','telephone');
  for (i=0; i<aryReq.length; i++) {
    if (_Elem(aryReq[i]).value) {
      _Validate(aryReq[i]);
    } else {
      _Error(aryReq[i]);
      nbErr++;
      if (fieldToFocus == 'none') fieldToFocus = aryReq[i];
    }
  }
  if (isCrea) {
    // les mots de passes
    // 2- si ils sont saissis ils doivent etre identiques
    Mpwd1 = _Elem('pwd1').value;
    Mpwd2 = _Elem('pwd2').value;
    if ( (isCrea == 0 && Mpwd1 == Mpwd2 ) ||
      (isCrea == 1 && Mpwd1 && Mpwd2 && Mpwd1 == Mpwd2 )) {
      _Validate('pwd1');
      _Validate('pwd2');   
    } else {
      _Error('pwd1');
      _Error('pwd2');
      nbErr++;
      if (fieldToFocus == 'none') fieldToFocus = 'pwd1';
    }
  }
  if (_Elem('ville_id').value == 0) {
	_Error('ville_id');
	nbErr++;
	if (fieldToFocus == 'none') fieldToFocus = 'ville_id';
  } else {
	_Validate('ville_id');
  }
  if (nbErr > 0) _Elem(fieldToFocus).focus();
  else return true;
  return false;
}

function _Validate(id) {
  _Elem(id).style.borderColor = "#cecece";
  _Elem(id).style.backgroundColor = "#ffffff";
}

function _Error(id) {
  _Elem(id).style.borderColor = "#ff0000";
  _Elem(id).style.backgroundColor = "#EACEB5";
}

function checkBdc() {
  nbErr = 0;
  fieldToFocus = 'none';
  aryReq = new Array('bdc_nom', 'bdc_prenom', 'bdc_adresse', 'bdc_code_postal', 'bdc_ville',
                     'bdc_telephone', 'bdc_email', 'bdc_destination', 'bdc_date_depart', 'bdc_date_retour', 'bdc_frais_consulaires', 'bdc_frais_retour');
  for (i=0; i<aryReq.length; i++) {
    if (_Elem(aryReq[i])) {
      if (_Elem(aryReq[i]).value) {
        _Elem(aryReq[i]).style.borderColor = "#000000";
      } else {
        _Elem(aryReq[i]).style.borderColor = "#ff0000";
        nbErr++;
        if (fieldToFocus == 'none') fieldToFocus = aryReq[i];        
      }
    }
  }
  
  // frais consulaires..
  if (_Elem('bdc_frais_consulaires').value && (_Elem('bdc_frais_consulaires').value*1 == _Elem('bdc_frais_consulaires').value)) {
    _Elem('bdc_frais_consulaires').style.borderColor = "#000000";
  } else {
    _Elem('bdc_frais_consulaires').style.borderColor = "#ff0000";
    nbErr ++;
    if (fieldToFocus == 'none') fieldToFocus = 'bdc_frais_consulaires';    
  }
  
  if (_Elem('bdc_frais_retour').value && (_Elem('bdc_frais_retour').value*1 == _Elem('bdc_frais_retour').value)) {
    _Elem('bdc_frais_retour').style.borderColor = "#000000";
  } else {
    _Elem('bdc_frais_retour').style.borderColor = "#ff0000";
    nbErr ++;
    if (fieldToFocus == 'none') fieldToFocus = 'bdc_frais_retour';    
  }
  
  if (nbErr > 0) { _Elem(fieldToFocus).focus(); return false; }
  else return true;
}


function imgOpacity(obj,alpha) {
    if (obj.firstChild.className == 'offreLienOff') {
    obj.firstChild.style.opacity = alpha;
    obj.firstChild.style.MozOpacity = alpha;
    obj.firstChild.style.filter = "alpha(opacity="+(alpha*100)+")";
    }
}

function changeFraisRetour(val) {
  tmp = val.split(':');
  if (tmp[1] *1 > 0) {
    _Elem('bdc_mode_expedition').value = tmp[0];
  _Elem('bdc_frais_retour').value = tmp[1];
  
  } else {
    _Elem('bdc_mode_expedition').value = tmp[0];
    _Elem('bdc_frais_retour').value = 'nous consulter';
  }
}

function Move(id, X, Y) {
         _Elem(id).style.left = X;
         _Elem(id).style.top = Y;
}
function createAkisiBulle() {
         tmp = document.createElement('div');
         tmp.id = 'AkisiBulleDiv';
         tmp.style.position = 'absolute';
         tmp.style.zIndex = '1000';
         document.body.appendChild(tmp);
         if (IE) {
         tmp2 = document.createElement('iframe');
         tmp2.id = 'AkisiBulleIframe';
         tmp2.style.position = 'absolute';
         tmp2.style.height = '25px';
         tmp2.style.zIndex = '999';
         document.body.appendChild(tmp2);
         }         
}
function HideAkisiBulle() {_Elem('AkisiBulleDiv').innerHTML = ''; Hide('AkisiBulleDiv'); if (IE) Hide('AkisiBulleIframe'); }
function AkisiBulleFollowMouse() {
 if (IE) mousePos = getMouseXY();
 Move('AkisiBulleDiv',mousePos.x+5, mousePos.y+5);
 if (IE) {
 _Elem('AkisiBulleIframe').style.width = _Elem('AkisiBulleDiv').clientWidth; 
 _Elem('AkisiBulleIframe').style.height = _Elem('AkisiBulleDiv').clientHeight;
 Move('AkisiBulleIframe',mousePos.x+5, mousePos.y+5);
 }
}
function AkisiBulle(obj, texte) {
 if (!_Elem('AkisiBulleDiv')) { createAkisiBulle() ;}
 Show('AkisiBulleDiv') 
 if (IE) Show('AkisiBulleIframe');
 if (IE) { 
    document.onmousemove = AkisiBulleFollowMouse;
    obj.onmouseout = HideAkisiBulle;
 } else {
    document.addEventListener('mousemove', AkisiBulleFollowMouse, true);
    obj.addEventListener('mouseout', HideAkisiBulle, true);
  } 
 _Elem('AkisiBulleDiv').innerHTML = texte;
}

var cp = '';
var old_cp = '';
var villePrx = '';
function doVilles(prx) {
  //var remoteVilles = new villes(villesCallBack);
  cp = _Elem(prx+'code_postal').value;
  if (cp != old_cp){
    //if (cp) { remoteVilles.getvilles(cp); }
    if (cp) { AkisiJax('ville.php?cp='+cp); }
    old_cp = cp ;
	villePrx = prx;
  }
}

var villesCallBack = {
  getvilles: function (aryVilles) {
    var sel = _Elem(villePrx+'ville_id');
    sel.length=0;

	if (!aryVilles) {
		var res = document.createElement('option');
        res.value=0;
        res.innerHTML='Pas de villes pour ce Code postal';
        sel.appendChild(res);
	}
    else {
      for (var i = 0; i < aryVilles.length; ++i) {
        var res = document.createElement('option');
        res.value=aryVilles[i]['ville_id'];
        res.innerHTML=aryVilles[i]['commune'];
        sel.appendChild(res);
      }
      }
    }
  }
function _Alpha(id,val) {
  _Elem(id).style.opacity = val/100;
  _Elem(id).style.MozOpacity = val/100;
  _Elem(id).style.filter = "alpha(opacity="+val+")";
}

var Texte = new Array();
Texte['date'] = 'Entrez une date au format:<br>jj/mm/aaaa';
Texte['frais_consulaires'] = 'Indiquez ici le montnant des frais consulaires pour votre visa. Vous le trouverez dans la partie <b>Tarifs</b> de notre site.';
Texte['frais_retour'] = 'Indiquez ici le montnant des frais de retour qui varient suivant le mode de livraison de votre visa. Vous le trouverez dans la partie <b>Tarifs</b> de notre site.';

function AkisiJax(what) {
    var xjs=document.createElement('script');
    xjs.src=what;
    xjs.id = 'AkisiJax';
    document.getElementsByTagName('head')[0].appendChild(xjs);
}

function removeAkisiJaxScript() {
      document.getElementsByTagName("head").item(0).removeChild(_Elem('AkisiJax'));

}

function villesSelect(aryVilles) {
    var sel = _Elem(villePrx+'ville_id');
    sel.length=0;

	if (!aryVilles) {
		var res = document.createElement('option');
        res.value=0;
        res.innerHTML='Pas de villes pour ce Code postal';
        sel.appendChild(res);
	}
    else {
      for (var i = 0; i < aryVilles.length; ++i) {
        var res = document.createElement('option');
        res.value=aryVilles[i]['ville_id'];
        res.innerHTML=aryVilles[i]['commune'];
        sel.appendChild(res);
      }
    }
    removeAkisiJaxScript();
  }
  
var aryImgs = Array();
var nbImg = 6;
var idx = 0;
for (idx=0; idx<nbImg; idx++)
  {
aryImgs[idx] = new Image() ;
aryImgs[idx].src = 'image/image'+(idx+1)+'.png';
  }

var cur = 0;
var dx = 0;

function imagesDance() {
    cur++;
    _Elem('slider').removeChild(_Elem('slider').firstChild);
    tmp = document.createElement('img');
    tmp.width="100";
    tmp.height="60";
    //tmp.hspace="5";
    tmp.src=aryImgs[(cur+8)%nbImg].src;
    _Elem('slider').appendChild(tmp);
}
function decalImages() {
    pas = 1;
        
    _Elem('slider').style.left = dx+'px';
    dx -= pas;
    if (dx == (-100-pas)) {
        //swapImages();
        imagesDance();
        _Elem('slider').style.left = '0px';
        dx = 0;
    }
     setTimeout('decalImages()',30);
}

var wid = 0;
var Zstr;
function initWordZoom() {
  Zstr = _Elem('slogan').innerHTML;
  setInterval('wordZoom()',350);
  //alert(Zstr);
}
function wordZoom() {
  var aryStr = Zstr.split(' ');
  var retr = '';
  for (i=0; i<aryStr.length;i++) {
	 if (i==wid) retr += '<span style="font-size:1.4em;color:#FF0000">'+aryStr[i]+'</span> ';
	 else retr += aryStr[i]+' ';
  }
  wid = (wid + 1) % aryStr.length;
  _Elem('slogan').innerHTML = retr;
}
function Scroller(id, animation, speed) {
    this.id = id;
    this.aryDiv= new Array();
    this.nbDiv= 0;
    this.currDivIdx= 0;
    this.nextDivIdx= 0;
    this.width=250;
    this.height=120;
    if (speed) this.speed=-speed; else this.speed = -10;
    this.timer=0;
    this.run=true;
    this.alpha = 100;
    
    this.displayTime = 15000;
    
    if (animation) this.animation=animation; else this.animation = 'Diapo';
    
    this.Init = function () {
            tmp = _Elem(this.id).childNodes;
            j=0;
            for (i=0; i<tmp.length; i++) {
                    if (tmp[i].id){
                    this.aryDiv[j] = tmp[i];
                    j++;
                    }
            }
            
            if (this.aryDiv.length > 0) {
                    this.nbDiv = this.aryDiv.length;
                    this.currDivIdx = this.nbDiv-1;
                    
                    this.nextDivIdx = 0;
                    if (this.nextDivIdx>=this.nbDiv) this.nextDivIdx = 0;
            }
    };
    
    this.Swap = function() {
            this.timer = 10;
            eval ('this.'+this.animation+'()');
            if (this.run)
            eval ('this.TimeOut = setTimeout("s'+this.id+'.Swap()",this.timer);');
    }
    
    this.Change = function() {
            Hide(this.aryDiv[this.currDivIdx].id);
            Show(this.aryDiv[this.nextDivIdx].id);
            this.currDivIdx++;
            this.nextDivIdx++;
            if (this.currDivIdx>=this.nbDiv) this.currDivIdx = 0;
            if (this.nextDivIdx>=this.nbDiv) this.nextDivIdx = 0;
    }
    
    this.DiapoH = function() {
            this.width += this.speed;
            _Elem(this.id).style.width = this.width;			
            if (this.width == 0) {
                    this.speed = -this.speed;
                    this.Change();
            }
            if (this.width == 180) {
                    this.speed = -this.speed;
                    this.timer = this.displayTime ;
                    clearTimeout(this.TimeOut);
            }
            if (this.width == 180 && this.nbDiv == 1) this.run = false;			
    }
    
    this.DiapoVH = function() {
            _Elem(this.id).parentNode.style.verticalAlign = 'middle';
            this.height += this.speed;
            this.width += this.speed;
            _Elem(this.id).style.height = this.height;
            _Elem(this.id).style.width = this.width;
            if (this.width  == 0) {
                    this.speed = -this.speed;
                    this.Change();
            }
            if (this.width  == 120) {
                    this.speed = -this.speed;
                    this.timer = this.displayTime ;
                    clearTimeout(this.TimeOut);
            }
            if (this.width  == 120 && this.nbDiv == 1) this.run = false;						
    }
    
    this.DiapoV = function() {
            this.height += this.speed;
            _Elem(this.id).style.height = this.height;
            if (this.height == 0) {
                    this.speed = -this.speed;
                    _Elem(this.id).style.height = "1px";
                    this.Change();
            }
            if (this.height == 120) {
                    this.speed = -this.speed;				
                    this.timer = this.displayTime ;
                    clearTimeout(this.TimeOut);
            }
            if (this.height == 120 && this.nbDiv == 1) this.run = false;			
    }
    
    this.Fade = function () {
            this.alpha+=this.speed;
            _Elem(this.id).style.opacity = this.alpha/100;
            _Elem(this.id).style.MozOpacity = this.alpha/100;
            _Elem(this.id).style.filter = "alpha(opacity="+this.alpha+")";
            if (this.alpha == 0) {
                    this.speed = -this.speed;
                    this.Change();
            }
            if (this.alpha == 100) {
                    this.speed = -this.speed;
                    this.timer = this.displayTime;
                    clearTimeout(this.TimeOut);
            }
            if (this.alpha == 100 && this.nbDiv == 1) this.run = false;	
    }
}	

function scrollInit(id, anim, speed) {
    eval('s'+id +'= new Scroller("'+id+'","'+anim+'","'+speed+'");');
    eval('s'+id +'.Init();');
    if (eval('s'+id +'.nbDiv') > 0)		
    eval ('setTimeout("s'+id+'.Swap()",s'+id+'.timer);');		
}/*	Unobtrusive Flash Objects (UFO) v3.22 <http://www.bobbyvandersluis.com/ufo/>
	Copyright 2005-2007 Bobby van der Sluis
	This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>
*/

var UFO = {
	req: ["movie", "width", "height", "majorversion", "build"],
	opt: ["play", "loop", "menu", "quality", "scale", "salign", "wmode", "bgcolor", "base", "flashvars", "devicefont", "allowscriptaccess", "seamlesstabbing", "allowfullscreen", "allownetworking"],
	optAtt: ["id", "name", "align"],
	optExc: ["swliveconnect"],
	ximovie: "ufo.swf",
	xiwidth: "215",
	xiheight: "138",
	ua: navigator.userAgent.toLowerCase(),
	pluginType: "",
	fv: [0,0],
	foList: [],
		
	create: function(FO, id) {
		if (!UFO.uaHas("w3cdom") || UFO.uaHas("ieMac")) return;
		UFO.getFlashVersion();
		UFO.foList[id] = UFO.updateFO(FO);
		UFO.createCSS("#" + id, "visibility:hidden;");
		UFO.domLoad(id);
	},

	updateFO: function(FO) {
		if (typeof FO.xi != "undefined" && FO.xi == "true") {
			if (typeof FO.ximovie == "undefined") FO.ximovie = UFO.ximovie;
			if (typeof FO.xiwidth == "undefined") FO.xiwidth = UFO.xiwidth;
			if (typeof FO.xiheight == "undefined") FO.xiheight = UFO.xiheight;
		}
		FO.mainCalled = false;
		return FO;
	},

	domLoad: function(id) {
		var _t = setInterval(function() {
			if ((document.getElementsByTagName("body")[0] != null || document.body != null) && document.getElementById(id) != null) {
				UFO.main(id);
				clearInterval(_t);
			}
		}, 250);
		if (typeof document.addEventListener != "undefined") {
			document.addEventListener("DOMContentLoaded", function() { UFO.main(id); clearInterval(_t); } , null); // Gecko, Opera 9+
		}
	},

	main: function(id) {
		var _fo = UFO.foList[id];
		if (_fo.mainCalled) return;
		UFO.foList[id].mainCalled = true;
		document.getElementById(id).style.visibility = "hidden";
		if (UFO.hasRequired(id)) {
			if (UFO.hasFlashVersion(parseInt(_fo.majorversion, 10), parseInt(_fo.build, 10))) {
				if (typeof _fo.setcontainercss != "undefined" && _fo.setcontainercss == "true") UFO.setContainerCSS(id);
				UFO.writeSWF(id);
			}
			else if (_fo.xi == "true" && UFO.hasFlashVersion(6, 65)) {
				UFO.createDialog(id);
			}
		}
		document.getElementById(id).style.visibility = "visible";
	},
	
	createCSS: function(selector, declaration) {
		var _h = document.getElementsByTagName("head")[0]; 
		var _s = UFO.createElement("style");
		if (!UFO.uaHas("ieWin")) _s.appendChild(document.createTextNode(selector + " {" + declaration + "}")); // bugs in IE/Win
		_s.setAttribute("type", "text/css");
		_s.setAttribute("media", "screen"); 
		_h.appendChild(_s);
		if (UFO.uaHas("ieWin") && document.styleSheets && document.styleSheets.length > 0) {
			var _ls = document.styleSheets[document.styleSheets.length - 1];
			if (typeof _ls.addRule == "object") _ls.addRule(selector, declaration);
		}
	},
	
	setContainerCSS: function(id) {
		var _fo = UFO.foList[id];
		var _w = /%/.test(_fo.width) ? "" : "px";
		var _h = /%/.test(_fo.height) ? "" : "px";
		UFO.createCSS("#" + id, "width:" + _fo.width + _w +"; height:" + _fo.height + _h +";");
		if (_fo.width == "100%") {
			UFO.createCSS("body", "margin-left:0; margin-right:0; padding-left:0; padding-right:0;");
		}
		if (_fo.height == "100%") {
			UFO.createCSS("html", "height:100%; overflow:hidden;");
			UFO.createCSS("body", "margin-top:0; margin-bottom:0; padding-top:0; padding-bottom:0; height:100%;");
		}
	},

	createElement: function(el) {
		return (UFO.uaHas("xml") && typeof document.createElementNS != "undefined") ?  document.createElementNS("http://www.w3.org/1999/xhtml", el) : document.createElement(el);
	},

	createObjParam: function(el, aName, aValue) {
		var _p = UFO.createElement("param");
		_p.setAttribute("name", aName);	
		_p.setAttribute("value", aValue);
		el.appendChild(_p);
	},

	uaHas: function(ft) {
		var _u = UFO.ua;
		switch(ft) {
			case "w3cdom":
				return (typeof document.getElementById != "undefined" && typeof document.getElementsByTagName != "undefined" && (typeof document.createElement != "undefined" || typeof document.createElementNS != "undefined"));
			case "xml":
				var _m = document.getElementsByTagName("meta");
				var _l = _m.length;
				for (var i = 0; i < _l; i++) {
					if (/content-type/i.test(_m[i].getAttribute("http-equiv")) && /xml/i.test(_m[i].getAttribute("content"))) return true;
				}
				return false;
			case "ieMac":
				return /msie/.test(_u) && !/opera/.test(_u) && /mac/.test(_u);
			case "ieWin":
				return /msie/.test(_u) && !/opera/.test(_u) && /win/.test(_u);
			case "gecko":
				return /gecko/.test(_u) && !/applewebkit/.test(_u);
			case "opera":
				return /opera/.test(_u);
			case "safari":
				return /applewebkit/.test(_u);
			default:
				return false;
		}
	},
	
	getFlashVersion: function() {
		if (UFO.fv[0] != 0) return;  
		if (navigator.plugins && typeof navigator.plugins["Shockwave Flash"] == "object") {
			UFO.pluginType = "npapi";
			var _d = navigator.plugins["Shockwave Flash"].description;
			if (typeof _d != "undefined") {
				_d = _d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
				var _m = parseInt(_d.replace(/^(.*)\..*$/, "$1"), 10);
				var _r = /r/.test(_d) ? parseInt(_d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
				UFO.fv = [_m, _r];
			}
		}
		else if (window.ActiveXObject) {
			UFO.pluginType = "ax";
			try { // avoid fp 6 crashes
				var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
			}
			catch(e) {
				try { 
					var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
					UFO.fv = [6, 0];
					_a.AllowScriptAccess = "always"; // throws if fp < 6.47 
				}
				catch(e) {
					if (UFO.fv[0] == 6) return;
				}
				try {
					var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
				}
				catch(e) {}
			}
			if (typeof _a == "object") {
				var _d = _a.GetVariable("$version"); // bugs in fp 6.21/6.23
				if (typeof _d != "undefined") {
					_d = _d.replace(/^\S+\s+(.*)$/, "$1").split(",");
					UFO.fv = [parseInt(_d[0], 10), parseInt(_d[2], 10)];
				}
			}
		}
	},

	hasRequired: function(id) {
		var _l = UFO.req.length;
		for (var i = 0; i < _l; i++) {
			if (typeof UFO.foList[id][UFO.req[i]] == "undefined") return false;
		}
		return true;
	},
	
	hasFlashVersion: function(major, release) {
		return (UFO.fv[0] > major || (UFO.fv[0] == major && UFO.fv[1] >= release)) ? true : false;
	},

	writeSWF: function(id) {
		var _fo = UFO.foList[id];
		var _e = document.getElementById(id);
		if (UFO.pluginType == "npapi") {
			if (UFO.uaHas("gecko") || UFO.uaHas("xml")) {
				while(_e.hasChildNodes()) {
					_e.removeChild(_e.firstChild);
				}
				var _obj = UFO.createElement("object");
				_obj.setAttribute("type", "application/x-shockwave-flash");
				_obj.setAttribute("data", _fo.movie);
				_obj.setAttribute("width", _fo.width);
				_obj.setAttribute("height", _fo.height);
				var _l = UFO.optAtt.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[UFO.optAtt[i]] != "undefined") _obj.setAttribute(UFO.optAtt[i], _fo[UFO.optAtt[i]]);
				}
				var _o = UFO.opt.concat(UFO.optExc);
				var _l = _o.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[_o[i]] != "undefined") UFO.createObjParam(_obj, _o[i], _fo[_o[i]]);
				}
				_e.appendChild(_obj);
			}
			else {
				var _emb = "";
				var _o = UFO.opt.concat(UFO.optAtt).concat(UFO.optExc);
				var _l = _o.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[_o[i]] != "undefined") _emb += ' ' + _o[i] + '="' + _fo[_o[i]] + '"';
				}
				_e.innerHTML = '<embed type="application/x-shockwave-flash" src="' + _fo.movie + '" width="' + _fo.width + '" height="' + _fo.height + '" pluginspage="http://www.macromedia.com/go/getflashplayer"' + _emb + '></embed>';
			}
		}
		else if (UFO.pluginType == "ax") {
			var _objAtt = "";
			var _l = UFO.optAtt.length;
			for (var i = 0; i < _l; i++) {
				if (typeof _fo[UFO.optAtt[i]] != "undefined") _objAtt += ' ' + UFO.optAtt[i] + '="' + _fo[UFO.optAtt[i]] + '"';
			}
			var _objPar = "";
			var _l = UFO.opt.length;
			for (var i = 0; i < _l; i++) {
				if (typeof _fo[UFO.opt[i]] != "undefined") _objPar += '<param name="' + UFO.opt[i] + '" value="' + _fo[UFO.opt[i]] + '" />';
			}
			var _p = window.location.protocol == "https:" ? "https:" : "http:";
			_e.innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + _objAtt + ' width="' + _fo.width + '" height="' + _fo.height + '" codebase="' + _p + '//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + _fo.majorversion + ',0,' + _fo.build + ',0"><param name="movie" value="' + _fo.movie + '" />' + _objPar + '</object>';
		}
	},
		
	createDialog: function(id) {
		var _fo = UFO.foList[id];
		UFO.createCSS("html", "height:100%; overflow:hidden;");
		UFO.createCSS("body", "height:100%; overflow:hidden;");
		UFO.createCSS("#xi-con", "position:absolute; left:0; top:0; z-index:1000; width:100%; height:100%; background-color:#fff; filter:alpha(opacity:75); opacity:0.75;");
		UFO.createCSS("#xi-dia", "position:absolute; left:50%; top:50%; margin-left: -" + Math.round(parseInt(_fo.xiwidth, 10) / 2) + "px; margin-top: -" + Math.round(parseInt(_fo.xiheight, 10) / 2) + "px; width:" + _fo.xiwidth + "px; height:" + _fo.xiheight + "px;");
		var _b = document.getElementsByTagName("body")[0];
		var _c = UFO.createElement("div");
		_c.setAttribute("id", "xi-con");
		var _d = UFO.createElement("div");
		_d.setAttribute("id", "xi-dia");
		_c.appendChild(_d);
		_b.appendChild(_c);
		var _mmu = window.location;
		if (UFO.uaHas("xml") && UFO.uaHas("safari")) {
			var _mmd = document.getElementsByTagName("title")[0].firstChild.nodeValue = document.getElementsByTagName("title")[0].firstChild.nodeValue.slice(0, 47) + " - Flash Player Installation";
		}
		else {
			var _mmd = document.title = document.title.slice(0, 47) + " - Flash Player Installation";
		}
		var _mmp = UFO.pluginType == "ax" ? "ActiveX" : "PlugIn";
		var _uc = typeof _fo.xiurlcancel != "undefined" ? "&xiUrlCancel=" + _fo.xiurlcancel : "";
		var _uf = typeof _fo.xiurlfailed != "undefined" ? "&xiUrlFailed=" + _fo.xiurlfailed : "";
		UFO.foList["xi-dia"] = { movie:_fo.ximovie, width:_fo.xiwidth, height:_fo.xiheight, majorversion:"6", build:"65", flashvars:"MMredirectURL=" + _mmu + "&MMplayerType=" + _mmp + "&MMdoctitle=" + _mmd + _uc + _uf };
		UFO.writeSWF("xi-dia");
	},

	expressInstallCallback: function() {
		var _b = document.getElementsByTagName("body")[0];
		var _c = document.getElementById("xi-con");
		_b.removeChild(_c);
		UFO.createCSS("body", "height:auto; overflow:auto;");
		UFO.createCSS("html", "height:auto; overflow:auto;");
	},

	cleanupIELeaks: function() {
		var _o = document.getElementsByTagName("object");
		var _l = _o.length
		for (var i = 0; i < _l; i++) {
			_o[i].style.display = "none";
			for (var x in _o[i]) {
				if (typeof _o[i][x] == "function") {
					_o[i][x] = null;
				}
			}
		}
	}

};

if (typeof window.attachEvent != "undefined" && UFO.uaHas("ieWin")) {
	window.attachEvent("onunload", UFO.cleanupIELeaks);
}

