


function showProductDiv(submenu) {
		obj = document.getElementsByTagName('div');
		for (i=0; i<obj.length; i++) {
			if (obj[i].id == submenu) 
			{
				if (obj[i].style.display == 'none')
				{
					obj[i].style.display = '';
				}
			
			}
			else if (obj[i].id != '')
			{
				if (obj[i].id.substring(0,7) == 'Product'){
					obj[i].style.display = 'none';
					}
			}
		}	
     
}

function SwapImage(ImgID,fname,Bigfname) {
		MM_swapImage(ImgID,'',fname,1);
		lnk=document.getElementById("bigpiclink");
		lnk.href = Bigfname
		lnk=document.getElementById("bigpiclink2");
		lnk.href = Bigfname		
}

var selected;
var loop_tracker = 1;
var loop_current = 1;
var run_slideshow = 1;
var banner_bm = 1;
var next_banner;

function RotateHPBanner(banner_pointer, this_loop) {
	
	/*if(!document.getElementById('Banner_Rotation_images_' + banner_pointer)) {
		run_slideshow = false;
		alert(banner_pointer + ' does not exist');
	} else {
		
	}*/
	
	if(run_slideshow == banner_bm && this_loop == loop_tracker) {
		
		if(!document.getElementById('Banner_Rotation_images_' + banner_pointer)) { 
			var tmp = 0;
			while(document.getElementById('Banner_Rotation_images_markers_' + tmp)) {
				tmp++;
			}
			banner_pointer = parseInt(tmp)-parseInt(1); 
			next_banner = 0;
		} else {		
			next_banner = banner_pointer + 1;
		}
		
		if(!document.getElementById('Banner_Rotation_images_' + next_banner)) { 
			next_banner = 0; 
		}
		
		var tmp = 0;
		while(document.getElementById('Banner_Rotation_images_markers_' + tmp)) {
			document.getElementById('Banner_Rotation_images_markers_' + tmp).className = '';
			if(tmp != next_banner) {
				Effect.Fade("Banner_Rotation_images_" + tmp, { duration:1});
			}
			tmp++;
		}
		
		if (document.getElementById('Banner_Rotation_images_markers_' + banner_pointer)) {
			document.getElementById('Banner_Rotation_images_markers_' + banner_pointer).className = '';
		}
		if (document.getElementById('Banner_Rotation_images_markers_' + next_banner)) {
			document.getElementById('Banner_Rotation_images_markers_' + next_banner).className = 'active';
		}
		if (document.getElementById('Banner_Rotation_images_' + banner_pointer)) {
			Effect.Fade("Banner_Rotation_images_" + banner_pointer, {
				duration: 1
			});
		}
		if (document.getElementById('Banner_Rotation_images_' + next_banner)) {
			Effect.Appear("Banner_Rotation_images_" + next_banner, {
				duration: 1
			});
		}
		
		if (document.getElementById('Banner_Rotation_images_' + next_banner)) {
			setTimeout("Effect.Appear('Banner_Rotation_images_" + next_banner + "', { duration:1});", 1000);
			setTimeout("RotateHPBanner(" + next_banner + ", " + this_loop + ")", 5000);
		}
		
		
		
	}
	
}function updateHomepageImage(banner_pointer) {
	loop_tracker++;
	if(run_slideshow == 0) {
		run_slideshow = banner_bm;
	}
	banner_pointer = parseInt(banner_pointer)-parseInt(1);
	if(banner_pointer < 0) {
		var tmp = 0;
		while(document.getElementById('Banner_Rotation_images_' + tmp)) {
			tmp++;
		}
		banner_pointer =  parseInt(tmp)+parseInt(1);
	}
	/*if(!document.getElementById('Banner_Rotation_images_' + banner_pointer)) {
		var tmp = 0;
		while(document.getElementById('Banner_Rotation_images_' + tmp)) {
			tmp++;
		}
		banner_pointer = tmp;
	}
	if(next_banner) {
		//alert('Fading ' + next_banner);
		Effect.Fade("Banner_Rotation_images_" + next_banner, { duration:1});
	}
	Effect.Appear("Banner_Rotation_images_" + banner_pointer, { duration:1});*/
	//alert('Passing ' + banner_pointer);
	RotateHPBanner(banner_pointer, loop_tracker);
}function pauseHomepageSlideshow() {
	if(run_slideshow == banner_bm) {
		run_slideshow = 0;
		document.getElementById('Banner_Rotation_control').className = 'Banner_Rotation_control_play';
	} else {
		banner_bm++;
		document.getElementById('Banner_Rotation_control').className = 'Banner_Rotation_control_pause';
		run_slideshow = banner_bm;
	}
	document.getElementById('Banner_Rotation_control').blur();
	RotateHPBanner(next_banner, loop_current);
}


function CheckStock(Multi,MultiType) {

	if (Multi=='True') {
	
		Done = false;
		
		if (MultiType=='DropMenu') {
			BQty = parseInt(document.form1.Qty.value);
			AQty = parseInt(eval('document.form1.Stock_'+document.form1.ID.selectedIndex+'.value'));
			
			if (BQty > AQty) {
				alert("Sorry we only have "+AQty+" of this item in stock");
				document.form1.Qty.value = AQty;
			}
			Done = true;			
								
		}
		
		if (MultiType=='Radio') {
			BQty = parseInt(document.form1.Qty.value);
			AQty = parseInt(eval('document.form1.Stock_'+getCheckedRadio(document.form1.ID)+'.value'));
			
			if (BQty > AQty) {
				alert("Sorry we only have "+AQty+" of this item in stock");
				document.form1.Qty.value = AQty;
			}
			Done = true;
								
		}
		
		
		if (Done == false) {
			BQty = parseInt(eval('document.'+MultiType+'.Qty.value'));
			AQty = parseInt(eval('document.'+MultiType+'.Stock.value'));
			
			if (BQty > AQty) {
					alert("Sorry we only have "+AQty+" of this item in stock");
					eval('document.'+MultiType+'.Qty.value = '+AQty)
			}
			Done = true;
			
		}		
		
		
	
	} else {
	
		BQty = parseInt(eval('document.'+MultiType+'.Qty.value'));
		AQty = parseInt(eval('document.'+MultiType+'.Stock.value'));
		
		if (BQty > AQty) {
				alert("Sorry we only have "+AQty+" of this item in stock");
				eval('document.'+MultiType+'.Qty.value = '+AQty)
				Done = true;
		}
		
	
	}

}

function getCheckedRadio(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return 0;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return i;
		}
	}
	return 0;
}