/*
 * * Tools
 * 
 * 
 * 
 * nécéssite prototype et script aculos
 * 
 */


function pixtoper(d, a) {
	return a*100/d;
}//pixeltopercent
//
function getWidth(id) {
	return Element.getDimensions(id).width;
}//getwidth
//
function getHeight(id) {
	return Element.getDimensions(id).height;
}//getheight
//
function valideMail(email){
	//var regexp = /([a-z0-9]+([-_]?[a-z0-9]+)*.)*[a-z0-9]+([-_]?[a-z0-9]+)*@([a-z0-9]+([-_]?[a-z0-9]+)*.)+[a-z]{2,4}/gi;
	var regexp = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
	//var regexp = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$/;
	//return email.match(regexp) == email;
	return regexp.test(email);
}// valideMail
//
function Browser() {
	agent = navigator.userAgent.toLowerCase();
	this.major = parseInt(navigator.appVersion);
	this.minor = parseFloat(navigator.appVersion);
	this.ns = ((agent.indexOf('mozilla') != -1) &&
	(agent.indexOf('spoofer') == -1) &&
	(agent.indexOf('compatible') == -1) &&
	(agent.indexOf('opera') == -1) &&
	(agent.indexOf('webtv') == -1) &&
	(agent.indexOf('hotjava') == -1));
	this.ns2 = (this.ns && (this.major == 2));
	this.ns3 = (this.ns && (this.major == 3));
	this.ns4 = (this.ns && (this.major == 4));
	this.ns6 = (this.ns && (this.major >= 5));
	this.ie = ((agent.indexOf('msie') != -1) &&
	(agent.indexOf('opera') == -1));
	this.ie3 = (this.ie && (this.major < 4));
	this.ie4 = (this.ie && (this.major == 4) &&
	(agent.indexOf('msie 4') != -1));
	this.ie5 = (this.ie && (this.major == 4) &&
	(agent.indexOf('msie 5.') != -1) &&
	(agent.indexOf('msie 5.5') == -1) &&
	(agent.indexOf('mac') == -1));
	this.iem5 = (this.ie && (this.major == 4) &&
	(agent.indexOf('msie 5.') != -1) &&
	(agent.indexOf('mac') != -1));
	this.ie55 = (this.ie && (this.major == 4) &&
	(agent.indexOf('msie 5.5') != -1));
	this.ie6 = (this.ie && (this.major == 4) &&
	(agent.indexOf('msie 6.') != -1));
	this.ie7 = (this.ie && (this.major == 4) &&
	(agent.indexOf('msie 7.0b') != -1));
	this.nsdom = (this.ns4 || this.ns6);
	this.ie5dom = (this.ie5 || this.iem5 || this.ie55);
	this.iedom = (this.ie4 || this.ie5dom || this.ie6);
	this.w3dom = (this.ns6 || this.ie6 ||this.ie7);
}// Browser
//
function checkBrowser () {
	var Browseris = new Browser();
	if (!Browseris.ie7) {
	alert ('site optimisé pour Internet Explorer 7');
	}
}// checkBrowser
//