function _go(_u){window.location.href = _u}
function $(id){	return document.getElementById(id)}function c(_s){console.log(_s)}function I(i){return parseInt(i)}function g(_s){window.location.href=_s}
function change_language(lng){
	this.r=function(res){window.location.reload(0);}
	xmlHttp({url:"/ajax/change_language.asp?Language="+lng,method:"get",response_handler:this.r})	
}
var h = ""
var myInterval
function home_img_lnk(){
	h = "<ul id='home-ban-list' >"
for (var _i=0;_i< image_links.length ;_i++){
	h += '<li onmouseover="s_home_image('+_i+')" onmouseout="onload_home_image()">'
	h += '<img src="'+image_links[_i].thumb+'" alt="img" />'
	h += '<h4>'+ image_links[_i].title +'</h4>'
	h += "<span>" + image_links[_i].description + "</span>"
	h += "</li>"
	}
	h += "</ul>"
}
function cursorPosition(ev){ev=ev||window.event;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};
}
function cleanWhitespace(node) {var o ; var  notWhitespace=/\S/;
	for (var x = 0; x < node.childNodes.length; x++){var childNode=node.childNodes[x];
	if ((childNode.nodeType==3)&&(!notWhitespace.test(childNode.nodeValue))){o++;node.removeChild(node.childNodes[x]);x--}
		if (childNode.nodeType==1) {cleanWhitespace(childNode)}	}return node
}
var timeout = 1000;
window.onload=function(){	Menu.onload();	if ($("home-image")){		onload_home_image()		}}
function s_home_image(id){
  clearInterval(myInterval) ;  oo = image_links[id] ;  $("home-image").href = oo.link ;  $("home-image").style.background = "url('"+oo.image+"') no-repeat" ;
}
function change_image() {
  image_id++ ;  oo = image_links[image_id]
  $("home-image").href = oo.link ;  $("home-image").style.background = "url('"+oo.image+"') no-repeat" ;
  if (image_id >= image_links.length -1 ){image_id = -1}
}
function onload_home_image(){
	myInterval = window.setInterval(change_image,3500);
}
//----------------------------------------------------------------------------------------------
var SELECTS
function hide_select(){	if(!(SELECTS)){	SELECTS = document.getElementsByTagName("select")};	for (var i=0;i<SELECTS.length;i++){SELECTS[i].style.visibility = "hidden"}}
function show_select(){	if(!(SELECTS)){	SELECTS = document.getElementsByTagName("select")};	for (var i=0;i<SELECTS.length;i++){SELECTS[i].style.visibility = "visible"}}
function hide_subs(){show_select();for(var i=1;i<6;i++){if($("sub-menu-"+i)) {$("sub-menu-"+i).style.display="none"}}}
function doc_click(){document.onclick=function(){hide_subs();document.onclick=null;}}
function show_subs(id){hide_subs();hide_select();document.onclick=null;$("sub-menu-"+id).style.display="block";setTimeout("doc_click()",700)}
function validate_shipping(){
	this.response_handler = function(res){	window.location.href = "Cart.asp" 	}
	this.error_handler = function(err_code){		alert("Ajax error ","error")	}
	b_tmp = false
	ip = $("Shipping_form").getElementsByTagName("input")
	for (var i=0;i< ip.length;i++){
		if (ip[i].checked){	b_tmp = true;value = ip[i].value ;	}
	}
	if (b_tmp){	xmlHttp({url:"Ajax/Shipping.asp?Shipping_id="+value,response_handler:this.response_handler,error_handler:this.error_handler})
	}else{	alert("Please Select shipping ","error")}
}
function checkContactForm(f){
	var error = false ;	var errorMsg = new Array() ;
	var errorMsgOut = "" ;	for (var i=0;(e = f[i]);i++){e.style.border="#000000 1px solid";}
	if (!(f.name.value)){error=true;f.name.style.border="red 1px solid";errorMsg.push("Vous navez pas indiqué votre nom")}
	if (!(f.country.value)){error=true;f.country.style.border="red 1px solid";errorMsg.push("Vous navez pas indiqué votre pays")}
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (!(filter.test(f.email.value))){ 
	error = true ; f.email.style.border = "red 1px solid";errorMsg.push("veuillez saisir un email valide")}
	if (!(f.telephone.value)){ error = true ; f.telephone.style.border = "red 1px solid";errorMsg.push("votre telephone navez pas valide")}
	if (error){	for(var i=0;i<errorMsg.length;i++){	errorMsgOut = errorMsgOut + errorMsg[i] + "\n"	}
		alert(errorMsgOut)
	}else{
		alert("Nous vous remercions de votre demande. nous auront le plaisire de vous répondre le plus rapidement possible")
		f.submit()	
	}
}
function add_2_cart(Article_id){ window.location.href = "/Add_to_cart.asp?Article_id="+ Article_id }
var Menu = {
	id:"x-menu"
	,a_SUBSUBMENU : new Array()
	,$:function(id){return  document.getElementById(id)}
	,hide_timeout : 800
	,timeout_MENU_HIDE : null
	,timeout_SUBMENU_HIDE : null
	,itm_CURR_MENU : null
	,itm2_CURR_MENU : null
	,go:function(o){
		str = ""
		if (o.Category){str +="&Category="+ o.Category}
		if (o.Subcategory){str +="&Subcategory="+ o.Subcategory}
		if (o.Subsubcategory){str +="&Subsubcategory="+ o.Subsubcategory}
		window.location = "Category.asp?" + str.replace("&","")
	}
	,onload : function (){
		if (!(Menu.$(Menu.id))) {return }
		Menu.$(Menu.id).onmouseover=function(){	clearTimeout(Menu.timeout_MENU_HIDE); }
		Menu.cleanWhitespace(Menu.$(Menu.id))
			for (var i=0;ul = Menu.$(Menu.id).childNodes[i];i++){
				ul.firstChild.onmouseover 		= Menu.ulMouseOver
				ul.firstChild.onmouseout 		= Menu.ulMouseOut
				if (ul.firstChild.childNodes[1]){
					for (var j=0;(li = ul.firstChild.childNodes[1].childNodes[j]);j++){
						if(li.firstChild.nextSibling){
							li.onmouseover 		= Menu.liMouseOver
							li.onmouseout 		= Menu.liMouseOut
							Menu.a_SUBSUBMENU.push(li.firstChild.nextSibling)
						}
					}
				}
			}
	}
	,liMouseOver:function(){
		clearTimeout ( Menu.timeout_SUBMENU_HIDE );	
		Menu.hideAllSubSubMenu() ;
		this.firstChild.nextSibling.style.display ='block'
	}
	,liMouseOut:function(){
		Menu.itm2_CURR_MENU = this ; 
		Menu.timeout_SUBMENU_HIDE = setTimeout("Menu.itm2_CURR_MENU.firstChild.nextSibling.style.display ='none'",Menu.hide_timeout)
	}
	,ulMouseOver:function(){
		clearTimeout ( Menu.timeout_MENU_HIDE );
		Menu.hideAllSubMenu();
		if (this.childNodes[1]){
			this.childNodes[1].style.display='block'
		}
	}
	,ulMouseOut:function(){
		Menu.itm_CURR_MENU = this ; 
		Menu.timeout_MENU_HIDE = setTimeout("Menu.itm_CURR_MENU.childNodes[1].style.display='none'",Menu.hide_timeout)
	}
	,hideAllSubSubMenu:function(){
		for (var i=0;(sub_li=Menu.a_SUBSUBMENU[i]);i++){
				sub_li.style.display='none'	
		}
	}
	,hideAllSubMenu:function(){
		for (var i=0;ul = Menu.$(Menu.id).childNodes[i];i++){	
			if(ul.firstChild.childNodes[1]){
				ul.firstChild.childNodes[1].style.display='none'	
				}
			}
	}
	,cleanWhitespace:function(node) {
	var o ; var  notWhitespace = /\S/
		for (var x = 0; x < node.childNodes.length; x++) {	var childNode = node.childNodes[x] ;
			if ((childNode.nodeType == 3)&&(!notWhitespace.test(childNode.nodeValue))) {
			o++ ; node.removeChild(node.childNodes[x]) ;	x--		;}
			if (childNode.nodeType == 1) { 	Menu.cleanWhitespace(childNode)	}
		}return node
	}
}
/********************************** -------- FORM ----- ********************************************/

function submit_ajax_form(f,return_function){
	this.error_handler = function(e_code){	alert("Ajax error","error") 	}
	if (validate_form(f)){
		_METHOD = f.method.toLowerCase()
		_DATA 	= hash_form(f)
		_URL 	= _METHOD == "post" ? f.action : f.action + "?" + _DATA
		xmlHttp({url:_URL,method:_METHOD,data:_DATA,error_handler:this.error_handler,response_handler:return_function})	
	}
	return false
}
function hash_form(f){
	dt_str = "" ; 	a_radio = new Array() ;
	for (var i=0;(e = f.elements[i]);i++){
		if (e.type=="text" || e.type=="hidden" || e.type=="password" || e.type == "select-one" || e.type=="textarea"){
			if(e.name){	dt_str += "&"+ e.name +"="+ encodeURIComponent(	e.value	)	}
		}else if(e.type=="radio" || e.type=="checkbox"){a_radio.push(e)	}
	}
	for (var i=0;(r=a_radio[i]);i++){
		if (r.checked){	dt_str += "&"+ r.name +"="+ encodeURIComponent(	r.value	)}
	}		
	dt_str = dt_str.replace("&","")
	return dt_str
}
function validate_form(f){
	VALID = true
	ERROR_MSG = ""
	for (var i=0;i<f.length;i++){
		if(!(validate(f[i]))){
			error_msg = f[i].getAttribute("error_msg")
			if(error_msg){
				ERROR_MSG +=  error_msg + "\n"
			} 	VALID = false ;
			f[i].style.border = "red 1px solid"
		}else{
			f[i].style.border = "auto"	
		}
	}
	if (ERROR_MSG != ""){alert(ERROR_MSG,"error")	}
	return VALID
}

function validate(input){
	require = Boolean(input.getAttribute("require"))
	type = String(input.getAttribute("data_type"))
	value = input.value
	ret = (require) ? false : true
	if (value == "") {	return ret	}
	switch(type.toLowerCase()){
				case "number":	if (isNaN(value) ){	return false }	; break;
				case "password": if (value.length < 4 || value.toLowerCase() == "password" ){	return false	} ;	break ;
				case "zipcode" : if (isNaN(value) || (value.length != 5)){return false	} ;	break ; 
				case "phone" :	if (isNaN(value)||(value.length < 10)){	return false } ; break ;
				case "email" : 	var FILTER = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i ;
					if (!(FILTER.test(value))){ return false };	break ; 
				case "text" :	if (value.length < 2 ){ return false } ; break ;
				case "address" : if (value.length < 5 ){ return false } ; break ;
				case "date" :	if (value.length < 2 ){ return false } ; break ;
				default : break; 
	}return true
}
//---------------------------------------------------------------
function xmlHttp(_OP){
this.createXMLHttp = function() {
	try {		return new XMLHttpRequest(); }catch(e){}
	try {		return new ActiveXObject('Msxml2.XMLHTTP');	}catch (e) {}
	try {	    return new ActiveXObject('Microsoft.XMLHTTP'); }catch(e){  return null	}
}
this.foo = function(_x_){	return	}
this.rnd_url = function(_url){
	if (_url.indexOf("?") > -1){		return	_url + "&rnd=" + Math.random()	}
	return _url + "?rnd=" + Math.random()
}
this.asyncronous	= true // asyncronous IMPORTENT IF false window.onload not return data MOREInfo http://www.webopedia.com/TERM/A/asynchronous.html 
this.url 			= _OP.url ? this.rnd_url(_OP.url) : "#"
this.method 		= (String(_OP.method).toLowerCase()=="post") ?  "POST" : "GET"	
this.data 			= _OP.data ?  _OP.data	:  this.method 	== "POST"  ? "null=" : ""
_OP.response_handler = _OP.response_handler ?	_OP.response_handler : this.foo
_OP.error_handler 	= _OP.error_handler ? _OP.error_handler : this.foo
_OP.xml_handler 	= _OP.xml_handler ? _OP.xml_handler : this.foo
this.request_header = (this.method=="GET") ? "text/html" : "application/x-www-form-urlencoded"	// ; Charset=iso-8859-1"
try {	
		var xmlHttp = this.createXMLHttp();
		if (!(xmlHttp)) return
		xmlHttp.open(this.method, this.url, this.asyncronous);
		xmlHttp.onreadystatechange = function() {
			if (xmlHttp.readyState == 4 ){
					 if (xmlHttp.status == 200) {
						_OP.response_handler(xmlHttp.responseText)
						_OP.xml_handler(xmlHttp.responseXML)
					 }else{
						_OP.error_handler(xmlHttp.status);
					}
			}
		}
		xmlHttp.setRequestHeader("Content-Type",this.request_header)
		xmlHttp.send(this.data)
	}	
	catch (e) {
		console.log("Ajax Error :"+e+ " " + e.description)
	}
}
// JavaScript Document
// resize and move by tlissak
// v 0.7 
// last update
// 27-06-2008
// last change :  onmouseup  inside mousedown

var move={
	mousedown:function(e,elm_id){
		this.elm = document.getElementById(elm_id)
		this.elm.style.position = "absolute"
		this.process 	= true
		this.old_y_pos  = parseInt(this.elm.style.top) ? parseInt(this.elm.style.top) : this.findObjPos(this.elm).y
		this.old_x_pos	= parseInt(this.elm.style.left) ? parseInt(this.elm.style.left) : this.findObjPos(this.elm).x
		this.old_csr_x  = this.cursorPosition(e).x - this.old_x_pos
		this.old_csr_y	= this.cursorPosition(e).y - this.old_y_pos
		document.body.onselectstart=function(){return false}//ie
		document.body.onmousedown=function(){return false}//mozilla}
		document.onmousemove= this.mousemove
		document.onmouseup  = this.mouseup
		}
		,mouseup:function(){
			//mask.hide()
			move.process=false
			document.onmouseup = null
			document.onmousemove = null
			document.body.onselectstart=function(){return true}//ie
			document.body.onmousedown=function(){return true}//mozilla
		}
		,mousemove:function(e){
			//mask.show(5)
			if(move.process){
				move.elm.style.left = move.cursorPosition(e).x - move.old_csr_x +"px"
				move.elm.style.top  = move.cursorPosition(e).y - move.old_csr_y +"px"
			}
		
		}
		,cursorPosition:function(ev){
			ev = ev || window.event;
			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
			}
		}
		,findObjPos:function(obj) {
		if (obj){
			var curleft = 0 ;var curtop = 0;
			if (obj.offsetParent) {
				curleft = obj.offsetLeft
				curtop = obj.offsetTop
				while (obj = obj.offsetParent) {
					curleft += obj.offsetLeft
					curtop += obj.offsetTop
				}
			}
			return {x:curleft,y:curtop};
		}
	}
}

