function openWindow(url, width, height)
{
  window.open(url,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width="+width+",height="+height);
  /*var largeur;
  var hauteur;
  var nav = navigator.appName;
  if ((self.innerWidth == null) && (self.innerHeight == null))
  {
    if (nav == 'Microsoft Internet Explorer')
    {
       window.open(nom_url,"","toolbar=yes,location=yes,directories=yes,status=yes," + 
                   "menubar=yes,scrollbars=yes,resizable=yes");
    }
    else
    {
      largeur = 700;
      hauteur = 400;
      window.open(nom_url,"","toolbar=yes,location=yes,directories=yes,status=yes," + 
                  "menubar=yes,scrollbars=yes,resizable=yes,width="+largeur+
                  ",height="+hauteur);
    }
  }
  else
  {
    largeur = (self.innerWidth*7)/8;
    hauteur = (self.innerHeight*7)/8;
    window.open(nom_url,"","toolbar=yes,location=yes,directories=yes,status=yes," + 
                "menubar=yes,scrollbars=yes,resizable=yes,width="+largeur+",height="+hauteur);
  }*/
}

function showServiceHelp(evt, svcHelpId)
{
  var svcHelpBlock = document.getElementById(svcHelpId);
  svcHelpBlock.className = 'present';
  svcHelpBlock.zIndex = 99;
  svcHelpBlock.style.left = (parseInt(getMouseX(evt)) + 5) + 'px';
  svcHelpBlock.style.top = (parseInt(getMouseY(evt))+ 5) + 'px';
}
 
function hideServiceHelp(svcHelpId)
{
  var svcHelpBlock = document.getElementById(svcHelpId);
  svcHelpBlock.zIndex = -1;
  svcHelpBlock.className = 'absent';
}

function showCartBlock(refBlockName)
{
  var refBlock;
  var refBlockAbsX = 0;
  var refBlockAbsY = 0;
  var offsetX = 0;
  var offsetY = 0;
  var refBlockWidth = 0;
  var refBlockHeight = 0;
  var cartWidth = 440; //rmq: il n'est pas possible d'obtenir la taille du block car il n'est
  var cartHeight = 100;//     pas visible et toutes ses propriétés de styles sont à 0!! C'est
                       //     pourquoi on utilise les mêmes valeurs que celles définies dans cart.css
  if (refBlockName != '')
  {
    refBlock =  document.getElementById(refBlockName);
    cartBlock = document.getElementById('cart_popup_block');
    if (cartBlock)
    {
      refBlockAbsX = getAbsoluteX(refBlock);
      refBlockAbsY = getAbsoluteY(refBlock);
      if (refBlock.clientWidth)
        refBlockWidth = refBlock.clientWidth;
      if (refBlock.clientHeight)
        refBlockHeight = refBlock.clientHeight;
      offsetX = Math.round((refBlockWidth - cartWidth)/2);
      offsetY = Math.round((refBlockHeight - cartHeight)/2)
      if (offsetX == 0)
        offsetX = 50;
      if (offsetY == 0)
        offsetY = 40;
      cartBlock.style.left = (refBlockAbsX + offsetX) + 'px';
      cartBlock.style.top = (refBlockAbsY + offsetY) + 'px';
      cartBlock.className = "present";
    }
  }
}
 
function hideCartBlock()
{
  cartBlock = document.getElementById('cart_popup_block');
  if (cartBlock)
    cartBlock.className = "absent";
}
  
function getMouseX(evt)
{
  if (!evt)
    evt = window.event;
  if (evt.pageX)
    return evt.pageX;
  else
    if (evt.clientX)
      return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft);
    else return 0;  
}
  
function getMouseY(evt)
{
  if (!evt)
    evt = window.event;
  if (evt.pageY)
    return evt.pageY; 
  else 
    if (evt.clientY)
      return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
    else return 0;
}

function getAbsoluteX(obj)
{
  var absX = obj.offsetLeft;
  
  while (obj = obj.offsetParent)
    absX += obj.offsetLeft;
  return absX;
}

function getAbsoluteY(obj)
{
  var absY = obj.offsetTop;
  
  while (obj = obj.offsetParent)
    absY += obj.offsetTop;
  return absY;
}

function getScreenWidth()
{
  var result = 0;
  if (typeof(window.innerWidth) == 'number') //Non-IE
    result = window.innerWidth;
  else
    if (document.documentElement && document.documentElement.clientWidth) //IE 6+
      result = document.documentElement.clientWidth;
    else
      if (document.body && document.body.clientWidth) //IE 4
        result = document.document.body.clientWidth
      //else ... on rend 0 ....
  return result;
}

function getScreenHeight()
{
  var result = 0;
  if (typeof(window.innerHeight) == 'number') //Non-IE
    result = window.innerHeight;
  else
    if (document.documentElement && document.documentElement.clientHeight) //IE 6+
      result = document.documentElement.clientHeight;
    else
      if (document.body && document.body.clientHeight) //IE 4
        result = document.document.body.clientHeight
      //else ... on rend 0 ....
  return result;
}

function openAlert(alertBlockId, refBlockId)
{
  var msgBlock = document.getElementById(alertBlockId);
  var refBlock = document.getElementById(refBlockId);
  msgBlock.style.left = ((refBlock.clientWidth - msgBlock.clientWidth)/2)+"px";
  msgBlock.style.top  = ((refBlock.clientHeight - msgBlock.clientHeight)/2)+"px";
  //alert("msgBlock.style.left = "+msgBlock.style.left+"; msgBlock.style.top = "+msgBlock.style.top);
  msgBlock.style.visibility = "visible";
}
  
function closeAlert(alertBlockId)
{
  var msgBlock = document.getElementById(alertBlockId);
  msgBlock.style.visibility = "hidden";
}

function openVideoPlayer(vidKind)
{
  var popupUrl;
  var popupWindow;
  var popupContent;
  var width;
  var height;
  switch (vidKind)
  {
     case "MAROC_QUAD":
    	popupUrl='http://www.youtube-nocookie.com/v/MwG7CuHzvt4&hl=fr_FR&fs=1&rel=0&color1=0xf4f3d9&color2=0xb5ac8d&feature=player_embedded&fs=1';
    	width = 360;
    	height = 300;
	  break;
     case "MAROC_SUD":
    	popupUrl='http://www.youtube-nocookie.com/v/QV0X-StHPLo&hl=fr_FR&fs=1&rel=0&color1=0xf4f3d9&color2=0xb5ac8d&feature=player_embedded&fs=1';
    	width = 410;
    	height = 335;
	  break;
     case "MAROC_SOL":
    	popupUrl='http://www.youtube-nocookie.com/v/RSjRfrloCww&hl=fr_FR&fs=1&rel=0&color1=0xf4f3d9&color2=0xb5ac8d&feature=player_embedded&fs=1';
    	width = 400;
    	height = 335;
	  break;
	 case "MAROC_PHOTO":
    	popupUrl='http://www.youtube-nocookie.com/v/ogX3RsoSOMg&hl=fr_FR&fs=1&rel=0&color1=0xf4f3d9&color2=0xb5ac8d&feature=player_embedded&fs=1';
    	width = 410;
    	height = 335;
	  break;
	 case "MAROC_RAK":
    	popupUrl='http://www.youtube-nocookie.com/v/d4qKBdSHhuw&hl=fr_FR&fs=1&rel=0&color1=0xf4f3d9&color2=0xb5ac8d&feature=player_embedded&fs=1';
    	width = 480;
    	height = 300;
	  break;
	 case "MAROC_GOLF":
    	popupUrl='http://www.youtube-nocookie.com/v/AixDarEWyvA&hl=fr_FR&fs=1&rel=0&color1=0xf4f3d9&color2=0xb5ac8d&feature=player_embedded&fs=1';
    	width = 480;
    	height = 300;
	  break;  
	 case "IRELAND_OT":
    	popupUrl='http://www.youtube-nocookie.com/v/c1tx43WF-k8&hl=fr_FR&fs=1&rel=0&color1=0xf4f3d9&color2=0xb5ac8d&feature=player_embedded&fs=1';
    	width = 480;
    	height = 300;
	  break;  
	 case "SCOTLAND_OT":
    	popupUrl='http://www.youtube-nocookie.com/v/cm8rR3VCHJk&hl=fr_FR&fs=1&rel=0&color1=0xf4f3d9&color2=0xb5ac8d&feature=player_embedded&fs=1';
    	width = 480;
    	height = 300;
	  break;
	 case "ANDALUCIA_OT":
    	popupUrl='http://www.youtube-nocookie.com/v/0R6rcYxlPnE&hl=fr_FR&fs=1&rel=0&color1=0xf4f3d9&color2=0xb5ac8d&feature=player_embedded&fs=1';
    	width = 480;
    	height = 300;
	  break;  
	 case "ALENTEJO_OT":
    	popupUrl='http://www.youtube-nocookie.com/v/y0yn9_JhXF4&hl=fr_FR&fs=1&rel=0&color1=0xf4f3d9&color2=0xb5ac8d&feature=player_embedded&fs=1';
    	width = 480;
    	height = 300;
	  break;  
	 case "MADEIRA_OT":
    	popupUrl='http://www.youtube-nocookie.com/v/lpxXhKPMAFM&hl=fr_FR&fs=1&rel=0&color1=0xf4f3d9&color2=0xb5ac8d&feature=player_embedded&fs=1';
    	width = 480;
    	height = 300;
	  break; 
	 case "INDE_SUD":
    	popupUrl='http://www.youtube-nocookie.com/v/CENDswOmn9I&hl=fr_FR&fs=1&rel=0&color1=0xf4f3d9&color2=0xb5ac8d&feature=player_embedded&fs=1';
    	width = 520;
    	height = 380;
	  break;  
	 case "MEXICO_OT":
    	popupUrl='http://www.youtube-nocookie.com/v/5P7H-DJu9Qs&hl=fr_FR&fs=1&rel=0&color1=0xf4f3d9&color2=0xb5ac8d&feature=player_embedded&fs=1';
    	width = 480;
    	height = 300;
	  break; 
	 case "OMAN_OT":
    	popupUrl='http://www.youtube-nocookie.com/v/nznfO4MaC5g&hl=fr_FR&fs=1&rel=0&color1=0xf4f3d9&color2=0xb5ac8d&feature=player_embedded&fs=1';
    	width = 480;
    	height = 300;
	  break;
	  case "SICILIA_PM":
    	popupUrl='http://www.youtube-nocookie.com/v/_vPs1ecv1B0&hl=fr_FR&fs=1&rel=0&color1=0xf4f3d9&color2=0xb5ac8d&feature=player_embedded&fs=1';
    	width = 410;
    	height = 335;
	  break;
	 case "ITALIA_OT":
    	popupUrl='http://www.youtube-nocookie.com/v/hwBSc2Lnass&hl=fr_FR&fs=1&rel=0&color1=0xf4f3d9&color2=0xb5ac8d&feature=player_embedded&fs=1';
    	width = 480;
    	height = 300;
	 default:	
    	popupUrlUrl="";
      break;
  }  
  popupWindow = window.open("","","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width="+width+",height="+height);
  popupContent  = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n';
  popupContent += '<html xmlns="http://www.w3.org/1999/xhtml">\n';
  popupContent += '<head>\n';
  popupContent += '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />\n';
  popupContent += '<title>Document sans nom</title>\n';
  popupContent += '</head>\n';
  popupContent += '<body">\n';
  popupContent += '<script type="text/JavaScript">\n';
  popupContent += '<!--\n';
  popupContent += 'parent.location="'+popupUrl+'";\n';
  popupContent += '//-->\n';
  popupContent += '</script>\n';
  popupContent += '</body>\n';
  popupContent += '</html>\n';
  popupWindow.document.write(popupContent);
}

function googleTranslate(tgtLang)
{
  var formObj;
  var fieldObj;
  formObj = document.getElementById('google_translate');
  fieldObj = document.getElementById('langpair');
  fieldObj.value = "fr|"+tgtLang;
  formObj.submit();
}


