/* onFocus & onBlur Functions */
	function setvalue(target, message) {
		if (target.value == "") {
			target.value = message;
		}
	}
	
	function resetvalue(target, message) {
		if (target.value == message) {
			target.value = '';
		}
	}
/* onFocus & onBlur Functions */

/* Cart Functions */
	function checkQuantity(form, inputold, inputnew) {
		var regexhandlerold = document.forms[form].elements[inputold].value;
		var regexhandlernew = document.forms[form].elements[inputnew];
		
		if (regexhandlerold.match(/[^0-9]/)) {
			regexhandlernew.value = regexhandlerold.replace(/[^0-9]([0-9]*)[^0-9]/g, "$1");
			return true;
		} else {
			regexhandlernew.value = regexhandlerold;
			return true;
		}
	}
/* Cart Functions */

/* Form Functions */
	function confirmQuestion(confirmLink, confirmMessage) {
	    // Confirmation is not required in the configuration file
	    // or browser is Opera (crappy js implementation)
	    //if (confirmMsg == '' || typeof(window.opera) != 'undefined') {
	    //    return true;
	    //}
		
	    var confirmationObj = confirm(confirmMessage);
	    
	    if (confirmationObj) {
	        confirmLink.href += '&confirmed=1';
	    }
		
	    return confirmationObj;
	}

	function updateSelectBox(parent_value, parent_value_array, child_array, selected_value, seperator) {
		var list = parent_value_array[parent_value];
		var box = child_array;
		box.options.length = 0;
		
		if (seperator == '') {
			seperator = '±';
		}
		
		for (i = 0; i < list.length; i++) {
			var split_string = list[i].split(seperator);
			box.options[i] = new Option(split_string[1], split_string[0]);
			box.options[i].selected = false;
			
			if (selected_value == split_string[0]) {
				box.options[i].selected = true;
			}
		}
		
		return true;
	}
/* Form Functions */
	
/* Page Loading Functions */
	function addLoadEvent(func) {
	  var oldonload = window.onload;
	  if (typeof window.onload != 'function') {
	    window.onload = func;
	  } else {
	    window.onload = function() {
	      oldonload();
	      func();
	    }
	  }
	}
	
	/**
	 * Example Calling Code
	 *	addLoadEvent(functionNameToRun);
	 *	addLoadEvent(function() {
	 *	  Insert code to run here
	 *	});
	 * Example Calling Code
	**/
	
/* Page Loading Functions */

/* Image Functions */
	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];
			}
		}
	}
/* Image Functions */