﻿// Fichier JScript

//Fonction de test
function test() {
	alert('test du fichier global.js');
}

function VideTextBox(txtbox) {
	document.getElementById(txtbox.id).value = '';
}

function ChangeImg(hl,mode) {
var chsrc = 'biloute';
chsrc = document.getElementById(hl.id).src;
chsrc = chsrc.substr(0,chsrc.length-6);
if (mode == 'on') {
chsrc = chsrc + 'on.jpg';
}
if (mode == 'of') {
chsrc = chsrc + 'of.jpg';
}
document.getElementById(hl.id).src = chsrc;
}

/*
// en fonction du navigateur... 
if ( document.all ) { 

// sur Internet Explorer on intercepte le 'Menu Contextuel' 
document.oncontextmenu = clic_droit; 
} 
if ( document.layers ) { 

// sur Netscape on intercepte le clic de la souris pour l'analyser ensuite... 
document.captureEvents(Event.MOUSEDOWN); 
document.onmousedown = clic_droit; 
} 
*/
function zclic_droit(evenement) { 

// action pour Internet Explorer (sur 'Menu Contextuel') 
if ( document.all ) { 
//alert('Votre texte IE'); 
return false; 
} 
else if ( document.layers ) { 

// pour Netscape, si le clic a été effectué sur le bouton droit (which == 3) 
if ( evenement.which == 3 ) { 
//alert('Votre texte NET'); 
return false; 
} 

// si le clic standard a été accompagné d'une touche (touche 2 = Control, nécessaire pour le 'clic-droit' sur les souris à 1 bouton des Macs) 
if ( evenement.modifiers == 2 ) { 
//alert('Votre texte Autre'); 
return false; 
} 
} 
return true; 
} 

// Contre la touche F5
var layers = false;
var ie4 = (document.all) ? true : false;
var ns6 = (document.getElementById&&!document.all) ? true : false;
if (ie4 || ns6) {layers = true;} 
 
function test_f5(e)
{ 
var val="";
	if(ie4)	{
		val="K"+window.event.keyCode;
		if (val == "K116") { 
			alert('Il est trés déconseillé d\'utiliser cette touche. Le fonctionnement du site pourrait en être altéré. Merci de votre conpréhension.');
			
		} else {
			return true; 
		}
	}
	if (ns6) {
		val="K"+e.which;
		if (val == "K116") { 
			alert('Il est trés déconseillé d\'utiliser cette touche. Le fonctionnement du site pourrait en être altéré. Merci de votre conpréhension.');
			
		} else {
			return true; 
		}
	}
}

function OuvrirPopup(page, nomf) {
//alert('ta mere');
var boxWidth = 1050;
var boxHeight = 750;
            if (document.body) {
                        var screenWidth = (document.body.clientWidth);
                        var screenHeight = (document.body.clientHeight);
            }
            else {
                        var screenWidth = (window.innerWidth);
                        var screenHeight = (window.innerHeight);
            }
var boxLeft = (screenWidth/2) - (boxWidth/2);
var boxTop = (screenHeight/2) - (boxHeight/2);
window.open(page, nomf, 'Width='+boxWidth+',Height='+boxHeight+',Left='+boxLeft+',Top='+boxTop+',toolbar=no,status=no,directories=no,menubar=no,location=no,scrollbars=no,resizable=no');
}

function OuvrirPopupParam(page, boxWidth, boxHeight, toolbar, status, directories, menubar, location, scrollbars, resizable) {
if (document.body) {
	var screenWidth = (document.body.clientWidth);
	var screenHeight = (document.body.clientHeight);
}
else {
	var screenWidth = (window.innerWidth);
	var screenHeight = (window.innerHeight);
}
var boxLeft = (screenWidth/2) - (boxWidth/2);
var boxTop = (screenHeight/2) - (boxHeight/2);
window.open(page, 'fenpopup', 'Width='+boxWidth+',Height='+boxHeight+',Left='+boxLeft+',Top='+boxTop+',toolbar='+toolbar+',status='+status+',directories='+directories+',menubar='+menubar+',location='+location+',scrollbars='+scrollbars+',resizable='+resizable);
}

function OuvrirPopupParamD(page, boxWidth, boxHeight, toolbar, status, directories, menubar, location, scrollbars, resizable) {
    if (document.body) {
        var screenWidth = (document.body.clientWidth);
        var screenHeight = (document.body.clientHeight);
    }
    else {
        var screenWidth = (window.innerWidth);
        var screenHeight = (window.innerHeight);
    }
    //var boxLeft = (screenWidth/2) - (boxWidth/2);
    //var boxTop = (screenHeight/2) - (boxHeight/2);
    var boxLeft = 50;
    var boxTop = 50;
    window.open(page, 'fenpopup', 'Width=' + boxWidth + ',Height=' + boxHeight + ',Left=' + boxLeft + ',Top=' + boxTop + ',toolbar=' + toolbar + ',status=' + status + ',directories=' + directories + ',menubar=' + menubar + ',location=' + location + ',scrollbars=' + scrollbars + ',resizable=' + resizable);
}

//Function pour compter le nombre de caractère dans une zone de texte multiligne et bloquer à la limite
function limitCharstxt(textarea, limit, infodiv) {
    var text = textarea.value;
    var textlength = text.length;
    var info = document.getElementById(infodiv);

    if (textlength > limit) {
        info.innerHTML = 'Description full';
        textarea.value = text.substr(0, limit);
        return false;

    }
    else {
        info.innerHTML = (limit - textlength);
        return true;
    }
}
/*Function pour le site Ablanore.com*/
function suite(txt) 
{			
	if (document.getElementById('texte1').style.display == 'block') {				
		document.getElementById('texte1').style.display = 'none'				
		document.getElementById('texte2').style.display = 'block'				
		document.getElementById('btn').src = '/App_Themes/ablanore/btndebut.gif'			
	}			
	else {				
		document.getElementById('texte2').style.display = 'none'				
		document.getElementById('texte1').style.display = 'block'				
		document.getElementById('btn').src = '/App_Themes/ablanore/btnsuite.gif'			
	}
}		

