function selectedfinish(selectedid){
	lowerselectedid = selectedid
	
	//document.getElementById("finishselect").selectedIndex = selectedid
	
	manufacturer = document.getElementById("prodmanufacturer").value.replace(/ /g,'')
	swatchid = thisarray[selectedid].prodfinish
	//alert(swatchid)
	salepriceid = thisarray[selectedid].prodsaleprice
	prodid = thisarray[selectedid].prodid
	
	listpriceid = thisarray[selectedid].prodprice

	prodnameid = thisarray[selectedid].prodname
	
	prodfinishid = thisarray[selectedid].prodfinish

	prodseriesid = thisarray[selectedid].prodseries
	
	prodavailid = thisarray[selectedid].prodavail

	prodshortdescripid = thisarray[selectedid].prodshortdescription

	prodimageidlarge = thisarray[selectedid].prodimagelargepath

	prodimageidsmall = thisarray[selectedid].prodimagesmallpath
	
	prodstatus = thisarray[selectedid].prodstatus
	
	prodidlarge = thisarray[selectedid].prodidlarge
	
	prodshippingpromo = thisarray[selectedid].prodshippingpromo
	shiptype = thisarray[selectedid].shiptype

	if (manufacturer=="PricePfister" && prodfinishid == "Oil Rubbed Bronze"){
		document.getElementById("ppDiscontinued").style.display="block"
	}else{
		document.getElementById("ppDiscontinued").style.display="none"
	}
		//alert("relatedProducts" + prodid.toLowerCase())
	if(document.getElementById("relatedProducts" + prodid.toLowerCase())){
		for(x in thisarray){
			document.getElementById("relatedProducts" + thisarray[x].prodid.toLowerCase()).style.display = "none"
		}
		document.getElementById("relatedProducts" + prodid.toLowerCase()).style.display = "block"
	}
	if(document.getElementById("accessoryProducts" + prodid.toLowerCase())){
		for(x in thisarray){
			document.getElementById("accessoryProducts" + thisarray[x].prodid.toLowerCase()).style.display = "none"
		}
		document.getElementById("accessoryProducts" + prodid.toLowerCase()).style.display = "block"
	}
	
	swatchname = thisarray[selectedid].prodfinish + 'swatchsmall.jpg'
	swatchname = swatchname.replace('/','')
	//alert(swatchname)
	document.getElementById("swatch").innerHTML = '<a href="javascript:displaytooltip();" ><img alt="Click Here To View All Finishes" width="33" height="33" style="border:none;" src="/images/' + manufacturer.replace(/-/g,'') + '/swatches/' + swatchname + '"></a>'
	document.getElementById("productsale").innerHTML = formatCurrency(salepriceid)
	document.getElementById("listprice").innerHTML = formatCurrency(listpriceid)
	yousaveprice1 = parseFloat(listpriceid) - parseFloat(salepriceid)
	document.getElementById("yousaveprice").innerHTML = '(-' + formatCurrency(yousaveprice1) + ')'
	document.getElementById("prodname").innerHTML = prodnameid
	if (document.getElementById("prodmodel")) {
		document.getElementById("prodmodel").innerHTML = '<b>Model #:</b> ' + prodidlarge
		}
	document.getElementById("prodfinish").innerHTML = '<b>Finish:</b> ' + prodfinishid
	document.getElementById("PRODUCT_ID").value = prodid
	document.getElementById("prodcrumb").innerHTML = '<font class="boxtextbold">' + prodidlarge + '</font>'
	document.getElementById("tabprodname").innerHTML = '<h1>' + prodnameid + ' ' + prodshortdescripid + '</h1>'
	
	if(document.getElementById("prodimage")){
		
		
		currentpath = prodimageidsmall
		currentpath = currentpath.toLowerCase()
		currentpath = currentpath.replace(/-/g,'')
		currentpath = currentpath.replace(/\./g,'')
	
		if(currentpath.indexOf(prodid.replace(/ /g,'').replace(/\//g,'').replace(/-/g,'').replace(/\./g,'')) > 0){
		document.getElementById("noimageavail").style.display = "none"
			if(document.getElementById("zoomhref")){
				document.getElementById("zoomhref").href = "javascript:myopen('" + prodimageidlarge + "','windowName','toolbar=no,location=no,left=0,top=0,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=525,height=550')"
			}
		}
		else{
	
			document.getElementById("noimageavail").style.display = "block"
			if(document.getElementById("zoomhref")){
				document.getElementById("zoomhref").href = "javascript:myopen('" + prodimageidlarge + "','windowName','toolbar=no,location=no,left=0,top=0,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=525,height=550')"
			}
		}
		document.getElementById("prodimage").src = prodimageidsmall
		document.getElementById("prodimage").alt = prodnameid
	}
	if(document.getElementById("prodimagesmall")){
		
		if(prodimageidsmall.toLowerCase().replace(/-/g,'').indexOf(prodid.replace(/ /g,'').replace(/\//g,'').replace(/-/g,'')) > 0){
			document.getElementById("noimageavail").style.display = "none"
			if(document.getElementById("zoomhref")){
				document.getElementById("zoomhref").href = "javascript:myopen('" + prodimageidlarge + "','windowName','toolbar=no,location=no,left=0,top=0,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=525,height=550')"
			}
		}
		else{
			document.getElementById("noimageavail").style.display = "block"
			if(document.getElementById("zoomhref")){
				document.getElementById("zoomhref").href = "javascript:myopen('" + prodimageidlarge + "','windowName','toolbar=no,location=no,left=0,top=0,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=525,height=550')"
			}
		}
		document.getElementById("prodimagesmall").src = prodimageidsmall
		document.getElementById("prodimagesmall").alt = prodnameid
		
	}
	//|| manufacturer == 'Satinjet'|| manufacturer == 'Cifial' THESE REMOVED BECAUSE WE HAVE A FEED NOW
	if(manufacturer == 'Aquadis' || manufacturer == 'Banner' || manufacturer == 'PremierFaucets' || manufacturer == 'Native Trails' || manufacturer == 'Marvel' || manufacturer == 'Fusion' || manufacturer == 'Houzer' || manufacturer == 'CaliforniaFaucets' || manufacturer == 'Fluid' || manufacturer == 'Kaldewei' || manufacturer == 'AvenelleCourt' || manufacturer == 'AmbaTowelWarmers' || manufacturer == 'BristolandBath' || manufacturer == 'Fluid' || manufacturer == 'Cheviot' || manufacturer == 'delafrontera' || manufacturer == 'Cucina' || manufacturer == 'Dreamline' || manufacturer == 'Dynasty' || manufacturer == 'DynastyHardware' || manufacturer == 'EdenBath' || manufacturer == 'ElementsofDesign' || manufacturer == 'Fontaine' || manufacturer == 'Graff' || manufacturer == 'Hamat' || manufacturer == 'Suneli' || manufacturer == 'NativeTrails' || manufacturer == 'Premier Faucets' || manufacturer == 'Ronbow' || manufacturer == 'Smedbo' || manufacturer == 'TyFobare' || manufacturer == 'Warmrails' || manufacturer == 'WasteKing' || manufacturer == 'WestBrass' || manufacturer == 'Whitehaus' || manufacturer == 'Cole&Co'){
		availvar = '<font color="red"><b>'+ prodstatus + '</b></font>'
		if(prodstatus == 'In Stock'){ 
			availvar = availvar + '<br/><b><span style="font-size:12px"><font color="green">Usually Ships Within 24-48 Hours</font></span></b>'
		}
		availvar2 = '<font color="red"><b>'+ prodstatus + '</b></font>'
	}
	else if(manufacturer == 'Riobel' || manufacturer == 'CorStone' || manufacturer == 'Jason' || manufacturer == 'Jacuzzi' || manufacturer == 'delaFrontera' || manufacturer == 'Duravit' || manufacturer == 'Alno'){
		availvar = '<font color="red"><b>'+ prodstatus + '</b></font>'
		if(prodstatus == 'In Stock'){ 
			availvar = availvar + '<br/><b><span style="font-size:12px"><font color="green">Usually Ships Within 3-5 Business Days</font></span></b>'
		}
		availvar2 = '<font color="red"><b>'+ prodstatus + '</b></font>'
	}
	else if(manufacturer == 'AlliedBrass' ){
		availvar = '<font color="red"><b>'+ prodstatus + '</b></font>'
		if(prodstatus == 'In Stock'){ 
			availvar = availvar + '<br/><b><span style="font-size:12px"><font color="green">Usually Ships Within 3-10 Business Days</font></span></b>'
		}
		availvar2 = '<font color="red"><b>'+ prodstatus + '</b></font>'
	}
	else if(manufacturer == 'Barclay' || manufacturer == 'HydroSystems' || manufacturer == 'Cascade'){
		availvar = '<font color="red"><b>'+ prodstatus + '</b></font>'
		if(prodstatus == 'In Stock'){ 
			availvar = availvar + '<br/><b><span style="font-size:12px"><font color="green">Usually Ships Within 1-2 Weeks</font></span></b>'
		}
		availvar2 = '<font color="red"><b>'+ prodstatus + '</b></font>'
	}
	else if(manufacturer == 'EdenBath'){
		availvar = '<font color="red"><b>'+ prodstatus + '</b></font>'
		if(prodstatus == 'In Stock'){ 
			availvar = availvar + '<br/><b><span style="font-size:12px"><font color="green">Usually Ships Within 3-4 Weeks</font></span></b>'
		}
		availvar2 = '<font color="red"><b>'+ prodstatus + '</b></font>'
	}

	else if(manufacturer == 'AquaBrass'){
	    availvar = '<font color="red"><b>'+ prodstatus + '</b></font>'
		if(prodstatus == 'In Stock'){ 
			availvar = availvar + '<br/><b><span style="font-size:12px"><font color="green">Usually Ships Within 3-7 Business Days</font></span></b>'
		}
		availvar2 = '<font color="red"><b>'+ prodstatus + '</b></font>'
	}	else if(prodavailid > 10){
		availvar = '<font color="red"><b>' + prodavailid + ' In-Stock<br><span style="font-size:12px"><font color="green">'
		if (manufacturer == 'Kraus'){
			availvar = availvar + 'Usually Ships Within 24-48 Hours.'
		}
		else if (manufacturer == 'Hansgrohe'){
			availvar = availvar + 'Usually Ships Within 3-7 Business Days.'
		}
		else{
			availvar = availvar + 'Ships the same business day when order is placed before 3:00 p.m.*(CST)</font></span></b></font>'
		}
		availvar2 = '<font color="red"><b>' + prodavailid + ' In-Stock</b></font>'
	}
	else if(prodavailid > 5){
		availvar = '<font color="red"><b>' + prodavailid + ' In-Stock<br><span style="font-size:12px"><font color="green">'
		if (manufacturer == 'Kraus'){
			availvar = availvar + 'Usually Ships Within 24-48 Hours.'
		}
		else if (manufacturer == 'Hansgrohe'){
			availvar = availvar + 'Usually Ships Within 3-7 Business Days.'
		}
		else{
		availvar = '<font color="red"><b>' + prodavailid + ' In-Stock. Quantities Limited. Purchase Now!<br><span style="font-size:12px"><font color="green">Ships the same business day when order is placed before 3:00 p.m.(CST)</font></span></b></font>'
		}
		availvar2 = '<font color="red"><b>' + prodavailid + ' In-Stock. Quantities Limited. Purchase Now!</b></font>'
	}
	else if(prodavailid > 0){
		availvar = '<font color="red"><b>' + prodavailid + ' In-Stock<br><span style="font-size:12px"><font color="green">'
		if (manufacturer == 'Kraus'){
			availvar = availvar + 'Usually Ships Within 24-48 Hours.'
		}
		else if (manufacturer == 'Hansgrohe'){
			availvar = availvar + 'Usually Ships Within 3-7 Business Days.'
		}
		else{
		availvar = '<font color="red"><b>' + prodavailid + ' In-Stock. Call To Confirm Availability<br><span style="font-size:12px"><font color="green">Ships the same business day when order is placed before 3:00 p.m.(CST)</font></span></b></font>'
		}
		availvar2 = '<font color="red"><b>' + prodavailid + ' In-Stock. Call To Confirm Availability</b></font>'
	}
	else{
		availvar = '<font color="red"><a class="linkbluebold2" href="javascript:myopen(\'/includes/availability.asp?id=' + prodnameid + '\',\'windowName\',\'toolbar=no,location=no,left=0,top=0,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=600,height=520\')">Check Availability</a><br><span style="font-size:12px"><font color="green"><b>Usually Ships Within 3-7 Business Days.</b></font></span></b></font>'
		availvar2 = '<font color="red"><a class="linkbluebold2" href="javascript:myopen(\'/includes/availability.asp?id=' + prodnameid + '\',\'windowName\',\'toolbar=no,location=no,left=0,top=0,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=600,height=520\')">Check Availability</a><br><span style="font-size:12px"><font color="green"><b>Usually Ships Within 3-7 Business Days.</b></font></span></b></font>'
	}
	
	document.getElementById("prodavailability").innerHTML = '<b>Availability:</b>&nbsp;' + availvar
	document.getElementById("tabavail").innerHTML = availvar2
	
	document.title = document.getElementById("prodmanufacturer").value + ' ' + prodidlarge + ' ' + prodseriesid + ' ' + prodshortdescripid
	document.getElementById("finishselect").selectedIndex = selectedid
	if((shiptype < 3 && salepriceid > 99) || (shiptype == 14 && salepriceid > 99) || prodshippingpromo == 1){
		document.getElementById("shippingspan2").innerHTML = '<img border="0" src="navimages/freeshipping_item300.gif" width="300" height="76" alt="Remember, This item Ships for Free Today!"/><br><font color="FF0000">Remember, This Item Ships for Free Today!</font><br>'
		document.getElementById("shippingspan").innerHTML = '<A class="linkbluesm" href="javascript:myopen(\'/freeShipping.asp\',\'windowName\',\'toolbar=no,location=no,left=0,top=0,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=500,height=500\')"><img valign="middle" src="/navimages/freeshippingtruck2.gif" border="0" width="127" height="12" alt="Free Ground Shipping on this product!!"></a>'
	}
	else{
		document.getElementById("shippingspan2").innerHTML = ''
		document.getElementById("shippingspan").innerHTML = '<a class="linkbluebold2" href="javascript:myopen(\'/freeShipping.asp\',\'windowName\',\'toolbar=no,location=no,left=0,top=0,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=525,height=625\')">Free Shipping on orders over $99.00!*</a>'
	}
    if((shiptype == 0 && prodavailid > 5)){
		document.getElementById("shippingspan3").innerHTML = '<br><A class="linkbluesm" href="javascript:myopen(\'/nextdayairpromo.asp\',\'windowName\',\'toolbar=no,location=no,left=0,top=0,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=500,height=500\')"><img valign="middle" src="/navimages/nextdayairtruck.gif" border="0" width="240" height="47" alt="Get Next Day Air for only $6.99 on this Product!"></a>'
	}

}
//Else{
//	setTimeout(selectedfinish(selectedid),150)
	
//}	


function thisproduct(prodid,prodavail,prodprice,prodsaleprice,prodfinish,prodname,prodshortdescription,prodimagelargepath,prodimagesmallpath,prodseries,prodidlarge,shiptype,prodstatus,prodshippingpromo){
	this.prodid = prodid
	this.prodavail = prodavail
	this.prodprice = prodprice
	this.prodsaleprice = prodsaleprice
	this.prodfinish = prodfinish
	this.prodname = prodname
	this.prodshortdescription = prodshortdescription
	this.prodimagelargepath = prodimagelargepath
	this.prodimagesmallpath = prodimagesmallpath
	this.prodseries = prodseries
	this.prodidlarge = prodidlarge
	this.shiptype = shiptype
	this.prodstatus = prodstatus
	this.prodshippingpromo = prodshippingpromo	
	
}

