﻿var timerIDFournitures = null;
var timerIDMobilier = null;
var timerIDEquipement = null;
var timerIDReprographie = null;
var timerIDCommande = null;
var timerIDPromotion = null;
var timerIDEntreprise = null;
var timerIDContact = null;
var timerOnFournitures = false;
var timerOnMobilier = false;
var timerOnEquipement = false;
var timerOnReprographie = false;
var timerOnCommande = false;
var timerOnPromotion = false;
var timerOnEntreprise = false;
var timerOnContact = false;
var timecountFournitures = 0;
var timecountMobilier = 0;
var timecountEquipement = 0;
var timecountReprographie = 0;
var timecountCommande = 0;
var timecountPromotion = 0;
var timecountEntreprise = 0;
var timecountContact = 0;
var prefix = "ctl00_cphZoneContenu_";
var detect = navigator.userAgent.toLowerCase();
var browser;
var version = 0;

/* Drimwouiveur */
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_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];}
}

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];}}
}

/* menu */
function menuFournitures(state){
	var menuItem = document.getElementById('menu-v_fournitures').style;
	if (state == 1){
		menuItem.display = "none";
	} else {
		if (menuItem.display == "none") {
		menuItem.display = ""; }
	}
}

function startTimeFournitures() {
	if (timerOnFournitures == false) { timerIDFournitures=setTimeout("menuFournitures(1)", timecountFournitures); }
	timerOnFournitures = true;
}
 
function stopTimeFournitures() { 
if (timerOnFournitures) { 
	clearTimeout(timerIDFournitures); 
	timerIDFournitures = null; 
	timerOnFournitures = false; } 
	menuFournitures(0);
}

function menuMobilier(state){
	var menuItem = document.getElementById('menu-v_mobilier').style;
	if (state == 1){
		menuItem.display = "none";
	} else {
		if (menuItem.display == "none") {
		menuItem.display = ""; }
	}
}

function startTimeMobilier() {
	if (timerOnMobilier == false) { timerIDMobilier=setTimeout("menuMobilier(1)", timecountMobilier); }
	timerOnMobilier = true;
}
 
function stopTimeMobilier() { 
if (timerOnMobilier) { 
	clearTimeout(timerIDMobilier); 
	timerIDMobilier = null; 
	timerOnMobilier = false; } 
	menuMobilier(0);
}

function menuEquipement(state){
	var menuItem = document.getElementById('menu-v_equipement').style;
	if (state == 1){
		menuItem.display = "none";
	} else {
		if (menuItem.display == "none") {
		menuItem.display = ""; }
	}
}

function startTimeEquipement() {
	if (timerOnEquipement == false) { timerIDEquipement=setTimeout("menuEquipement(1)", timecountEquipement); }
	timerOnEquipement = true;
}
 
function stopTimeEquipement() { 
if (timerOnEquipement) { 
	clearTimeout(timerIDEquipement); 
	timerIDEquipement = null; 
	timerOnEquipement = false; } 
	menuEquipement(0);
}

function menuReprographie(state){
	var menuItem = document.getElementById('menu-v_reprographie').style;
	if (state == 1){
		menuItem.display = "none";
	} else {
		if (menuItem.display == "none") {
		menuItem.display = ""; }
	}
}

function startTimeReprographie() {
	if (timerOnReprographie == false) { timerIDReprographie=setTimeout("menuReprographie(1)", timecountReprographie); }
	timerOnReprographie = true;
}
 
function stopTimeReprographie() { 
if (timerOnReprographie) { 
	clearTimeout(timerIDReprographie); 
	timerIDReprographie = null; 
	timerOnReprographie = false; } 
	menuReprographie(0);
}

function menuCommande(state){
	var menuItem = document.getElementById('menu-v_commande').style;
	if (state == 1){
		menuItem.display = "none";
	} else {
		if (menuItem.display == "none") {
		menuItem.display = ""; }
	}
}

function startTimeCommande() {
	if (timerOnCommande == false) { timerIDCommande=setTimeout("menuCommande(1)", timecountCommande); }
	timerOnCommande = true;
}
 
function stopTimeCommande() { 
if (timerOnCommande) { 
	clearTimeout(timerIDCommande); 
	timerIDCommande = null; 
	timerOnCommande = false; } 
	menuCommande(0);
}

function menuPromotion(state){
	var menuItem = document.getElementById('menu-v_promotion').style;
	if (state == 1){
		menuItem.display = "none";
	} else {
		if (menuItem.display == "none") {
		menuItem.display = ""; }
	}
}

function startTimePromotion() {
	if (timerOnPromotion == false) { timerIDPromotion=setTimeout("menuPromotion(1)", timecountPromotion); }
	timerOnPromotion = true;
}
 
function stopTimePromotion() { 
if (timerOnPromotion) { 
	clearTimeout(timerIDPromotion); 
	timerIDPromotion = null; 
	timerOnPromotion = false; } 
	menuPromotion(0);
}

function menuEntreprise(state){
	var menuItem = document.getElementById('menu-v_entreprise').style;
	if (state == 1){
		menuItem.display = "none";
	} else {
		if (menuItem.display == "none") {
		menuItem.display = ""; }
	}
}

function startTimeEntreprise() {
	if (timerOnEntreprise == false) { timerIDEntreprise=setTimeout("menuEntreprise(1)", timecountEntreprise); }
	timerOnEntreprise = true;
}
 
function stopTimeEntreprise() { 
if (timerOnEntreprise) { 
	clearTimeout(timerIDEntreprise); 
	timerIDEntreprise = null; 
	timerOnEntreprise = false; } 
	menuEntreprise(0);
}

function menuContact(state){
	var menuItem = document.getElementById('menu-v_contact').style;
	if (state == 1){
		menuItem.display = "none";
	} else {
		if (menuItem.display == "none") {
		menuItem.display = ""; }
	}
}

function startTimeContact() {
	if (timerOnContact == false) { timerIDContact=setTimeout("menuContact(1)", timecountContact); }
	timerOnContact = true;
}
 
function stopTimeContact() { 
if (timerOnContact) { 
	clearTimeout(timerIDContact); 
	timerIDContact = null; 
	timerOnContact = false; } 
	menuContact(0);
}


/* sniffer NS6 + IE/Safari mac */
function checkIt(string) {
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}


if (checkIt('netscape')){
	browser = "Netscape"
	version = detect.charAt(8);
} else if (checkIt('mac')){ 
	if (checkIt('msie') || checkIt('safari')){ browser = "Mac unsupported"; }
}



if (browser == "Netscape" && version <= 6){
	var style ="";
	style = "\n<style type=\"text/css\">\n";
	style += ":focus { -moz-outline-style: none; }\n";
	style += "ul.menu li { background: #981B1D !important; }\n";
	style += "ul.menu ul { left: -1px; }\n";
	style += "</style>\n"; 
	document.write(style);
}


if (browser == "Mac unsupported"){
	var style = "<style type=\"text/css\">@media Screen, Projection { ul.menu li:hover > ul { top: 0; }}</style>";
	document.write(style); 
}

/* print */
function imprimer(lang){
	if (window.print) { window.print(); } 
	else { 
		var warning = ""
		switch(lang) {
			case "/medias/fr/":
				warning = "Votre navigateur n'est pas compatible avec l'impression directe.\n\nPour imprimer, allez dans le menu Fichier de votre navigateur et choisissez \"Imprimer\".";
			break
			case "/medias/es/":
				warning = "Tu browser no apoya la impresión directa.\n\nPara imprimir, ir al menú \"Archivo\" de tu browser y seleccionar la \"impresión\".";
			break				
			default:
				warning = "Your browser does not support direct printing.\n\nTo print, go to the File menu of your browser and select \"Print\".";
		}
		alert(warning); 
	}
}

/* toggle features/options */
function toggleFeatOpt(element){
	var btnFeatures = document.getElementById('aBtnFeatures');
	var btnOptions = document.getElementById('aBtnOptions');
	var pFeatures = document.getElementById(prefix+'pFeatures');
	var pOptions = document.getElementById(prefix+'pOptions');

	if( element==0 ){
		btnFeatures.className = 'active';
		btnOptions.className = '';
		pFeatures.style.display = '';
		pOptions.style.display = 'none';
	} else {
		btnFeatures.className = '';
		btnOptions.className = 'active';
		pFeatures.style.display = 'none';
		pOptions.style.display = '';
	}
}

function populateFeatures(){
document.getElementById('txtFeatures').innerHTML = document.getElementById('innerScroll').innerHTML
}

/* show/hide contenu */
function showItem(element,map){
	hideItems();
	document.getElementById(prefix+element).style.display = "";
	if (map){
		hideItem(prefix+"pMapCan");
		hideItem(prefix+"pMapUSA");
		hideItem(prefix+"pMapMex");
		document.getElementById(prefix+map).style.display = "";
	}
	if (browser !== "Mac unsupported") { anchorItem(); }
}

function hideItems(){
	hideItem(prefix+"pTechInfos");
	hideItem(prefix+"pTechSpec");
	hideItem(prefix+"pDealers");
	hideItem(prefix+"pBenchLabs");
	hideItem(prefix+"pWarranty");
	hideItem(prefix+"pTestimonies");	
}

function anchorItem(){
	var strUrl = window.location.href;
	var scrollPos = f_scrollTop();
	if (scrollPos <= 305) { 
		var intPos = strUrl.indexOf("#");
		if (intPos !== -1) { strUrl = strUrl.slice(0,intPos) }
		strUrl = strUrl + "#main";
		window.location.href = strUrl;
	}
}

function hideItem(element){
	if (document.getElementById(element)){ 
		panel = document.getElementById(element).style;
		if (panel.display != "none"){ panel.display = "none"; }
	}
}

function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}

function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

function openFile(url) { //v3.0
  window.open(url,'','toolbar=0, scrollbars=1, resizable=1, status=0','');
}

function openPopup(theURL) { //v2.0
  window.open('/content/popupRedirect.aspx?type=1&url=' + escape(theURL),'pop','menubar=no,resizable=yes,width=500,height=150,top=300,left=300');
}

function openPopup2(theURL) { //v2.0
  window.open('/content/popupRedirect.aspx?type=2&url=' + escape(theURL),'pop2','menubar=no,resizable=yes,width=500,height=200,top=300,left=300');
}