// JavaScript Document

 <!--
 
	function kH(e) {
var pK = e ? e.which : window.event.keyCode;
return pK != 13;
}
document.onkeypress = kH;
if (document.layers) document.captureEvents(Event.KEYPRESS);


function buyPackage(){
document.location='?idpage=1399&type=comeOnIn';

	} 
 
function go2page(){
	alert('Bientôt!');
	} 


function checkCheckBox(f){
if (f.agree.checked == false )
{
alert('Veuillez accepter les conditions d\'utilsation.');
return false;
}else
return true;
}

function openWindow(theId,theWindow) {
       window.open('http://www.poseclick.com/pop.asp?idpage='+ theId +'',''+ theWindow +'','scrollbars=yes,width=650,height=500')
}


 function newImage(arg) {
 	if (document.images) {
 		rslt = new Image();
 		rslt.src = arg;
 		return rslt;
 	}
 }
 
 function changeImages() {
 	if (document.images && (preloadFlag == true)) {
 		for (var i=0; i<changeImages.arguments.length; i+=2) {
 			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
 		}
 	}
 }
 
 var preloadFlag = false;
 function preloadImages() {
 	if (document.images) {
 		previousArrowover = newImage("images/previousArrowover.gif");
 		nextArrowover = newImage("images/nextArrowover.gif");
 		preloadFlag = true;
 	}
 }
 
 
function urlEncode(str){
    str=escape(str);
    str=str.replace(new RegExp('\\+','g'),'%2B');
    return str.replace(new RegExp('%20','g'),'+');
} 


function include_dom(script_filename) {
    var html_doc = document.getElementsByTagName('head').item(0);
    var js = document.createElement('script');
    js.setAttribute('language', 'javascript');
    js.setAttribute('type', 'text/javascript');
    js.setAttribute('src', script_filename);
    html_doc.appendChild(js);
    return false;
}
 
 
 function sack(file) {
	this.xmlhttp = null;

	this.resetData = function() {
		this.method = "POST";
  		this.queryStringSeparator = "?";
		this.argumentSeparator = "&";
		this.URLString = "";
		this.encodeURIString = true;
  		this.execute = false;
  		this.element = null;
		this.elementObj = null;
		this.requestFile = file;
		this.vars = new Object();
		this.responseStatus = new Array(2);
  	};

	this.resetFunctions = function() {
  		this.onLoading = function() { };
  		this.onLoaded = function() { };
  		this.onInteractive = function() { };
  		this.onCompletion = function() { };
  		this.onError = function() { };
		this.onFail = function() { };
	};

	this.reset = function() {
		this.resetFunctions();
		this.resetData();
	};

	this.createAJAX = function() {
		try {
			this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e1) {
			try {
				this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e2) {
				this.xmlhttp = null;
			}
		}

		if (! this.xmlhttp) {
			if (typeof XMLHttpRequest != "undefined") {
				this.xmlhttp = new XMLHttpRequest();
			} else {
				this.failed = true;
			}
		}
	};

	this.setVar = function(name, value){
		this.vars[name] = Array(value, false);
	};

	this.encVar = function(name, value, returnvars) {
		if (true == returnvars) {
			return Array(encodeURIComponent(name), encodeURIComponent(value));
		} else {
			this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true);
		}
	}

	this.processURLString = function(string, encode) {
		encoded = encodeURIComponent(this.argumentSeparator);
		regexp = new RegExp(this.argumentSeparator + "|" + encoded);
		varArray = string.split(regexp);
		for (i = 0; i < varArray.length; i++){
			urlVars = varArray[i].split("=");
			if (true == encode){
				this.encVar(urlVars[0], urlVars[1]);
			} else {
				this.setVar(urlVars[0], urlVars[1]);
			}
		}
	}

	this.createURLString = function(urlstring) {
		if (this.encodeURIString && this.URLString.length) {
			this.processURLString(this.URLString, true);
		}

		if (urlstring) {
			if (this.URLString.length) {
				this.URLString += this.argumentSeparator + urlstring;
			} else {
				this.URLString = urlstring;
			}
		}

		// prevents caching of URLString
		this.setVar("rndval", new Date().getTime());

		urlstringtemp = new Array();
		for (key in this.vars) {
			if (false == this.vars[key][1] && true == this.encodeURIString) {
				encoded = this.encVar(key, this.vars[key][0], true);
				delete this.vars[key];
				this.vars[encoded[0]] = Array(encoded[1], true);
				key = encoded[0];
			}

			urlstringtemp[urlstringtemp.length] = key + "=" + this.vars[key][0];
		}
		if (urlstring){
			this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator);
		} else {
			this.URLString += urlstringtemp.join(this.argumentSeparator);
		}
	}

	this.runResponse = function() {
		eval(this.response);
	}

	this.runAJAX = function(urlstring) {
		if (this.failed) {
			this.onFail();
		} else {
			this.createURLString(urlstring);
			if (this.element) {
				this.elementObj = document.getElementById(this.element);
			}
			if (this.xmlhttp) {
				var self = this;
				if (this.method == "GET") {
					totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString;
					this.xmlhttp.open(this.method, totalurlstring, true);
				} else {
					this.xmlhttp.open(this.method, this.requestFile, true);
					try {
						this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
					} catch (e) { }
				}

				this.xmlhttp.onreadystatechange = function() {
					switch (self.xmlhttp.readyState) {
						case 1:
							self.onLoading();
							break;
						case 2:
							self.onLoaded();
							break;
						case 3:
							self.onInteractive();
							break;
						case 4:
							self.response = self.xmlhttp.responseText;
							self.responseXML = self.xmlhttp.responseXML;
							self.responseStatus[0] = self.xmlhttp.status;
							self.responseStatus[1] = self.xmlhttp.statusText;

							if (self.execute) {
								self.runResponse();
							}

							if (self.elementObj) {
								elemNodeName = self.elementObj.nodeName;
								elemNodeName.toLowerCase();
								if (elemNodeName == "input"
								|| elemNodeName == "select"
								|| elemNodeName == "option"
								|| elemNodeName == "textarea") {
									self.elementObj.value = self.response;
								} else {
									self.elementObj.innerHTML = self.response;
								}
							}
							if (self.responseStatus[0] == "200") {
								self.onCompletion();
							} else {
								self.onError();
							}

							self.URLString = "";
							break;
					}
				};

				this.xmlhttp.send(this.URLString);
			}
		}
	};

	this.reset();
	this.createAJAX();
}
 
 
 
 
 


        var enableCache = false;
        var jsCache = new Array();
        var AjaxObjects = new Array();

        function ShowContent(divId,ajaxIndex,url)
        {
	        document.getElementById(divId).innerHTML = AjaxObjects[ajaxIndex].response;
	        if(enableCache){
		        jsCache[url] = 	AjaxObjects[ajaxIndex].response;
	        }
	        AjaxObjects[ajaxIndex] = false;
			document.getElementById('loading').innerHTML = '';
        }

        function Ajax(divId,url)
        {  
	        if(enableCache && jsCache[url]){
		        document.getElementById(divId).innerHTML = jsCache[url];
		        return;
	        }	
	        var ajaxIndex = AjaxObjects.length;  
			document.getElementById('loading').innerHTML = '<img src=js/loading3.gif width=6 height=6 />';
	        AjaxObjects[ajaxIndex] = new sack();
	        AjaxObjects[ajaxIndex].requestFile = url;
	        AjaxObjects[ajaxIndex].onCompletion = function(){ ShowContent(divId,ajaxIndex,url); };
	        AjaxObjects[ajaxIndex].runAJAX();
			

        }

    function makeRequest(url,divId,formValue) {
			var theUniqueID = (new Date()).getTime() % 1000000000;
        
        //url=url+".asp?formValue=" + formValue;
		
		var url = url + '.asp?' + formValue + '&myTemp=' + theUniqueID ;
		//alert(url);
		//document.getElementById(divId).innerHTML = '<img src=images/movewait.gif />';
		document.getElementById(divId).innerHTML = '&nbsp;';
		

  var style = document.getElementById('nicknameContainer').style ;	
  style = " background-color: #fffbd1 ";			

        var http_request = false;

        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
                // Voir la note ci-dessous a propos de cette ligne
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!http_request) {
            alert('Abandon :( Impossible de créer une instance XMLHTTP');
            return false;
        }
        http_request.onreadystatechange = function() { alertContents(http_request,divId); };
		http_request.open('GET', url, true);
        http_request.send(null);

    }


    function alertContents(http_request,divId) {

        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
				
			document.getElementById(divId).innerHTML = http_request.responseText ;
			  } else {
               alert('Un problème est survenu avec la requête.');
            }
        }
    }














function delCart(temp)
{
	if (confirm("Voulez-vous vraiment vider votre panier?"))
	{ 
		Ajax('mynewcart','checkout.asp?getCart=true&delete=true&temp=' + temp);
//		Ajax('tempCart','checkout.asp?temp=' + temp);
//		Ajax('mynewcart','checkout.asp?temp=' + temp);
	}	
	return false;
}

function delCartItem(pic,temp)
{
	if (confirm("Voulez-vous vraiment supprimer cette photo?"))
	{ 
		Ajax('mynewcart','checkout.asp?getCart=true&deleteItem=true&id=' + pic + '&temp=' + temp);
//		Ajax('tempCart','checkout.asp?temp=' + temp);
//		Ajax('mynewcart','checkout.asp?temp=' + temp);
		//viewCart();
	}	
	return false;
}



function viewCart()
{     
	 //document.location='checkout.asp?showCart=true';
	// window.open('checkout.asp?showCart=true', 'cart');
	div1 = document.getElementById('outer');
	div1.style.display = "none";
	
	div2 = document.getElementById('inner');
	div2.style.display = "none";
	
	div3 = document.getElementById('left');
	div3.style.display = "none";
	
	div5 = document.getElementById('cart');
	div5.style.display = "none";
	
	div4 = document.getElementById('mynewcart');
	div4.style.display = "block";

	//changeClass('mynewcart', 'mynewcartOn')
	
	 Ajax('mynewcart','checkout.asp?showCart=true');
	 
	 // this is only to slow down query in an other div, IE bug!!
	 //Ajax('tempCart','cart.asp');
	 
	 //Ajax('grand_total','checkout.asp?showtotal=true&slowDown=true');
	 // we must wait 2.5 seconds to load all pics and total div!!
	 //setTimeout("Ajax('grand_total','checkout.asp?showtotal=true')",3000);

 }

function goBack2cart()
{     
	div9 = document.getElementById('myinfo');
	div9.style.display = "none";
	
    div8 = document.getElementById('mynewcart');
	div8.style.display = "block";

 }



function viewInfo(shoppingInfo)
{     

	Ajax('myinfo','clients.asp?step=1&' + shoppingInfo);
      // alert(shoppingInfo);
	 //document.location='checkout.asp?showCart=true';
	// window.open('checkout.asp?showCart=true', 'cart');
	div4 = document.getElementById('mynewcart');
	div4.style.display = "none";
	
	div5 = document.getElementById('myinfo');
	div5.style.display = "block";

	//changeClass('mynewcart', 'mynewcartOn')
	
 
	 // this is only to slow down query in an other div, IE bug!!
	 //Ajax('tempCart','cart.asp');
	 
	 //Ajax('grand_total','checkout.asp?showtotal=true&slowDown=true');
	 // we must wait 2.5 seconds to load all pics and total div!!
	 //setTimeout("Ajax('grand_total','checkout.asp?showtotal=true')",3000);

 }


function goBack2album(pic,folder)
{     
      
	 //document.location='checkout.asp?showCart=true';
	// window.open('checkout.asp?showCart=true', 'cart');
	
	div4 = document.getElementById('mynewcart');
	div4.style.display = "none";
	
	div1 = document.getElementById('outer');
	div1.style.display = "block";
	
	div2 = document.getElementById('inner');
	div2.style.display = "block";
	
	div3 = document.getElementById('left');
	div3.style.display = "block";
	
	div5 = document.getElementById('cart');
	div5.style.display = "block";

	
	//changeClass('mynewcart', 'mynewcartOff')

	 Ajax('cart','cart.asp?getCart=true');
	 Ajax('pricelist','pricelist.asp?pic=' + pic + '&folder=' + folder);

	
	 //Ajax('mynewcart','checkout.asp?showCart=true');
	 //Ajax('grand_total','checkout.asp?showtotal=true');
 }

function loadPage(album,dossier) 
{   
   	diapoButton = document.getElementById('diapo');
	diapoButton.style.display = "none";

	Ajax('left','loadpage.asp?album=' + album + '&dossier=' + dossier );
	//include_dom('dynamic.js.asp?myTempVar='+ dossier)
	
	// give time to add all shit in session "mySlideShow" 
	setTimeout("include_dom('dynamic.js.asp?myFolder=" + dossier + "');diapoButton.style.display = 'block';", 2500);
	 
	
	//Ajax('pricelist','load.js.asp');
	
 }

function showPic(url,pic)
{   
    image1 = new Image();
	image1.src = 'http://www.webloft.ca/' + url + '';
	//fadeOut('thephoto',100,url);  photoArea
	 Ajax('pic','showpic.asp?Image=' + url + '');
	//Ajax('photoArea','showpic.asp?Image=' + url + '');
	Ajax('pricelist','pricelist.asp?pic=' + pic + '');
	
 }

function initImage() {
	imageId = 'thephoto';
	image = document.getElementById(imageId);
	setOpacity(image, 0);
	image.style.visibility = "visible";
     fadeIn(imageId,0);
}

function fadeIn(objId,opacity) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		setOpacity(obj,opacity);
		if (opacity <= 100) {
			setOpacity(obj, opacity);
			opacity += 15;
			window.c("fadeIn('"+objId+"',"+opacity+")", 5);
		}
	}
}

function fadeOut(objId,opacity,url) {
	
	obj.src = url ;
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity >= 0) {
			setOpacity(obj, opacity);
			opacity -= 15;
			window.setTimeout("fadeOut('"+objId+"',"+opacity+",'"+url+"')", 5);
			
			if (opacity <= -1) {
             image1 = newImage(url);
		     fadeIn(objId,0);
			  
		}
	  }
	}
  }

function setOpacity(obj, opacity) {
	opacity = (opacity == 100)?99.999:opacity;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = opacity/100;
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}

 // -->

function changeClass(Elem, myClass) {
	var elem;
	if(document.getElementById) {
		var elem = document.getElementById(Elem);
	} else if (document.all){
		var elem = document.all[Elem];
	}
	elem.className = myClass;
}

function chooseImage(theImage) {
  var style = document.getElementById(theImage).style ;	
  style = "border: solid 2px red;";
	//style.border = "solid 2px red;";
//	imageId = theImage;
//	image = document.getElementById(imageId);
//	image.style = 'border: solid 2px red'; 
//		setOpacity(image, 20);

 
//	image.style.visibility = "visible";
//    fadeIn(imageId,100);
}


function overImage(theImage,opp) {
	imageId = theImage;
	image = document.getElementById(imageId);
	setOpacity(image, opp);
//	image.style.visibility = "visible";
//    fadeIn(imageId,100);
}


function splitPrice(field,stringToSplit) {
   arrayOfStrings = stringToSplit.split("|");
   stringToSplit = arrayOfStrings[1];
   document.getElementById('tempform').value = stringToSplit
  // tempform.value = stringToSplit
  // alert(stringToSplit)
}


function splitPrice(field,stringToSplit) {
   arrayOfStrings = stringToSplit.split("|");
   stringToSplit = arrayOfStrings[1];
   document.getElementById('tempform').value = stringToSplit
  // tempform.value = stringToSplit
  // alert(stringToSplit)
}



function updateFormat(id,idvalue,qty) {
	// checkout.asp?id=1986&idformat=6&qty=99
	arrayOfStrings = idvalue.split("|")
	idformat = arrayOfStrings[0]
	idprice = arrayOfStrings[1]

	//alert('ID: ' + id + '  value: ' + idformat + '  qty: ' + idprice);
   Ajax('total_' + id + '','checkout.asp?id=' + id + '&idformat=' + idformat + '&qty=' + qty + '&price=' + idprice);
   Ajax('div_grand_total','checkout.asp?showtotal=true');
}


function updateFinition(id,idfinition) {
	// alert('ID: ' + id + ' idfinition: ' + idfinition);
   Ajax('tempCart','checkout.asp?id=' + id + '&idfinition=' + idfinition );
}
function updateBordure(id,idbordure) {
	// alert('ID: ' + id + ' idbordure: ' + idbordure);
   Ajax('tempCart','checkout.asp?id=' + id + '&idbordure=' + idbordure );
}
function updateCouleur(id,idcouleur) {
	// alert('ID: ' + id + ' idcouleur: ' + idcouleur);
   Ajax('tempCart','checkout.asp?id=' + id + '&idcouleur=' + idcouleur );
}
function updateNote(id,mynote) {
	// alert('ID: ' + id + ' mynote: ' + mynote);
   Ajax('tempCart','checkout.asp?id=' + id + '&mynote=' + mynote );
}



function updateQtyCart(field,idfield,idvalue,id,price) {
   var valid = "0123456789"
var ok = "yes";
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
alert("Veuillez entrer un nombre numérique (0123456789) \n ...ou laissez le champ vide S.V.P!");
field.focus();
field.select();
   }
if (ok == "yes") {
	// alert('ID: ' + id + '  price: ' +  document.getElementById('tempform').value  + '  qty: ' + idvalue);
   Ajax('total_' + id + '','checkout.asp?id=' + id + '&price=' + document.getElementById('tempform').value + '&qty=' + idvalue + '');
   Ajax('div_grand_total','checkout.asp?showtotal=true');
   }
}




<!-- Begin
function validate(field,idfield,idvalue,mypic) {
var valid = "0123456789"
var ok = "yes";
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
alert("Veuillez entrer un nombre numérique (0123456789) \n ...ou laissez le champ vide S.V.P!");
field.focus();
field.select();
   }
if (ok == "yes") {
makeRequest('cart.asp','tempCart',idfield,idvalue);
Ajax('cart','cart.asp?getCart=true');
//changeClass(mypic,'picInCart'); 
   }
}
//  End -->


<!-- Begin
function verify() {
var themessage = "Vous devez entrer les informations suivantes: ";
if (document.form44.nicknameText.value=="") {
themessage = themessage + "\n- Pseudonyme";
}
if (document.form44.FIELD_businessname.value=="") {
themessage = themessage + "\n- Nom du Studio de photo";
}
if (document.form44.prenom.value=="") {
themessage = themessage + "\n- Prénom ";
}
if (document.form44.nom.value=="") {
themessage = themessage + "\n- Nom ";
}
if (document.form44.FIELD_Adresse.value=="") {
themessage = themessage + "\n- Adresse";
}
if (document.form44.FIELD_Ville.value=="") {
themessage = themessage + "\n- Ville";
}
if (document.form44.FIELD_province.value=="") {
themessage = themessage + "\n- Province";
}
if (document.form44.FIELD_pays.value=="") {
themessage = themessage + "\n- Pays";
}
if (document.form44.FIELD_codepostal.value=="") {
themessage = themessage + "\n- Code Postal";
}
if (document.form44.telephone_4.value=="") {
themessage = themessage + "\n- Téléphone";
}
if (document.form44.password.value=="") {
themessage = themessage + "\n- Mot de passe";
}
if (document.form44.confirmpassword.value=="") {
themessage = themessage + "\n- Confirmer Mot de passe";
}

if (document.form44.password.value == document.form44.confirmpassword.value) {
} else {
themessage = themessage + "\n- Mot de passe et Confirmer Mot de passe sont différents";	
}

if (document.form44.FIELD_businessemail.value == document.form44.businessemail2.value) {
} else {
themessage = themessage + "\n- COURRIEL et CONFIRMER COURRIEL sont différents";	
}



 var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
 if (regex.test(document.form44.FIELD_businessemail.value)){
 } else {
  themessage = themessage + "\n- Courriel";
}

if (document.form44.agree.checked==false) {
themessage = themessage + "\n- Veuillez accepter les CONDITIONS D\'UTILISATION";
}


//alert if fields are empty and cancel form submit
if (themessage == "Vous devez entrer les informations suivantes: ") {
	
document.getElementById('mysubmit').disabled=true;
document.form44.submit();
}
else {
alert(themessage);
return false;
   }
}
//  End -->







<!-- Begin
function verifyen() {
var themessage = "Please enter the following informations:";
if (document.form44.nicknameText.value=="") {
themessage = themessage + "\n- Nickname";
}
if (document.form44.FIELD_businessname.value=="") {
themessage = themessage + "\n- Business name";
}
if (document.form44.prenom.value=="") {
themessage = themessage + "\n- First name ";
}
if (document.form44.nom.value=="") {
themessage = themessage + "\n- Last name ";
}
if (document.form44.FIELD_Adresse.value=="") {
themessage = themessage + "\n- Address";
}
if (document.form44.FIELD_Ville.value=="") {
themessage = themessage + "\n- City";
}
if (document.form44.FIELD_province.value=="") {
themessage = themessage + "\n- Province";
}
if (document.form44.FIELD_pays.value=="") {
themessage = themessage + "\n- Country";
}
if (document.form44.FIELD_codepostal.value=="") {
themessage = themessage + "\n- Postal Code/zip";
}
if (document.form44.telephone_4.value=="") {
themessage = themessage + "\n- Phone";
}
if (document.form44.password.value=="") {
themessage = themessage + "\n- Password";
}
if (document.form44.confirmpassword.value=="") {
themessage = themessage + "\n- Confirm password";
}

if (document.form44.password.value == document.form44.confirmpassword.value) {
} else {
themessage = themessage + "\n- Password and Confirm password are not the same";	
}

if (document.form44.FIELD_businessemail.value == document.form44.businessemail2.value) {
} else {
themessage = themessage + "\n- EMAIL and CONFIRM EMAIL are not the same";	
}



 var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
 if (regex.test(document.form44.FIELD_businessemail.value)){
 } else {
  themessage = themessage + "\n- Email";
}

if (document.form44.agree.checked==false) {
themessage = themessage + "\n- Please read and accept terms and conditions";
}


//alert if fields are empty and cancel form submit
if (themessage == "Please enter the following informations:") {
	
document.getElementById('mysubmit').disabled=true;
document.form44.submit();
}
else {
alert(themessage);
return false;
   }
}
//  End -->

