
	var showHideMenu = new Array();
	var heightSpacer = 130; 
	var curImage;
	
	function togCatalog(catid,selected) {
		
		
		
		targ_cat 	= getEl('category['+catid+']');
		
		targ_arrow	= getEl('arrow['+catid+']');
		
		if(!showHideMenu[catid] || showHideMenu[catid] == 'off') { 
			
			if(selected) {
				imgsrc = 'images/menu_arrow_light_down.gif';
			}else {
				imgsrc = 'images/menu_arrow_down.gif';
			}
			
			
			targ_cat.className = 'show';
			
			
			
			
			showHideMenu[catid] = 'on';
			
		}else {
			
			if(selected) {
				imgsrc = 'images/menu_arrow_light.gif';
			}else {
				imgsrc = 'images/menu_arrow.gif';
			}
			
			targ_cat.className = 'hide';
			
			
			
			
			showHideMenu[catid] = 'off';
			
		}
		
	}
	
	
	function loadProd(id, img, price, desc, name, subprod_exists) {
		li = getEl('lrgimg');
		pn = getEl('prodName');
		pd = getEl('prod_dollar');
		pc = getEl('prod_cent');
		ep = getEl('existing_subprod');
		it = getEl('item');
		holdit = getEl('holditem');
		
		li.src = img;
		pn.innerText = name.toUpperCase();
		pd.innerText = '$' + parseInt(price);
		
		cent = ((parseFloat(price) - parseInt(price))*100);
		if(!cent) {
			cent = '00';
		}
		pc.innerText = '.' + cent;


		if(subprod_exists) {
			ep.value = 1;
			it.value = getEl('subproduct').value;
		}else {
			ep.value = 0;
			it.value = id;
		}
		holdit.value = id;
	}
	
	function checkCartFrm(frm) {
		spe = frm.existing_subprod.value; 
		if(spe == 1) {
			if(frm.subproduct.value < 1) {
				id = frm.item.value;
				animSubProd('open', 0, id);
				getEl('item').value = getEl('subproduct').value;
			}else {
				getEl('item').value = getEl('subproduct').value;
				return frm.submit();
			}
		}else {
			return frm.submit();
		}
		return false;
	}
	
	
	
	function viewImage(id,counter,w,h) {
		
		w = 500;
		h = h + heightSpacer;
		
		var container = getEl('preview_div');
		
		
		if(curImage != id) {
			
				container.className = 'floatdiv';
				container.style.width = w;
				container.style.height = h;
				
				defaultimageheight = h; 
				defaultimagewidth = w + 10;
				
			var inject = activeEmbed("flash/imageLoader.swf?imgid="+id,"imageViewer",0,0,false,false,false,'preview_div');

			curImage = id;
			
			
			
			document.onmousemove=followmouse; 
			
		}else {
			
			container.className = 'floatdiv';
			document.onmousemove=followmouse;
		}
	}
	
	
	function closeImage(runme) {
		hidetrail();
		var container = getEl('preview_div');
		container.className = 'hide';
	}
	

	
	function productDetails(prodid,page,storeid,h,maxh,way,step) {
	
	
		
		var type='product';
		
		if(!storeid) {
			storeid = 0;
		}else {
			type = 'dist_product';
		}
		
		if(prodid) {
			var myVars = new Array();
			
			myVars[0] = false;	
			myVars[1] = false;	
			myVars[2] = 0;		
			alert('loadXMLDoc');
			loadXMLDoc('getfile.php?info&type='+type+'&prod='+prodid+'&page='+page+'&storeid='+storeid,'preview_td',productDetails,myVars);
			return false;
		}else {

			var tbl = getEl('preview_tbl');
			var showdiv = getEl('preview_div');	
			
			if(!maxh) {			
				
				h1 = tbl.scrollHeight;		
				h2 = tbl.offsetHeight;
				if(h1 > h2) { 
					maxh = h1;
				}else {
					maxh = h2; 
				}
			}
			
			if(h == 0 || !way) {
				var getHeight = showdiv.style.height;
				if(typeof getHeight == 'string') {
					h = getHeight.substring(0,getHeight.length - 2);
				}else {
					h = 0;
				}
				step = 1;
				if(h > maxh) {
					way = 'min'; 
				}else {
					way = 'max'; 
				}
			}		
			if(way == 'max') {
				h+= step*10;
				
				if(h > maxh) {
					h = maxh;
				}else {
					self.setTimeout('productDetails(0,0,'+storeid+','+h+','+maxh+',\'max\','+ (step + 1) +')',5);
				}
			}else {
				h -= step*10;
				if(h < maxh) {
					h = maxh;
				}else {
					self.setTimeout('productDetails(0,0,'+storeid+','+h+','+maxh+',\'min\','+ (step + 1)+')',5);
				}
			}
			
			showdiv.style.height = h;
		}
	}
	
		

function hardSwap(location,id) {	
		imageTempOn = new Image();
		imageTempOn.src = location;
		document.images['' + id  + ''].src= imageTempOn.src;
	}
	
	
	var TempImg = '';	
	function easySwap(location,id) {	
		if(id != TempImg) {
			imageTempOn = new Image();
			imageTempOn.src = location;
			document.images['' + id  + ''].src= imageTempOn.src;
		}else {
			TempImg = id;
		}
	}
