/* **********************************************
* Drop Down/ Overlapping Content- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
********************************************** */
/* Please do not re-distrubute this modified script. Please visit the above URL for original code. */
function getposOffset(overlay, offsettype){
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
} return totaloffset; }
function overlay(curobj, subobjstr, opt_position){ 
if (document.getElementById){
var subobj=document.getElementById(subobjstr)
subobj.style.display=(subobj.style.display!="block")? "block" : "none"
var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0)
var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
xpos=xpos-7; /* This line was added to nudge box to the right a little more */
subobj.style.left=xpos+"px"
subobj.style.top=ypos+"px"
return false } else return true }
function overlayclose(subobj){ document.getElementById(subobj).style.display="none" }


/*  
This function was customized for manufacturer specific info. iFrame innerHTML also added. 
Please do not re-distrubute this modified script.
For original Drop Down/ Overlapping Content code, please go to www.dynamicdrive.com. 
*/
previousObj="";
prevColor="#FFFFFF";
function mfg(curobj,idpartno,mfgtable,opt_position){  // offsettype is optional
	if (document.getElementById){
		// Customization to allow currently selected box to highlight. Turn previous one off.
		if(previousObj!="") previousObj.style.backgroundColor=prevColor;
		prevColor=curobj.style.backgroundColor;
		curobj.style.backgroundColor="#FFFFCC";
		previousObj=curobj;
		var subobj=document.getElementById('mfgcartbox')
		//subobj.style.display=(subobj.style.display!="block")? "block" : "none";
		if(subobj.style.display!="block") {
			subobj.style.display="block";
		} // don't use "none", which would toggle off and on. If user clicks another one choice, just open it - don't toggle.
		//var xpos=getposOffset(curobj, "left")-3;
		var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0)

		var ypos=getposOffset(curobj, "top")+curobj.offsetHeight-2;
		subobj.style.left=xpos+"px"
		subobj.style.top=ypos+"px"
		var content="<iframe name=ifr id=ifr src=\"/additem.php?m="+mfgtable+"&id="+idpartno+"\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" width=\"280\" height=\"150\" scrolling=\"auto\">Unable to display product information. Please contact us for assistance.</iframe>";
		document.getElementById('mfgcarthtml').innerHTML=content;
		return false
	} else
	return true
}
function mfgqty(curobj,idpartno,mfgtable,itemsRefID){  // copy of mfg above, modified for Qty.
	if (document.getElementById){
		// Customization to allow currently selected box to highlight. Turn previous one off.
		if(previousObj!="") previousObj.style.backgroundColor=prevColor;
		prevColor=curobj.style.backgroundColor;
		curobj.style.backgroundColor;
		curobj.style.backgroundColor="#FFFFCC";
		previousObj=curobj;
		var subobj=document.getElementById('qtyupdate')
		if(subobj.style.display!="block") {
			subobj.style.display="block";
		}
		var xpos=getposOffset(curobj, "left")-10;
		var ypos=getposOffset(curobj, "top")+curobj.offsetHeight-5;
		subobj.style.left=xpos+"px"
		subobj.style.top=ypos+"px"
		var content="<iframe name=ifr id=ifr src=\"/updateqty.php?m="+mfgtable+"&id="+idpartno+"&itemsrefid="+itemsRefID+"\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" width=\"150\" height=\"100\" scrolling=\"auto\">Unable to display product information. Please contact us for assistance.</iframe>";
		document.getElementById('mfgqtyhtml').innerHTML=content;
		return false
	} else
	return true
}
function shippingbox(curobj){  // copy of mfg above, modified for shipping.
	if (document.getElementById){
		var subobj=document.getElementById('shippingbox')
		subobj.style.display=(subobj.style.display!="block")? "block" : "none"; // allow toggle
		var xpos=getposOffset(curobj, "left")-(subobj.offsetWidth-curobj.offsetWidth); // align RIGHT.
		var ypos=getposOffset(curobj, "top")+curobj.offsetHeight-5;
		subobj.style.left=xpos+"px"
		subobj.style.top=ypos+"px"
		var content="<iframe name=ifr id=ifr src=\"/shipping.php?fr=true\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" width=\"280\" height=\"190\" scrolling=\"auto\">Unable to display product information. Please contact us for assistance.</iframe>";
		document.getElementById('shippinghtml').innerHTML=content;
		return false
	} else
	return true
}
function mfgclose(subobj){  // also used to close mfgqty box and shipping box.
	if(previousObj!="") previousObj.style.backgroundColor=prevColor;
	previousObj="";
	document.getElementById(subobj).style.display="none" 
}
