<!--
function checkEmail(value) 
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(value)){
		return (true);
	}
	else {
		return (false);
	}
}

function trim(sText)
{
	sText = sText.replace(/^\s*|\s*$/g,"");
	
	return sText;
}

function ltrim(stringToTrim) 
{
	return stringToTrim.replace(/^\s+/,"");
}

function rtrim(stringToTrim) 
{
	return stringToTrim.replace(/\s+$/,"");
}


function IsPosNumber(sText)
{
	var strExp = /^\d*$/;
	var IsNumber = strExp.test(sText);
		
	return IsNumber;

}

function IsDecimal(sText)
{
	var strExp = /^[0-9]*(\.)?[0-9]+$/;
	var IsNumber = strExp.test(sText);
		
	return IsNumber;
}

function IsANumericValue(sText)
{
	var strExp = /^(\d|-)?(\d|,)*\.?\d*$/;
	var IsNumber = strExp.test(sText);

	return IsNumber;
}
function togglediv(id)
{
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		if(document.getElementById(id).style.display == 'none')
		{
			showdiv(id);
		}
		else
		{
			hidediv(id);
		}
	}
	else {
		if (document.layers) { // Netscape 4
			if(document.id.display == 'none')
			{
				showdiv(id);
			}
			else
			{
				hidediv(id);
			}
		}
		else { // IE 4
			if(document.all.id.style.display == 'none')
			{
				showdiv(id);
			}
			else
			{
				hidediv(id);
			}
		}
	}
}

function hidediv(id)
{
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id)
{
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function showElement(elementID, setDisplay, displayType)
{
	var o = MM_findObj(elementID);
	var dtype = 'block';
	if(displayType && displayType != null)
		dtype = displayType;
	if(o){if(o.style)o=o.style;o.visibility='visible'; o.display=dtype;}
}

function hideElement(elementID, setDisplay)
{
	var o = MM_findObj(elementID);
	if(o){if(o.style)o=o.style;o.visibility='hidden'; o.display='none'}
}

function isBlank(inputValue)
{
	return(inputvalue == '' || inputvalue.replace(' ', '') == '');
}

function isNum(inputValue)
{
	var val = parseFloat(inputValue);
	if(isNaN(val))
		return false;
	else
		return true;
}

function isNumGTZero(inputValue)
{
	var val= parseFloat(inputValue);
	if(isNaN(val))
		return false;
	else
	{
		if(val > 0)
			return true;
		else
			return false;
	}
}

function isInt(inputValue)
{
	var val;
	val = parseInt(inputValue);
	if(!(val >= 0) || (val == 0 && (inputValue).substring(0,1) != "0"))
	{
		if(val == 0 && (inputValue).substring(0,1) == "0")
			return true;
		else
			return false;
	}
	else
		return true;
}

function isIntGTZero(inputValue)
{
	var val= parseInt(inputValue);
	if(!(val > 0))
		return false;
	else
		return true;
}

function isElementSelected(element)
{
	var s = new String();
	s = element.options[element.selectedIndex].value;
	if(element.selectedIndex == -1 || s == null || s.length == 0)
		return false;
	else
		return true;
}

function CInteger(inputVal)
{
	var val = parseInt(inputVal);
	if(isNaN(val))
		val = 0;
	return val;
}

function CNumber(inputVal)
{
	var val = parseFloat(inputVal);
	if(isNaN(val))
		return 0;
	else
		return val;
}

function CString(inputVal)
{
	return inputVal.toString();
}

function convertValue(inputVal, toType)
{
	if (!toType)
		toType = "";
	switch(toType.toLowerCase())
	{
		case "number":
		case "float":
		case "decimal":
			return CNumber(inputVal);
			break;
		case "int":
		case "integer":
			return CInteger(inputVal);
			break;
		case "string":
		case "str":
		default:
			return CString(inputVal)
			break;
	}
}

function saveProduct(pid, type)

{
	var productAddURL = "include/i_shopping_add2cart.asp";
	var productUpdateURL = "include/i_shopping_changeqty2.asp";

	var o = MM_findObj("qty"+pid);

	if(!o||o==null)

	{

		alert('Something went wrong getting the product qty.'); 

		return false;

	}

	qty = o.value.replace(/ /g, "");

	var tmpUrl = "";

	if(type=="add")

	{

		tmpUrl = productAddURL + "?pid=" + pid + "&qty=" + qty;

	}

	else

	{

		tmpUrl = productUpdateURL + "?pid=" + pid + "&qty=" + qty;

	}


	document.location = tmpUrl;

/*
	new Ajax.Request(tmpUrl, {

		method: 'get',

		onSuccess: function(transport) {

		    var rt = transport.responseText;

		    var iPos = rt.indexOf("<");

		    if(iPos > 0)

		    {

		        rt = rt.substring(0, iPos);

		    }

			var arr = rt.split(",");

			if(arr.length >= 3 && arr[0].replace(/ /g, "")=="1")

			{

				var spid = arr[1].replace(/ /g, "");

				var sqty = arr[2].replace(/ /g, "");

				var el = "";

				if(sqty != "" && sqty != "0")

				{

					el = "productUpdate" + spid;

				}

				else

				{

					el = "productAdd" + spid;

				}

				MM_findObj("qty"+spid).value = sqty;

				hideElement("productProgress"+spid, true);

				showElement(el, true);

				lastElement = "";

			}

			else

			{

				alert('Error with add/removing the item to the cart.');

				hideElement("productProgress"+spid, true);

				if (lastElement != "") {showElement(lastElement, true); lastElement = "";}

			}

		},

		onFailure: function(){ 

			alert('Something went wrong with add/removing the item to the cart.'); 

			hideElement("productProgress"+spid, true);

			if (lastElement != "") {showElement(lastElement, true); lastElement = "";}

		},

		onComplete: function() {

			ajaxRequestCount--;

			lastElement = "";

		}

	});

	

	return true;

*/

}

function showProductList(catID){
    var url = './shopping_product_list.asp?pcid=' + catID;
    //alert('url = ' + url);
    document.location = url;
}

//-->
