<!--
	var appName = navigator.appVersion.toLowerCase();

	function browserIsIE(ver) {
		var ok = false;
		ok = (document.all && appName.indexOf('msie') > -1);
		if (ver && ok) {
			var version = parseFloat(appName.split("msie")[1]);
			ok = (version == ver);
		}
		return ok;
	}

	function browserIsSafari() {
		return (appName.indexOf('safari') >  -1);
	}

	function isString(o) {
		return (typeof(o) == "string");
	}

	function isObject(o) {
		return (typeof(o) == "object");
	}

	function doTrace(msg) {
		document.getElementById("trace").innerHTML += msg + "<br />";
	}

	function viewProduct(prod_id) {
		var win = window.open("product.asp?p=" + prod_id, "product" ,
			"status=0, toolbar=0, location=0, menubar=0, directories=0, resizable=0, scrollbars=1, height=550, width=515");
		win.focus();
	}

	function viewPic(pic) {
		var win = window.open("view-pic.asp?pic=" + pic, "pic" ,
			"status=0, toolbar=0, location=0, menubar=0, directories=0, resizable=0, scrollbars=0, height=50, width=50");
		win.focus();
	}

	function getCart() {
		var cart = getCookie("cart");
		if (cart && cart != "") {
			cart = cart.substr(1, cart.length - 2);
			return cart.split("][");
		}
		return new Array();
	}

	function clearCart() {
		setCookie("cart", "");
		setCookie("cart_counter", 0);
	}

	function saveCart(days) {
		var cart = getCookie("cart");
		var cart_counter = getCookie("cart_counter");
		setCookie("cart", cart, days);
		setCookie("cart_counter", cart_counter, days);
	}

	function setCart(items) {
		var i = items.length;
		var cart;
		if (items.length > 0) {
			cart = "[" + items.join("][") + "]";
		} else {
			cart = "";
		}
		setCookie("cart", cart);
		setCookie("cart_counter", i);
		var cart_counter = document.getElementById("cart_counter");
		if (cart_counter) {
			if (i > 0) {
				cart_counter.innerText = i;
			} else {
				cart_counter.innerText = 0;
			}
		}
		if (window.name == "product" && window.opener) {
			var cart_counter = window.opener.document.getElementById("cart_counter");
			if (cart_counter) {
				if (i > 0) {
					cart_counter.innerText = i;
				} else {
					cart_counter.innerText = 0;
				}
			}
		}
	}

	function addToCart(prod_id, size) {
		var qty = 1;
		if (!size) {size = "";}
		var cart_items = getCart();
		var added = false;
		for (var i = 0; i < cart_items.length; i++) {
			var prod = cart_items[i].split("|");
			if (prod[0] == prod_id && prod[2] == size) {
				prod[1] = parseInt(prod[1]) + qty;
				cart_items[i] = prod.join("|");
				added = true;
			}
		}
		if (!added) {
			cart_items[cart_items.length] = prod_id + "|" + qty + "|" + size;
		}
		setCart(cart_items);
		var pic = document.getElementById("in_cart" + prod_id);
		if (pic) {pic.style.display = "";}
		if (window.name == "product" && window.opener) {
			var pic = window.opener.document.getElementById("in_cart" + prod_id);
			if (pic) {pic.style.display = "";}
			window.opener.document.location = siteUrl + "cart.asp";
		} else {
			//document.location = siteUrl + "cart.asp";
		}
	}

	function itemInCart(prod_id) {
		var cart_items = getCart();
		for (var i = 0; i < cart.length; i++) {
			var prod = cart_items[i].split("|");
			if (prod[0] == prod_id) {
				return true;
			}
		}
		return false;
	}

	function gotoCart() {
		if (window.name == "product" && window.opener) {
			window.opener.document.location = siteUrl + "cart.asp";
			window.close();
		} else {
			document.location = siteUrl + "cart.asp";
		}
	}

	function hideFooter(id) {
		if (document.getElementById(id)) {
			document.getElementById(id).style.display = "none";
		}
	}

	function showFooter(id) {
		if (document.getElementById(id)) {
			if (browserIsIE()) {
				document.getElementById(id).style.bottom = "0px";
			} else {
				document.body.style.minHeight = "100%";
				document.getElementById(id).style.bottom = "0px";
			}
			document.getElementById(id).style.display = "";
		}
	}

	Array.prototype.inArray = function (value) {
		var i;
		for (i=0; i < this.length; i++) {
			if (this[i] === value) {
				return true;
			}
		}
		return false;
	};

	function createNewNode(tp, id, cs, tx) {
		var node = document.createElement(tp);
		if (tx != null && tx != '') {node.appendChild(document.createTextNode(tx));}
		if (id != null && id != '') {node.id = id;}
		if (cs != null && cs != '') {node.className = cs;}
		return node;
	}

	function createNewEvent(e, meth, func, cap) {
		if (isString(e)) {e = document.getElementById(e);}
		if (e.addEventListener){
			e.addEventListener(meth, func, cap);
			EventCache.add(e, meth, func);
			return true;
		} else if (e.attachEvent) {
			e["e"+meth+func] = func;
			e[meth+func] = function() { e["e"+meth+func]( window.event ); }
			e.attachEvent("on"+ meth, e[meth+func]);
			EventCache.add(e, meth, func);
			return true;
		} else {
			e["on"+meth] = e["e"+meth+func];
			return true;
		}
		return false;
	}

	function cancelEvent(e) {
		e = e ? e : window.event;
		if (e.stopPropagation) {e.stopPropagation();}
		if (e.preventDefault) {e.preventDefault();}
		e.cancelBubble = true;
		//e.cancel = true;
		//e.returnValue = false;
		return false;
	}

	var EventCache = function(){
		var listEvents = [];
		return {
			listEvents : listEvents,
			add : function(node, sEventName, fHandler){
				listEvents.push(arguments);
			},
			flush : function(){
				var i, item;
				for(i = listEvents.length - 1; i >= 0; i = i - 1){
					item = listEvents[i];
					if(item[0].removeEventListener){
						item[0].removeEventListener(item[1], item[2], item[3]);
					};
					if(item[1].substring(0, 2) != "on"){
						item[1] = "on" + item[1];
					};
					if(item[0].detachEvent){
						item[0].detachEvent(item[1], item[2]);
					};
					item[0][item[1]] = null;
				};
			}
		};
	}();

	function getCookie(name)
	{
		var cookies = document.cookie.split(';');
		for (var i = 0; i < cookies.length; i++) {
			var c = cookies[i].split("=");
			if (c[0] && trim(c[0]) == name) {return trim(c[1])};
		}
		return null;
	}

	function setCookie(name, value, days)
	{
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		} else {
			expires = "";
		}
		document.cookie = name+"="+value+expires+"; path=/";
	}

	function createRequestObject(url, callback)
	{
		try {
		var xmlhttp = null;
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
			xmlhttp.onreadystatechange = callback;
			xmlhttp.open("GET", url, true);
			//xmlhttp.send(null);
		// branch for IE/Windows ActiveX version
		} else if (window.ActiveXObject) {
			try {
				xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
			} catch(e) {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			if (xmlhttp) {
				xmlhttp.onreadystatechange = callback;
				xmlhttp.open("GET", url, true);
				//xmlhttp.send(null);
			}
		}
	}catch(e) {alert(e.message);}
		return  xmlhttp;
	}

	function createRequestPostObject(url, callback)
	{
		try {
		var xmlhttp = null;
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
			xmlhttp.open("POST", url);
			xmlhttp.onreadystatechange = callback;
			xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;');
		// branch for IE/Windows ActiveX version
		} else if (window.ActiveXObject) {
			try {
				xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
			} catch(e) {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			if (xmlhttp) {
				xmlhttp.open("POST", url);
				xmlhttp.onreadystatechange = callback;
				xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;');
			}
		}
	}catch(e) {alert(e.message);}
		return  xmlhttp;
	}

	function handleResponseText(xmlhttp, no_split)
	{
		alert("xmlhttp="+xmlhttp);
		if (xmlhttp) {
			alert("xmlhttp.readyState="+xmlhttp.readyState);
			if((xmlhttp.readyState == 4)&& (xmlhttp.status == 200))
			{
				var response = xmlhttp.responseText;
				alert("response="+response);
				if (response && response != "") {
					if (no_split == true) {
						return response;
					} else {
						return response.split("|");
					}
				}
			}
		}
		return null;
	}

	function getCache(path, style, params)
	{
		try {
			if (!isString(path) || path == "") {return;}
			if (browserIsIE()) {
				var xml = new ActiveXObject("MSXML2.FreeThreadedDomDocument");
				xml.setProperty("SelectionLanguage", "XPath");
				xml.async = false;
				xml.load(path);
				if (!xml) {return '';}
				if (!isString(style) || style == "") {return xml.documentElement.xml;}
				var xsl = new ActiveXObject("MSXML2.FreeThreadedDomDocument");
				xsl.setProperty("SelectionLanguage", "XPath");
				xsl.async = false;
				xsl.load(style);
				if (!xsl) {return xml.documentElement.xml;}
				var xslt = new ActiveXObject("MSXML2.XSLTemplate");
				xslt.stylesheet = xsl.documentElement;
				if (!params) {return xml.transformNode(xsl);}
				var proc = xslt.createProcessor;
				if (!proc) {return xml.transformNode(xsl);}
				proc.input = xml;
				for (var i = 0; i < params.length; i++) {
					if (params[i]) {
						if (isString(params[i][0]) && params[i][0] != "") {
							if (!isString(params[i][1])) {params[i][1] = "";}
							proc.addParameter(params[i][0], params[i][1]);
						}
					}
				}
				proc.transform();
				var res = proc.output;
				return res;
			} else {
				var xml = document.implementation.createDocument("", "", null);
				xml.async = false;
				xml.load(path);
				if (!xml) {return;}
				if (!isString(style) || style == "") {obj.appendChild(xml.documentElement); return}
				var xsl = document.implementation.createDocument("", "", null);
				xsl.async = false;
				xsl.load(style);
				if (!xsl) {obj.appendChild(xml.documentElement); return;}
				var xsltProc = new XSLTProcessor();
				xsltProc.importStylesheet(xsl);
				if (params) {
					for (var i = 0; i < params.length; i++) {
						if (params[i]) {
							if (isString(params[i][0]) && params[i][0] != "") {
								if (!isString(params[i][1])) {params[i][1] = "";}
								xsltProc.setParameter(null, params[i][0], params[i][1]);
							}
						}
					}
				}
				var res = xsltProc.transformToFragment(xml, document);
				return res;
			}
		}
		catch(e) {
			return null;
		}
	}

	//use before starting validation on a form element if you are displaying an error icon
	function hideValidationErrorIcon(icon)
	{
		if (icon) {
			icon.title = "";
			icon.style.display = "none";
		}
	}

	function showValidationErrorIcon(icon, msg)
	{
		if (icon) {
			icon.title += msg + "\n";
			icon.style.display = "";
		}
	}

	function displayValidationMessage(summarize, errors, msg) {
		if (summarize) {
			if (isObject(errors)) {errors.innerHTML += msg + "<br />";}
			else {str_errors += msg + "\n";}
		} else {
			alert(msg);
		}
	}

	//for textboxes, textareas, selectboxes
	function validateRequiredText(el, msg, summarize, icon, errors)
	{
		if (el.value == "") {
			showValidationErrorIcon(icon, msg);
			displayValidationMessage(summarize, errors, msg);
			if (!summarize) {el.focus();}
			return false;
		}
		return true;
	}

	//for dates
	function validateRequiredDate(el, msg, summarize, icon, errors)
	{
		if (isObject(el)) {
			return validateRequiredText(el, msg, summarize, icon, errors);
		} else {
			return validateRequiredSplitDate(el, msg, summarize, icon, errors);
		}
	}

	//for a date comprized of 3 selectboxes
	function validateRequiredSplitDate(el_id, msg, summarize, icon, errors)
	{
		var d = document.getElementById(el_id + "_day");
		var m = document.getElementById(el_id + "_month");
		var y = document.getElementById(el_id + "_year");
		if (d.value == "" || m.value == "" || y.value == "") {
			if (!summarize) {
				if (d.value == "") {d.focus();}
				else if (m.value == "") {m.focus();}
				else {y.focus();}
			}
			showValidationErrorIcon(icon, msg);
			displayValidationMessage(summarize, errors, msg);
			return false;
		}
		return true;
	}

	//for a time comprized of 2 selectboxes
	function validateRequiredTime(el_id, msg, summarize, icon, errors)
	{
		var h = document.getElementById(el_id + "_hour");
		var m = document.getElementById(el_id + "_min");
		if (h.value == "" || m.value == "") {
			if (!summarize) {
				if (h.value == "") {h.focus();}
				else {m.focus();}
			}
			showValidationErrorIcon(icon, msg);
			displayValidationMessage(summarize, errors, msg);
			return false;
		}
		return true;
	}

	function validateNumericText(el, msg, summarize, icon, errors)
	{
		if (el.value != "" && !isDigsOnly(el.value)) {
			showValidationErrorIcon(icon, msg);
			displayValidationMessage(summarize, errors, msg);
			if (!summarize) {el.focus();}
			return false;
		}
		return true;
	}

	function validateInteger(el, msg, summarize, icon, errors)
	{
		if (el.value != "" && el.value != parseInt(el.value)) {
			showValidationErrorIcon(icon, msg);
			displayValidationMessage(summarize, errors, msg);
			if (!summarize) {el.focus();}
			return false;
		}
		return true;
	}

	function validateFloat(el, msg, summarize, icon, errors)
	{
		if (el.value != "" && el.value != parseFloat(el.value)) {
			showValidationErrorIcon(icon, msg);
			displayValidationMessage(summarize, errors, msg);
			if (!summarize) {el.focus();}
			return false;
		}
		return true;
	}

	function validatePhoneNumber(el, msg, summarize, icon, errors)
	{
		if (el.value != "" && !isPhoneNumber(el.value)) {
			showValidationErrorIcon(icon, msg);
			displayValidationMessage(summarize, errors, msg);
			if (!summarize) {el.focus();}
			return false;
		}
		return true;
	}

	function validatePhone(el, msg, summarize, icon, errors)
	{
		if (el.value != "" && !isPhone(el.value)) {
			showValidationErrorIcon(icon, msg);
			displayValidationMessage(summarize, errors, msg);
			if (!summarize) {el.focus();}
			return false;
		}
		return true;
	}

	function validateIdNumber(el, msg, summarize, icon, errors)
	{
		if (el.value != "" && !isIdNumber(el.value)) {
			showValidationErrorIcon(icon, msg);
			displayValidationMessage(summarize, errors, msg);
			if (!summarize) {el.focus();}
			return false;
		}
		return true;
	}

	function validateCell(el, msg, summarize, icon, errors)
	{
		if (el.value != "" && !isCell(el.value)) {
			showValidationErrorIcon(icon, msg);
			displayValidationMessage(summarize, errors, msg);
			if (!summarize) {el.focus();}
			return false;
		}
		return true;
	}

	function validateEmail(el, msg, summarize, icon, errors)
	{
		if (el.value != "" && !isEmail(el.value)) {
			showValidationErrorIcon(icon, msg);
			displayValidationMessage(summarize, errors, msg);
			if (!summarize) {el.focus();}
			return false;
		}
		return true;
	}

	function validateCC(el, msg, summarize, icon, errors)
	{
		if (el.value != "" && !isCC(el.value)) {
			showValidationErrorIcon(icon, msg);
			displayValidationMessage(summarize, errors, msg);
			if (!summarize) {el.focus();}
			return false;
		}
		return true;
	}

	function validateCCExpiry(el_id, msg, summarize, icon, errors)
	{
		var m = document.getElementById(el_id + "_month");
		var y = document.getElementById(el_id + "_year");
		var d = new Date();
		if (m.value != "" && y.value != "" && compareValues(buildExpDate(m.value + "/" + y.value), d, "lt")) {
			showValidationErrorIcon(icon, msg);
			displayValidationMessage(summarize, errors, msg);
			if (!summarize) {el.focus();}
			return false;
		}
		return true;
	}

	function validateFileExtentions(el, ext, msg, summarize, icon, errors)
	{
		if (el.value != "" && !checkFileExt(el.value, ext)) {
			showValidationErrorIcon(icon, msg);
			displayValidationMessage(summarize, errors, msg);
			if (!summarize) {el.focus();}
			return false;
		}
		return true;
	}

	function validatePassConf(pass, passConf, msg, clear, summarize, icon, errors)
	{
		if (pass.value != "" && passConf.value != "" && pass.value != passConf.value) {
			if (clear) {
				pass.value = "";
				passConf.value = "";
			}
			showValidationErrorIcon(icon, msg);
			displayValidationMessage(summarize, errors, msg);
			if (!summarize) {pass.focus();}
			return false;
		}
		return true;
	}

	//compares 2 values of the same type according to the specified operator
	function compareValues(val1, val2, op)
	{
		switch (op) {
			case "eq":
				if (val1 == val2) {return true;}
				break;
			case "lt":
				if (val1 < val2) {return true;}
				break;
			case "gt":
				if (val1 > val2) {return true;}
				break;
			case "lte":
				if (val1 <= val2) {return true;}
				break;
			case "gte":
				if (val1 >= val2) {return true;}
		}
		return false;
	}

	function validateCompareValue(el, op, val, msg, summarize, icon, errors)
	{
		if (el.value != "" && !compareValues(el.value, val, op)) {
			showValidationErrorIcon(icon, msg);
			displayValidationMessage(summarize, errors, msg);
			if (!summarize) {el.focus();}
			return false;
		}
		return true;
	}

	function validateCompareDateValue(el, op, val, msg, summarize, icon, errors)
	{
		if (!isObject(el)) {return validateCompareSplitDateValue(el, op, val, msg, summarize, icon, errors);}
		if (el.value != "" && !compareValues(cDate(el.value), val, op)) {
			showValidationErrorIcon(icon, msg);
			displayValidationMessage(summarize, errors, msg);
			if (!summarize) {el.focus();}
			return false;
		}
		return true;
	}

	function validateCompareSplitDateValue(el_id, op, val, msg, summarize, icon, errors)
	{
		var d = document.getElementById(el_id + "_day");
		var m = document.getElementById(el_id + "_month");
		var y = document.getElementById(el_id + "_year");
		if (d.value != "" && m.value != "" && y.value != "" && !compareValues(cDate(d.value + "/" + m.value + "/" +y.value), val, op)) {
			showValidationErrorIcon(icon, msg);
			displayValidationMessage(summarize, errors, msg);
			if (!summarize) {d.focus();}
			return false;
		}
		return true;
	}

	function validateCompareDateField(el, op, val_el, msg, summarize, icon, errors)
	{
		var val;
		if (document.getElementById(val_el)) {
			val = cDate(document.getElementById(val_el).value);
		} else {
			var d = document.getElementById(val_el + "_day");
			var m = document.getElementById(val_el + "_month");
			var y = document.getElementById(val_el + "_year");
			val = cDate(d.value + "/" + m.value + "/" +y.value);
		}
		return validateCompareDateValue(el, op, val, msg, summarize, icon, errors);
	}

	function checkFileExt(path, extentions)
	{
		var ending, num, max, ext_arr;
		num = path.lastIndexOf('.');
		max = path.length;
		ending = path.substring(num+1,max);
		ending = ending.toLowerCase();
		ext_arr = extentions.split(",");
		for (i=0; i<ext_arr.length; i++) {
			if (ending == trim(ext_arr[i]))
				return true;
		}
		return false;
	}

	function trim(str) {
		if (!isString(str) || str.length <= 0) {return str;}
		var trimStr = str;
		var i;
		//trim left:
		for (i = 0; i < str.length; i++) {
			if (str.charAt(i) != " ") {break;}
		}
		trimStr = str.substr(i)
		if (trimStr.length <= 0) {return trimStr;}
		//trim right:
		for (i = trimStr.length - 1; i > -1; i--) {
			if (trimStr.charAt(i) != " ") {break;}
		}
		trimStr = trimStr.substring(0, i + 1);
		return trimStr;
	}

	//converts a string in format "dd/mm/yyyy" to a date
	function cDate(str)
	{
	 var d;
	 d= Date.parse(str.substr(3,2)+"/"+str.substr(0,2)+"/"+str.substr(6,4));
	 return new Date(d);
	}

	function buildExpDate(exp_str)
	{
		var d = cDate("01/" + exp_str);
		d.setMonth(d.getMonth() + 1);
		d.setDate(d.getDate() - 1);
		return d;
	}

	function isDigsOnly(str) {
		var digsRegxp = /^\d+$/;
		if (digsRegxp.test(str) != true)
			return false;
		return true;
	}

	function isIdNumber(str) {
		var idRegxp = /^\d{9}$/;
		if (idRegxp.test(str)) {
			return true;
		}
		return false;
	}

	function isCC(str) {
		var ccRegxp = /^[1-9]\d{3}([- ]?\d{4}){3}$/;
		if (ccRegxp.test(str)) {
			return true;
		}
		return false;
	}

	function isEmail(str)
	{
		var emailRegxp = /^([\w]+)(.[\w]+)*@([\w]+)(.[\w]{2,3}){1,2}$/;
		if (emailRegxp.test(str) != true)
			return false;
		return true;
	}

	function isPhoneNumber(str)
	{
		var phoneRegxp = /^[1-9]\d{6}$/;
		if (phoneRegxp.test(str) != true)
			return false;
		return true;
	}

	function isPhone(str)
	{
		var phoneRegxp = /^0[23489][- ]?[1-9]\d{6}$/;
		if (phoneRegxp.test(str) != true)
			return false;
		return true;
	}

	function isCell(str)
	{
		var cellRegxp = /^05[0247][- ]?[1-9]\d{6}$/;
		if (cellRegxp.test(str) != true)
			return false;
		return true;
	}

	function initCal(field, trigger)
	{
		Calendar.setup(
			{
				inputField : field, // ID of the input field
				ifFormat : "%d/%m/%Y", // the date format
				button : trigger, // ID of the button
				align: null //alignment for the calendar
			});
	}
//-->
