function __init_highslide(hs) {
	hs.graphicsDir = 'includes/javascript/highslide/graphics/';
	hs.outlineType = 'rounded-white';
	hs.outlineWhileAnimating = false;
	hs.showCredits = false;
	hs.fadeInOut = true;
	hs.wrapperClassName = 'highslide-white';
	hs.allowMultipleInstances = false;
	hs.Expander.prototype.printIframe = function () {
		var name = this.iframe.name;
		frames[name].focus();
		frames[name].print();
		return false;
	}
}

function js_goto(page_url) {
	if ( page_url != '' ) parent.location.href = page_url;
	void(0);
}

function hide_message(msgID) { document.getElementById(msgID).style.display = 'none'; }

function openWindow(url, wname, w, h) {
  sWindow = window.open(url, ( wname == '' ? 'popupWindow' : wname ), 'toolbar=no,directories=yes,status=no,location=no,menubar=yes,scrollbars=yes,resizable=yes,width=' + w + ',height=' + h + '')
	if (sWindow != null) sWindow.focus();
}

function getKeyCode(e) { return ( navigator.appName == 'Netscape' || navigator.appName == '' ? e.which : e.keyCode ); }
function isValidNumber(e) {
	kCode = getKeyCode(e);
	return (kCode == 27 || kCode == 13 || kCode == 0 || kCode == 8 || (kCode > 47 && kCode < 58));
}
function isValidInteger(e) {
	kCode = getKeyCode(e);
	return ( isValidNumber(e) || kCode == 116);
}
function isValidDecimal(e) {
	kCode = getKeyCode(e);
	return ( isValidInteger(e) || kCode == 46);
}

function SetFocus(formName) {
	var target = 0;
	if (formName != "" ) {
		for (i=0; i<document.forms.length; i++) {
			if (document.forms[i].name == formName) {
				target = i;
				break;
			}
		}
	}

	var TargetForm = document.forms[target];
	for (i=0; i<TargetForm.length; i++) {
		if ( TargetForm.elements[i].type != "image" && TargetForm.elements[i].type != "hidden" && TargetForm.elements[i].type != "reset" && TargetForm.elements[i].type != "submit" ) {
			TargetForm.elements[i].focus();
			if ( TargetForm.elements[i].type == "text" || TargetForm.elements[i].type == "password" ) TargetForm.elements[i].select();
			break;
		}
	}
}

function RemoveFormatString(cible, formatStr) {
	if ( cible.value == formatStr ) cible.value = "";
	cible.select();
}

/** Ajout/retrait de qté **/   
function addQuantity(id, qty) {
	var o = document.getElementById(id);
	if ( o != null && typeof o != "undefined" ) {
		var q = parseInt(o.value);
		if (isNaN(q)) q = 0;
		if ( q+qty >= 0 ) o.value = (q+qty);
	}
}

function resetQtyInput(id, bFocus) {
	var o = document.getElementById(id);
	if (o != null && typeof o != "undefined" ) {
		var q = parseInt(o.value);
		if (isNaN(q)) q = 0;
		if ( q == 0 ) {
			if (bFocus)	o.value = "";
			else o.value = "0";
		}
	}
}

function showPe_MultiPdts(tdvId, idListe) {
	var thumbnail_prefix = "linkpdttable_";
	var product_prefix = "divProductContainer_";

	for (i = 1; i <= 4; i++){
		var thumbnail = thumbnail_prefix + idListe + "_" + i;
		if ( document.getElementById(thumbnail) ) {
			document.getElementById(thumbnail).className = "";
			document.getElementById(product_prefix + idListe + "_" + i).style.display = "none";
		}
	}
	document.getElementById(thumbnail_prefix + idListe + "_" + tdvId).className = "hover";
	document.getElementById(product_prefix + idListe + "_" + tdvId).style.display = "block";
}

function show_Review(total, tdvId) {
	var lprefix = "lnkReview";
	var rprefix = "review";
	var o = document.getElementById(rprefix + tdvId);
	var l = document.getElementById(lprefix + tdvId);

	if ( o.style.overflow == 'visible' ) {
		o.style.overflow = "hidden";
		o.style.height = "40px";
		l.innerHTML = "Lire la suite &raquo;";
	} else {
		for (i = 1; i <= total; i++){
			var oi = document.getElementById(rprefix + i);
			if ( oi ) {
				oi.style.overflow = "hidden";
				oi.style.height = "40px";
				document.getElementById(lprefix + i).innerHTML = "Lire la suite &raquo;";
			}
		}
		o.style.overflow = "visible";
		o.style.height = "auto";
		l.innerHTML = "&laquo; Masquer";
	}
}
function loadmessage(URL) {
	document.getElementById('msg-confirm-content').innerHTML = '<iframe border="5" frameborder="0" id="msgbox-frame" scrolling="no" src="' + URL + '" width="100%" height="620" style="position:relative; z-index:110;" allowTransparency="true"></iframe>';
	document.getElementById('msg-confirm').style.display = "block";
	document.getElementById('msg-confirm-content').focus();
}
function addToBasket(id, qte) {
	if (document.cookie.length > 0) {
		loadmessage('product_info_confirm.php?action=add_product_new&products_id=' + id + '&products_quantity=' + qte);
		return false;
	}
}

function rowOverEffect(o) { if (o.className == 'moduleRow') o.className = 'moduleRowOver'; }
function rowOutEffect(o) { if (o.className == 'moduleRowOver') o.className = 'moduleRow'; }

