////////////////////////////////////////////////////////////////////////////////////////////////////
/*
Disable right click script III- By Renigade (renigade@mediaone.net)
For full source code, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/
var message="";

function clickIE() {
	if(document.all) {
		(message);
		return false;
	}
}

function clickNS(e) {
	if(document.layers||(document.getElementById&&!document.all)) {
		if(e.which==2||e.which==3) {
			(message);
			return false;
		}
	}
}

if(document.layers) {
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown=clickNS;
} else {
	document.onmouseup=clickNS;
	document.oncontextmenu=clickIE;
}

document.oncontextmenu=new Function("return false")

////////////////////////////////////////////////////////////////////////////////////////////////////
/*
Submit Once form validation-
For full source code, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/
function submitonce(theform){
	if(document.all||document.getElementById) {		//if IE 4+ or NS 6+
		for(i=0;i<theform.length;i++) {				//screen thru every element in the form, and hunt down "submit" and "reset"
			var tempobj=theform.elements[i]
			if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")	//disable em
				tempobj.disabled=true
		}
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////
function lXML(location, url) {
	if(window.XMLHttpRequest) {
		// Native XMLHttpRequest call
		req = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		// IE/Windows ActiveX call
		req = new ActiveXObject("Microsoft.XMLHTTP");
	}
	if(req) {
		//alert("load XML:" + "http<?=$CFG["HTTPS"];?>://<?=$_SERVER["HTTP_HOST"];?>" + location);
		req.open("POST", "http://lesdames.ca" + location, true);
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		req.onreadystatechange = pReq;
		req.send(url);
	}
}

function pReq() {
	if(req.readyState == 4) {
		if(req.status == 200) {
			var node = req.responseXML.getElementsByTagName("method");
			if(node && (node.length > 0)) {
				method = req.responseXML.getElementsByTagName("method")[0].firstChild.data;
				eval(method);
			} else {
				alert("Error: No 'method' found in response from server.\n\n" + req.statusText);
			}
		} else {
			alert("Error:\n" + req.statusText);
		}
	}
}

/////////////////////////////////// Beginning of the Div Show Code //////////////////////////////////////////////
var timer = null;
var divShowIsShown = false;
var divShowName = null;
var divShowWait = null;
var divShowWaitMask = null;
var divShowIframe = null;

function divShow(a) { // show which div name
	divShowIsShown = true;
	if(a) {
		divShowName = document.getElementById(a);
	}
	divShowWaitMask.style.display = "block";
	divShowIframe.style.display = "block";
	divShowName.style.display = "block";
	divShowPopup();
}

function delayShow() {
	if(divShowIsShown == true) {
   		timer = setTimeout("divShowPopup();", 200);
	}
}

function divShowPopup() {
    if(divShowWait.style.display == "block") {
		divShowWait.style.display = "block";
	}
	div_wait_height = divShowWait.offsetHeight;
	div_wait_width = divShowWait.offsetWidth;
	var scTop = parseInt(getScrollTop(), 10);
	var scLeft = parseInt(getScrollLeft() ,10);
	var fullHeight = getViewportHeight();
	var fullWidth = getViewportWidth();
	divShowWait.style.top = (scTop + ((fullHeight - div_wait_height) / 2)) + "px";
	divShowWait.style.left = (scLeft + ((fullWidth - div_wait_width) / 2)) + "px";
	divShowWaitMask.style.height = fullHeight + "px";
	divShowIframe.style.height = fullHeight + "px";
	if(document.all) {
		// If IE
		divShowWaitMask.style.width = fullWidth + "px";
		divShowIframe.style.width = fullWidth + "px";
	} else {
		// If Firefox
		divShowWaitMask.style.width = (fullWidth - 17) + "px";
		divShowIframe.style.width = (fullWidth - 17) + "px";
	}
	divShowWaitMask.style.top = scTop + "px";
	divShowIframe.style.top = scTop + "px";
	divShowWaitMask.style.left = scLeft + "px";
	divShowIframe.style.left = scLeft + "px";
	if(divShowName != null) {
		div_name_height = divShowName.offsetHeight;
		div_name_width = divShowName.offsetWidth;
		divShowName.style.top = (scTop + ((fullHeight - div_name_height) / 2)) + "px";
		divShowName.style.left = (scLeft + ((fullWidth - div_name_width) / 2)) + "px";
	}
	if(divShowWait.style.display == "none") {
		divShowWait.style.display = "none";
	}
	clearTimeout(timer);
}

function divShowWaitStart() {
	document.body.style.cursor = "wait";
	if(divShowName != null) {
		divShowName.style.display = "none";
	}
	divShowWait.style.display = "block";
    divShowWaitMask.style.display = "block";
	divShowIframe.style.display = "block";
	div_wait_height = divShowWait.offsetHeight;
	div_wait_width = divShowWait.offsetWidth;
	var scTop = parseInt(getScrollTop(), 10);
	var scLeft = parseInt(getScrollLeft() ,10);
	var fullHeight = getViewportHeight();
	var fullWidth = getViewportWidth();
	divShowWait.style.top = (scTop + ((fullHeight - div_wait_height) / 2)) + "px";
	divShowWait.style.left = (scLeft + ((fullWidth - div_wait_width) / 2)) + "px";
	divShowWaitMask.style.height = fullHeight + "px";
	divShowIframe.style.height = fullHeight + "px";
	if(document.all) {
		// If IE
		divShowWaitMask.style.width = fullWidth + "px";
		divShowIframe.style.width = fullWidth + "px";
	} else {
		// If Firefox
		divShowWaitMask.style.width = (fullWidth - 17) + "px";
		divShowIframe.style.width = (fullWidth - 17) + "px";
	}
	divShowWaitMask.style.top = scTop + "px";
	divShowIframe.style.top = scTop + "px";
	divShowWaitMask.style.left = scLeft + "px";
	divShowIframe.style.left = scLeft + "px";
}

function divShowWaitStop() {
	document.body.style.cursor = "default";
	if(divShowName != null) {
		divShowName.style.display = "block";
		divShowPopup();
	}
	divShowWait.style.display = "none";
}

if(window.addEventListener) // DOM method for binding an event
	window.addEventListener("resize", delayShow, false);
else if(window.attachEvent) // IE exclusive method for binding an event
	window.attachEvent("onresize", delayShow);
else if(document.getElementById) // support older modern browsers
	window.onresize = delayShow;

if(window.addEventListener) // DOM method for binding an event
	window.addEventListener("scroll", delayShow, false);
else if(window.attachEvent) // IE exclusive method for binding an event
	window.attachEvent("onscroll", delayShow);
else if(document.getElementById) // support older modern browsers
	window.onscroll = delayShow;

function getScrollTop() {
	if(self.pageYOffset) { // all except Explorer
		return self.pageYOffset;
	} else if(document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
		return document.documentElement.scrollTop;
	} else if(document.body) { // all other Explorers
		return document.body.scrollTop;
	}
}

function getScrollLeft() {
	if(self.pageXOffset) { // all except Explorer
		return self.pageXOffset;
	} else if(document.documentElement && document.documentElement.scrollLeft) { // Explorer 6 Strict
		return document.documentElement.scrollLeft;
	} else if(document.body) { // all other Explorers
		return document.body.scrollLeft;
	}
}

function getViewportHeight() {
	if(window.innerHeight != window.undefined) return window.innerHeight;
	if(document.compatMode == 'CSS1Compat') return document.documentElement.clientHeight;
	if(document.body) return document.body.clientHeight;
	return window.undefined;
}

function getViewportWidth() {
	var offset = 17;
	var width = null;
	if(window.innerWidth != window.undefined) return window.innerWidth;
	if(document.compatMode == 'CSS1Compat') return document.documentElement.clientWidth;
	if(document.body) return document.body.clientWidth;
}

function setPng24(obj) {
	obj.width=obj.height=1;
	obj.className=obj.className.replace(/\bpng24\b/i,'');
	obj.style.filter =
	"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
	obj.src='';
	return '';
}

