function frmsubmit(func) {
	frm = document.entryform;
	frm.func.value = func;
	frm.submit();
}

/////////////////////////////////////////////////////////////////////////

var ie4 = (document.all) ? true : false;
var ns4 = (document.layers) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;
function hidelayer(lay) {
if (ie4) {document.all[lay].style.visibility = "hidden";}
if (ns4) {document.layers[lay].visibility = "hide";}
if (ns6) {document.getElementById([lay]).style.display = "none";}
}
function showlayer(lay) {
if (ie4) {document.all[lay].style.visibility = "visible";}
if (ns4) {document.layers[lay].visibility = "show";}
if (ns6) {document.getElementById([lay]).style.display = "block";}	
}

function writetolayer(lay,txt) {
if (ie4) {
document.all[lay].innerHTML = txt;
}
if (ns4) {
document[lay].document.write(txt);
document[lay].document.close();
}
if (ns6) {
over = document.getElementById([lay]);
range = document.createRange();
range.setStartBefore(over);
domfrag = range.createContextualFragment(txt);
while (over.hasChildNodes()) {
over.removeChild(over.lastChild);
}
over.appendChild(domfrag);
   }
}

/////////////////////////////////////////////////////////////////////////

function set(c)
{
	for (i=1;i<=9;i++)
	{
		if(i==c)
		{
			identity=document.getElementById(i);
			identity.className='image2';
		}
		else
		{
			identity=document.getElementById(i);
			identity.className='image';
		}
	}
}

/////////////////////////////////////////////////////////////////////////

function setclass(c)
{
identity=document.getElementById(c);
identity.className='bg2';
}

/////////////////////////////////////////////////////////////////////////

function unsetclass(c)
{
identity=document.getElementById(c);
identity.className='bg1';
}

/////////////////////////////////////////////////////////////////////////

function setcatclass(c)
{
identity=document.getElementById(c);
identity.className='cat2';
}

/////////////////////////////////////////////////////////////////////////

function unsetcatclass(c)
{
identity=document.getElementById(c);
identity.className='cat1';
}

/////////////////////////////////////////////////////////////////////////

function setmenuclass(c)
{
	identity=document.getElementById(c);
	identity.className='bg2';
}

/////////////////////////////////////////////////////////////////////////

function unsetmenuclass(c)
{
	identity=document.getElementById(c);
	identity.className='bg1';
}

/////////////////////////////////////////////////////////////////////////

function hover(c)
{
identity=document.getElementById(c);
if (identity.className=='bg2')
{}
else
identity.className='bg1';
}

/////////////////////////////////////////////////////////////////////////

function out(a)
{
identity=document.getElementById(a);
if (identity.className=='bg2')
{}
else
identity.className='bg';
}

/////////////////////////////////////////////////////////////////////////

function selected(a)
{
var x = document.getElementsByTagName('tr');
for (var i=0;i<x.length;i++)
{
	x[i].className = 'bg';
}
identity=document.getElementById(a);
identity.className='bg2';
}

/////////////////////////////////////////////////////////////////////////

function send()
{
    document.search.submit();
}

/////////////////////////////////////////////////////////////////////////

function send2()
{
    document.blanket.submit();
}

/////////////////////////////////////////////////////////////////////////
//	hidemenu(), showmenu() fucntions for creating a dynamic dropdown menu
//	name is the div that holds the menu.
/////////////////////////////////////////////////////////////////////////

function hidemenu(name) 
{
	// hide the menu
	$(name).style.left='-999em';
}

/////////////////////////////////////////////////////////////////////////

function showmenu(name) 
{
	
	var wwidth = 0;  //will get current width of window
	var curleft = document.getElementsByClassName('startmenu')[0].offsetParent.offsetLeft; //will get left offset of element
	var obj = $(name);
	
	//get width of window
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    wwidth = window.innerWidth;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    wwidth = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    wwidth = document.body.clientWidth;
  }
  
	
  	//get left ofset of object
	if (obj.offsetParent)
	{
		while(1) 
        {
		  curleft += 100;
		  
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
	}
	else if (obj.x)
		curleft += obj.x;
	
	
	
	//if object is too far right, move next menu to left
	if((parseInt(wwidth)-parseInt(curleft)) < 15) {
		$(name).style.margin= "-1em 0 0 -15em";
	}
	
	//show menu
	$(name).style.left='auto';
	

}

///////////////////////////////////////////////////////////////////////////////////
//
//	AJAX functions used to do suggestive search.
//
///////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////
//	createRequestObject()  creates a xmlhttprequest object.
//	checks for type of request object based on browser
///////////////////////////////////////////////////////////////////////////////////

function createRequestObject() { 

	var req; //request object

	//attempt to create request object
	if(window.XMLHttpRequest){ 
		// Firefox, Safari, Opera... 
		req = new XMLHttpRequest(); 
	} else if(window.ActiveXObject) { 
		// Internet Explorer 5+ 
		req = new ActiveXObject("Microsoft.XMLHTTP"); 
	} else { 
		// There is an error creating the object, 
		// just as an old browser is being used. 
		alert('Problem creating the XMLHttpRequest object'); 
	} 
	
	return req; 
} 
	
	// Make the XMLHttpRequest object 
var http = createRequestObject(); 
	
	
function sendRequest(q) { 
	if(q.length >1 ) { //request if string length is greater 2
		// Open PHP script for requests , add search string to end of URL
		http.open('get', 'autoSuggest.php?q='+q); 
		   
		// if readystate changes, call handleResponse()
		http.onreadystatechange = handleResponse; //callback to handleResponse()
		   
		http.send(null); 
	}
	else {
		//if search string is not long enough, dont show results box.
		document.getElementById("searchResults").style.visibility = 'hidden';
	}
} 
	
/////////////////////////////////////////////////////////////////////////////
//	hideSuggest()
//	Hides the results div by changing CSS properties
////////////////////////////////////////////////////////////////////////////

function hideSuggest() {
	document.getElementById("searchResults").style.visibility = 'hidden';
	document.getElementById("searchResults").innerHTML = '';
	return false;
}
	
////////////////////////////////////////////////////////////////////////////
//	handleResponse()
//	Gets the response from the httprequest object, the processes it.
////////////////////////////////////////////////////////////////////////////

function handleResponse() { 
	// check if ready state is 4 (finished) 
	//and status is 200 (OK)
	//  This should only be true after http.responseText has completely loaded.
   if(http.readyState == 4 && http.status == 200){ 

	  // Text returned FROM the PHP script 
		var response = http.responseText; 

		if(response) { 
			// if there is any response from the httprequest, UPDATE ajaxTest content 
		 
			document.getElementById("searchResults").style.visibility = 'visible';
			document.getElementById("searchResults").innerHTML = response; 
		 
		 	//adjust the height of the results box if too many results are returned
		 	if (document.getElementsByClassName("suggest").length > 31) {
		 		$("searchResults").style.height = "310px";
		 	}
		 	else {
		 		$("searchResults").style.height = (parseInt(document.getElementsByClassName("suggest").length)+5)+"9px";
		 	}
		} 
	} 
}

////////////////////////////////////////////////////////////////////////////////////////
//	Functions for image rollover popups
////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////
//	showpic(divtag, f, ftype)
//	divtag is the name of the image, without it's extension
//	f is the name of the element that is calling the function, usually this
//	ftype is optional, it is the extension of the file.  The default is png.
////////////////////////////////////////////////////////////////////////////////////////

function showpic( divtag, f, ftype) {
	if(ftype){
		getpic( divtag, f, ftype);
	}
	else {
		getpic( divtag, f, "png");  
	}

	//attach on mouseout event to id
	if(!f.onmouseout) {
		f.onmouseout = function() { hidepic(divtag, f); }
	}
}

function getpic( divtag, f, ftype) { 
	var imgsource = "images/roll_over_images/"+divtag+"."+ftype;
	
	//create the <div>
	try { //IE
		divelement = document.createElement("<div id='div"+divtag+"' style='position:absolute;left:150px; margin-top:-200px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader( src="+imgsource+");'></div>");
	} 
	catch (e) { //other
		try {
			divelement = document.createElement("div");
			divelement.setAttribute("style", "position:absolute;left:150px; margin-top:-200px;");
			divelement.setAttribute("id", "div"+divtag);
		}
		 catch(e) {}
	}
	f.parentNode.appendChild(divelement); //append <div> to <tr>

	//create the <img>
	try { //IE, insert a 1px image
		element = document.createElement("<img src='1px.gif'  id='img"+divtag+"' alt='"+divtag+"' style='visibility:none'/>");
	} 
	catch (e) { //other 
		try {
			element = document.createElement("img");
			element.setAttribute("src", imgsource);
			element.setAttribute("id", "img"+divtag);
			element.setAttribute("alt", divtag);
		}
		catch(e) {}
	}
	divelement.appendChild(element); //append <img> to <div>
}

function hidepic(divtag, f) {
	f.parentNode.removeChild($("div"+divtag));            //remove <div>
}

function show_title( divtag, f, ftype) { 
	var imgsource = "images/"+divtag+"."+ftype;
	
	//create the <div>
	try { //IE
		divelement = document.createElement("<div id='div"+divtag+"' style='width:100%; height:300px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader( src="+imgsource+");'></div>");
	} 
	catch (e) { //other
		try {
			divelement = document.createElement("div");
			divelement.setAttribute("style", "width:100%; height:300px;");
			divelement.setAttribute("id", "div"+divtag);
		}
		 catch(e) {}
	}
	f.parentNode.appendChild(divelement); //append <div> to <tr>

	//create the <img>
	try { //IE, insert a 1px image
		element = document.createElement("<img src='1px.gif'  id='img"+divtag+"' alt='"+divtag+"' style='visibility:none'/>");
	} 
	catch (e) { //other 
		try {
			element = document.createElement("img");
			element.setAttribute("src", imgsource);
			element.setAttribute("id", "img"+divtag);
			element.setAttribute("alt", divtag);
		}
		catch(e) {}
	}
	divelement.appendChild(element); //append <img> to <div>
}

////////////////////////////////////////////////////////////////////////////////////////
//	Functions for text Information in vacuum beds
////////////////////////////////////////////////////////////////////////////////////////

var content=new Array()
//change the array below to the text associated with your links Expand or contract the array, depending on how many links you have
content[0]='<big><b>Aluminum / Stainless Steel Surfaces</b></big>'
content[1]='<big><b>Custom Cut Outs</b></big>'
content[2]='<big><b>Custom Pocket Positioning</b></big>'
content[3]='<big><b>Multi-Color Anodizing</b></big>'
content[4]='<big><b>Lift &amp; Positioning Pins</b></big>'
content[5]='<big><b>Side and Bottom Ports</b></big>'

function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers){
appear()
setTimeout("window.onresize=regenerate",250)
}
}

function changetext(whichcontent){

if (document.all||document.getElementById){
cross_el=document.getElementById? document.getElementById("descriptions"):document.all.descriptions
cross_el.innerHTML='<font face="Verdana"><small>'+whichcontent+'<font></small>'
}
else if (document.layers){
document.d1.document.d2.document.write('<font face="Verdana"><small>'+whichcontent+'</small></font>')
document.d1.document.d2.document.close()
}

}

function appear(){
document.d1.visibility='show'
}

window.onload=regenerate2