function openPic(pic) {
	window.open("../imaged41d.html?"+pic, "", "resizable=1,HEIGHT=100,WIDTH=350");
}

function addtocart(id,qty,sku,name,price,options,secpath) {
	if (isNumeric(qty) == false || qty == 0) {
		alert ("Quantity is invalid");
		return false;
	}
	
	var loc = window.location.pathname
	window.location = secpath + "cart_add.aspx?id=" + id + "&q=" + qty + "&s=" + sku + "&n=" + urlEncode(name) + "&p=" + price + "&o=" + urlEncode(options) + "&l=" + urlEncode(loc)
	return false;
}

function updatecart(type,qty,id) {
	var con
	
	if (type=='delete') {
		con = confirm('Are you sure you want to delete this item?');
	}
	
	if (con==false) {
		return false;
	} else {
		window.location = "cart_update.aspx?type=" + type + "&id=" + id + "&q=" + qty
		return false;
	}
}

function isNumeric(sText) {
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;
   
   for (i = 0; i < sText.length && IsNumber == true; i++) 
	  { 
	  Char = sText.charAt(i); 
	  if (ValidChars.indexOf(Char) == -1) 
		 {
		 IsNumber = false;
		 }
	  }
   return IsNumber;   
}

function urlEncode(text) {
	if(text!=null){
		text=text.replace(/ /g,"+");
		text=text.replace(/:/g,"%3A");
		text=text.replace(/\//g,"%2F");
		text=text.replace(/\?/g,"%3F");
		text=text.replace(/=/g,"%3D");
		text=text.replace(/&/g,"%26");
		text=text.replace(/;/g,"%3B");
		text=text.replace(/,/g,"%2C");
		text=text.replace(/'/g,"%27");
		text=text.replace(/\n/g,"+");
	}
	return text;
}