
	var itemsPerPage = 16;
	
	function hideAll(ev, except) {
		
		var x;
		var rollovers = new Array("j-r","j-b","j-o","buttons","prod","specimen","sold");
		
		for (x in rollovers) {
			document.getElementById(rollovers[x]).style.display="none";
		}
		if (except) {
			if (ev.clientY) {
				if (!document.documentElement.scrollTop)
					document.documentElement.scrollTop = 0;
				document.getElementById(except).style.top = (ev.clientY - 45 + document.documentElement.scrollTop) + "px";
			}
			document.getElementById(except).style.display="block";
		}
	}
	

 	function frameItIn(newurl, ht, sideurl) {

 		top.document.getElementById("maincontent").src = newurl;
 		top.document.getElementById("navdiv").style.height = ht + "px";
 		top.document.getElementById("maincontent").height = ht - 20 + "px";
 		top.document.getElementById("contentdiv").style.height = ht + "px";
 		top.document.getElementById("sidecontent").src = sideurl;
 		top.document.getElementById("sidecontent").height = ht + "px";
 	}
 	

	function popup(theurl) {
	
		window.open(theurl, "_blank","location=no,toolbar=no,menubar=no,width=850,height=600,status=yes,resizable=yes,scrollbars=yes");
	}
	
	function getQueryVariable(variable) {
	  var query = window.location.search.substring(1);
	  var vars = query.split("&");
	  for (var i=0;i<vars.length;i++) {
	    var pair = vars[i].split("=");
	    if (pair[0] == variable) {
	      return pair[1];
	    }
	  }
	  return "";
 	}
    
    function openMaterial(thepage) {
   
	    mySubWin=window.open('','newWin','status=yes,height=650,width=700,scrollbars=yes,status=yes,resizable=yes')
	    mySubWin.location.href=thepage;

  	}	
 
 /* ======== COOKIE FUNCTIONS ================================== */
 	
	function setCookie(c_name,value,expiredays) {
		var exdate=new Date();
		exdate.setDate(exdate.getDate()+expiredays);
		document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate+";path=/");
	}
	
	function getCookie(c_name) {
		if (document.cookie.length>0)
		  {
		  c_start=document.cookie.indexOf(c_name + "=")
		  if (c_start!=-1)
		    { 
		    c_start=c_start + c_name.length+1 
		    c_end=document.cookie.indexOf(";",c_start)
		    if (c_end==-1) c_end=document.cookie.length
		    return unescape(document.cookie.substring(c_start,c_end))
		    } 
		  }
		return "";
	}
	
	function reCookie(num) { //can this even be done???
		
		//num is being removed and the rest of the 'array' is moving back.
		
		var cook = getCookie("Item0");
		var n = 0;
		while (cook != "") {
			if (num <= n) {
				setCookie("Item"+n,getCookie("Item"+(n+1)),10)
			}
			n++;
			cook = getCookie("Item"+n);
		}
		setCookie("Item"+(n-1),"",-1); //erases the last one on the list which should have been copied to the earlier one?
		
		var total = getCookie("totalitems");
		if (total == "") {
			total = 1;
			setCookie("totalitems", total, 10)
		}
		else {
			total = Number(total) - 1;
			setCookie("totalitems", total, 10)
		}
		window.location.reload(true);
	}	
	
	function addCookie(num, item, price, image, idtag) {
		
		var total = getCookie("totalitems");
		if (total == "") {
			total = 1;
			setCookie("totalitems", total, 10)
		}
		else {
			total = Number(total) + 1;
			setCookie("totalitems", total, 10)
		}
			
		setCookie("Item"+(Number(total)-1),item+"|"+price+"|"+image,10);
		document.getElementById(idtag).innerHTML = "<span style='color:#999'>Item Added</span>";	
	}	
	
	function deleteAllCookies() {
		var total = getCookie("totalitems");
		for (var i = 0; i < total; i++) {
			setCookie("Item"+i,"",-1);
		}
		setCookie("totalitems","",-1);
	}
 
/* ======== END COOKIE FUNCTIONS ================================== */ 
 	


