function updateQuantity(baskline) {
	document.forms['frmProductUpdate'+baskline].elements['Action'].value = 'QNTY';
	document.forms['frmProductUpdate'+baskline].submit();
}

function removeProduct(baskline) {
	document.forms['frmProductUpdate'+baskline].elements['Action'].value = 'RPRD';
	document.forms['frmProductUpdate'+baskline].submit();
}

function switchimage(newimage) {
	document.getElementById('prodmainimage').src = newimage;
}

function showTab(theTab) {
	if (theTab != 'desc') {
		document.getElementById('desc').style.display = 'none';
		document.getElementById('prodtabdesc').src = 'images/tab_desc_off.jpg';
	}
	if (theTab != 'reviews') {
		document.getElementById('reviews').style.display = 'none';
		document.getElementById('prodtabreviews').src = 'images/tab_reviews_off.jpg';
	}
	if (theTab != 'shipping') {
		document.getElementById('shipping').style.display = 'none';
		document.getElementById('prodtabshipping').src = 'images/tab_shipping_off.jpg';
	}
	if (theTab != 'specifications') {
		document.getElementById('specifications').style.display = 'none';
		document.getElementById('prodtabspecifications').src = 'images/tab_specifications_off.jpg';
	}
	document.getElementById(theTab).style.display = 'block';
	document.getElementById('prodtab'+theTab).src = 'images/tab_' + theTab + '.jpg';
}


function hideshowOpen(which) { 
	which.style.display = "block"; 
} 
 

function hideshowClose(which) { 
	which.style.display = "none"; 
} 

function hideshowCloseInline(which) {  
	which.style.display = "none";  
} 


// sets the PROD screen form up to allow the product to be added to the registry
function addToGiftList() { 
	document.forms['PRODProducts'].elements['registry'].value=1;
	document.forms['PRODProducts'].elements['action'].value='ADPR';
	document.forms['PRODProducts'].submit();
}

function applyFilter(dropdown) {
	if (dropdown.value) {
		location.href=dropdown.value;
	}
}

function checkQOform(theform) {
	if (document.getElementById('txtQOProd')) {
		if (document.getElementById('txtQOProd').value == 'enter item #' || document.getElementById('txtQOProd').value == '') {
			alert("Please enter an item number in the Quick Order form before clicking the Add to Cart button.");
			return false;
		}
	}
	return true;
}

//Popup Window Script
//By JavaScript Kit (http://javascriptkit.com)
//JavaScript tutorials and over 400+ free scripts
function openpopup(){
	var popurl="http://www.pennstateind.com/track_cust.php";
	winpops=window.open(popurl,"","width=650,height=400,scrollbars,resizable,");
}

//shows and hides the faceting divs on the search results pages
function showhide(div_name) {
	if (document.getElementById(div_name + "_link").innerHTML == "more")	{
		document.getElementById(div_name + "_div").style.display = "block";
		document.getElementById(div_name + "_link").innerHTML = "hide";
	}
	else {
		document.getElementById(div_name + "_div").style.display = "none";
		document.getElementById(div_name + "_link").innerHTML = "more";
	}
}

function doSlideShow() {
	//Presentational Slideshow Script- By Dynamic Drive
	//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
	//This credit MUST stay intact for legal use

	var slideshow_width='395px' //SET SLIDESHOW WIDTH (set to largest image's width if multiple dimensions exist)
	var slideshow_height='310px' //SET SLIDESHOW HEIGHT (set to largest image's height if multiple dimensions exist)
	var pause=3000 //SET PAUSE BETWEEN SLIDE (2000=2 seconds)
	var slidebgcolor="white"

	var dropimages=new Array()
	//SET IMAGE PATHS. Extend or contract array as needed
	dropimages[0]="/graphics/home/homepage1a.jpg"
	dropimages[1]="/graphics/home/homepage1b.jpg"
	dropimages[2]="/graphics/home/homepage1c.jpg"
	dropimages[3]="/graphics/home/homepage1d.jpg"

	var droplinks=new Array()
	//SET IMAGE URLs. Use "" if you wish particular image to NOT be linked:
	droplinks[0]="http://dev.pennstateind.com/store/CSC3000CTN.html"
	droplinks[1]="http://dev.pennstateind.com/getting-started"
	droplinks[2]="http://dev.pennstateind.com/store/dust-collection.html"
	droplinks[3]="http://dev.pennstateind.com/store/majestic-pen-kits.html"

	////NO need to edit beyond here/////////////

	var preloadedimages=new Array()
	for (p=0;p<dropimages.length;p++){
	preloadedimages[p]=new Image()
	preloadedimages[p].src=dropimages[p]
	}

	var ie4=document.all
	var dom=document.getElementById

	if (ie4||dom)
	document.write('<div style="position:relative;width:'+slideshow_width+';height:'+slideshow_height+';overflow:hidden" class="home_395_320"><div id="canvas0" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';background-color:'+slidebgcolor+';left:-'+slideshow_width+'"></div><div id="canvas1" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';background-color:'+slidebgcolor+';left:-'+slideshow_width+'"></div></div>')
	else
	document.write('<a href="javascript:rotatelink()"><img name="defaultslide" src="'+dropimages[0]+'" border="0" class="home_395_320"></a>')

	var curpos=parseInt(slideshow_width)*(-1)
	var degree=40
	var curcanvas="canvas0"
	var curimageindex=linkindex=0
	var nextimageindex=1

	if (ie4||dom)
	window.onload=startit
	else
	setInterval("rotateimage()",pause)
}

function movepic(){
	var ie4=document.all
	var dom=document.getElementById

	if (curpos<0){
	curpos=Math.min(curpos+degree,0)
	tempobj.style.left=curpos+"px"
	}
	else{

	clearInterval(dropslide)
	nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
	tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
	var slideimage='<img src="'+dropimages[curimageindex]+'" border=0>'
	tempobj.innerHTML=(droplinks[curimageindex]!="")? '<a href="'+droplinks[curimageindex]+'">'+slideimage+'</a>' : slideimage
	nextimageindex=(nextimageindex<dropimages.length-1)? nextimageindex+1 : 0
	setTimeout("rotateimage()",pause)
	}
}

function rotateimage(){
	var ie4=document.all
	var dom=document.getElementById

	if (ie4||dom){
	resetit(curcanvas)
	var crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
	crossobj.style.zIndex++
	var temp='setInterval("movepic()",50)'
	dropslide=eval(temp)
	curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
	}
	else
	document.images.defaultslide.src=dropimages[curimageindex]
	linkindex=curimageindex
	curimageindex=(curimageindex<dropimages.length-1)? curimageindex+1 : 0
}

function rotatelink(){
	var ie4=document.all
	var dom=document.getElementById

	if (droplinks[linkindex]!="")
	window.location=droplinks[linkindex]
}

function resetit(what){
	var ie4=document.all
	var dom=document.getElementById

	curpos=parseInt(slideshow_width)*(-1)
	var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
	crossobj.style.left=curpos+"px"
}

function startit(){
	var ie4=document.all
	var dom=document.getElementById

	var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
	crossobj.innerHTML='<a href="'+droplinks[curimageindex]+'"><img src="'+dropimages[curimageindex]+'" border=0></a>'
	rotateimage()
}

var opaySubmitted = false;
function submitOnce(theform) {
	if (opaySubmitted) { 
		return false;
	}
	opaySubmitted = true;
	document.getElementById('btnContinueImage').src='/graphics/submit-order-btn-off.jpg';
	return true;
}