// JavaScript Document
/*
	File: atd.js
	Created by: monson
	Created for: rendering the majority of the javascript for the AT&D website
*/

//global variables for moving images and the timer on the main page
num = 0;
var timerID = 0;
var timerID2 = 0;
var picNum=0;
var brighter = false;
var pausetimer = 5;
var pagereload = false;

//global variable for the font size increase on the gallery pages
var timerIDs = new Array();// = 0;
timerIDs = 0;
var ogSize= 15;
var lgSize = 30;

//global vars for the gallery pages
var currentContext = "";
var currentLarge = "";
var svcCounter = 0;
var svcCount = 0;
var bigCount = 0;


/****************************************************
 load()
 function called when page loads.  
 begins the rotating image event on main page
 sets focus and enables submit button on the online
 app page
 ****************************************************/
function load()
{
	//main page
	if(document.getElementById("caption"))
	{
		f5();
		pauseTimer(); //starting rotating images
	}
	
	//online app page
	if(document.getElementById("position"))
	{
		if(!getURLParams2())
			document.getElementById('position').focus();
		else
			document.getElementById('findposition').focus();
			
		document.getElementById('submitting').disabled = false;
		today = gettoday();
		document.getElementById('todaysdate').innerHTML = today;
		
	}
}

/****************************************************
 f5()
 function to set the picture caption on initial load
 and when main page is refreshed.
 ***************************************************/
function f5()
{
		//this makes sure the caption is set properly on load or refresh
		document.getElementById("caption").innerHTML="AT&D Building";
}
	


/***************************************************
 updateTimer()
 function to advance timer and rotate images
 called by pause()
 ***************************************************/
function updateTimer()
{
	//getting the image and caption elements
	var currentImage = document.getElementById("rotating");
	var currentCaption = document.getElementById("caption");
	
	//Image and Caption arrays created
	var myImage = new Array();
	var caption = new Array();

	//Image Pool
	myImage[0] = "images/home/building.jpg";
	myImage[1] = "images/home/stamping.jpg";
	myImage[2] = "images/home/manmill.jpg";
	myImage[3] = "images/home/lasercut.jpg";
	myImage[4] = "images/home/finished.jpg";
	
	//Image Captions
	caption[0] = "AT&D Building";
	caption[1] = "Punch Press & Progressive Stamping Die";
	caption[2] = "Quality People Doing Quality Work";
	caption[3] = "Laser Cutting";
	caption[4] = "Finished Quality Parts";
	
	//opacity variable for IE only and FF
    var opac = "alpha(opacity=0)";
	var FFopac = 0;
	

    //handling IE
    if(navigator.appName == "Microsoft Internet Explorer")
    {
        //fading out image
        if(!brighter)
		{
			num += 5;
			//diminishing image opacity
        	if(num<101) 
				opac = "alpha(opacity=" + (100-num) + ")";
			
			//changing to increasing image opacity
			else 
			{
				brighter = true;
				num=100;
			}
		}
		
		//fading in image 
		else
		{
			num -= 5;
			
			//increasing image opacity
			if(num>0)
				opac = "alpha(opacity=" + (100 - num) + ")";
				
			//pausing the timer to give the image a few seconds of full opacity before
			//changing to decreasing image opacity and 
			else
			{
				brighter = false;
				num=0;
				opac = "alpha(opacity=" + (100 - num) + ")";
				clearInterval(timerID); //stopping the current time
			
				pauseTimer(); //starting the pause timer that will  eventually start the fade-in/fade-out process over
				
			}
		}

        //changing picture and caption
        if(num==100) 
        {
			if(picNum != 4)
				picNum++;
			else picNum=0;
			
            currentImage.src=myImage[picNum];
			currentCaption.innerHTML = caption[picNum];
        }
        
        //assigning new opacity
        currentImage.style.filter = opac;
		currentCaption.style.filter = opac;
    }    
	
    //firefox(netscape)
    else
    {
        if(!brighter)
		{	
			num += .05;
        
			if(num<1.01) 
			{
				FFopac = 1-num;
			}
			else
			{
				brighter = true;
				num = 1;
			}
        }
		else
		{
			num -= .05;
			if(num>0)
				FFopac = 1-num;
			else
			{
				brighter=false;
				num = 0;
				FFopac = 1;
				clearInterval(timerID); //stopping the current time
				pauseTimer(); //starting the pause timer that will eventually start the fade-in/fade-out process over
			}
		}
		//changing picture and caption
        if(num==1) 
        {
			if(picNum != 4)
				picNum++;
			else picNum=0;
			
            currentImage.src=myImage[picNum];
			currentCaption.innerHTML = caption[picNum];
        }
		//setting opacity
		currentImage.style.MozOpacity = FFopac;
		currentCaption.style.MozOpacity = FFopac;
    }
}

/***************************************************
 pauseTimer()
 function to put a pause on rotating images on main 
 page.  called by pause()
 ***************************************************/
function pauseTimer()
{
	
	if(timerID2) clearInterval(timerID2); //clear rotating timer
    timerID2 = setInterval(function(){pause();},1000);	//starting pause timer
}

/***************************************************
 pause()
 function to that calls function to stop image rotation
 for 5 seconds on main page
 ***************************************************/
function pause()
{
		//testing for the timer running down to 0
		if(pausetimer==0)
		{
			//reset the timer
			pausetimer=5;
			
			//clearing pause timer and beginning image rotation timer
			clearInterval(timerID2);
			if(timerID) clearInterval(timerID);
		    timerID = setInterval(function(){updateTimer();},50);
		}
		//advancing timer closer to 0
		else
			pausetimer--;
}


/***************************************************
 empFade()
 function to fade in info for the leadership page
 ***************************************************/
function empFade()
{	
	//advancing opacity in IE
	if(navigator.appName == "Microsoft Internet Explorer" && num != 100)
	{
		num += 5;
		document.getElementById("bio").style.filter = "alpha(opacity=" + num + ")";
	}	
	
	//advancing opacity in FF
	if(navigator.appName == "Netscape" && num != 1);
	{
		num += .05;
		document.getElementById("bio").style.MozOpacity = num;
	}
	
	//clearing the timer once 100% opacity has been achieved
	if((navigator.appName =='Netscape' && num > 1) || num > 100)
	{
		//alert(navigator.appName);
		num = 0;
		clearInterval(timerID);
	}
}

/***************************************************
 bio()
 setting the initial bio area
 ***************************************************/
function bio()
{
	empbio = document.getElementById('bio');
	empbio.style.textAlign = "center";
	empbio.innerHTML = "<br /><img src='images/atdmed.gif' style='float:center' alt='Points of contact' />";
	empbio.innerHTML += '<h3>Click a name to get the job description and contact info.</h1>';
}

/***************************************************
 popUp()
 function to pop up info on the certifications on
 the about us - certifications page
 ***************************************************/
function popUp(what)
{
	switch (what)
	{
		case "ABS":
			desc = "<strong><center>Certified to ISO 9001:2000</center></strong>";
			desc += "<div style='text-align: left'>";
			desc += "<center>AT&amp;D has been independently audited and certified to be in conformance with ISO 9001:2000.</center><br />";
			desc += "The 2000 version of the ISO 9001 International Standard specifies requirements for a quality management system "
			desc += "which meets customer requirements, enhances customer satisfaction, and provides an means of continuous monitoring "
			desc += "and improvment for the products and services the certified company company provides. ISO 9001:2000 is based on a systematic, "
			desc += "process approach and strives to control and improve organizational results.</div>";
	//		desc += "AT&amp;D meets and exceeds the standards set forth in ISO 9000:2000 for the aerospace industry";
			ddrivetip(desc,'#506473', 300);
			break;
		case "NADCAP":
			desc = "<strong><center>Nadcap Accredited</strong></center>";
			desc += "<div style='text-align:left'>";
			desc += "<center>AT&amp;D is Nadcap accredited for welding</center><br />";
			desc += "Nadcap is the leading worldwide cooperative program of major companies designed to manage a cost-effective consensus ";
			desc += "approach to special processes & products and provide continual improvement within the aerospace & automotive industries";
			ddrivetip(desc,'#506473', 300);
			break;
		case "ANAB":
			desc = "<strong><center>ANAB Compliant</strong></center>";
			desc += "<div style='text-align:left'>";
			desc += "<center>AT&amp;D meets compliancy standards for ANAB accreditation and compliancy</center><br />";
			desc += "ANAB is a member of the International Accreditation Forum and a signatory of the IAF multilateral cooperative ";
			desc += "arrangements (MLAs) for QMS and EMS. Through the IAF MLAs and the Multilateral Cooperative Accreditation Arrangement, ";
			desc += "ANAB cooperates with other accreditation bodies around the world to provide value to its accredited CBs and their ";
			desc += "clients, ensuring that accredited certificates are recognized nationally and internationally. The global conformity ";
			desc += "assessment system ensures confidence and reduces risk for customers engaging in trade worldwide. ";
			ddrivetip(desc,'#506473', 300);
			break;
	}
}

/*******************************************
getBigger()
function to make text links 'grow' on the
gallery page
********************************************/
function getBigger(id)
{
	what=document.getElementById(id);
	if(timerID)
		clearInterval(timerID);
	timerID = setInterval(function(){bigText(what);},10);
}

//making bigger on mouseover
function bigText(what)
{
	ogSize++;
	if(ogSize < 30)
		what.style.fontSize=ogSize + "px";
	else
	{
		clearInterval(timerID);
		ogSize=15;
	}
}

//making smaller and clearing timer on mouseout
function getSmaller(id)
{
	if(timerID)
		clearInterval(timerID);
		
	document.getElementById(id).style.fontSize="15px";
}

//not sure I use this... will check
function smallText(what,tid)
{
	lgSize--;
	if(lgSize>15)
		what.style.fontSize=lgSize + "px";
	else
	{
		clearInterval(timerIDs[tid]);
		lgSize=35;
	}
}
	

/**************************************************************
* getWWD()
* function to populate the images in the services and products
* galleries
**************************************************************/
function getWWD(who,what)
{
	//setting current context
	currentContext = "images/"+who+"/" + what + "/";
	
	//setting context for larger pop-up image
	currentLarge = "images/large/"+what+"/";
	
	//setting the counter to the first image 
	svcCounter = parseInt(document.getElementById(what + "0").value);
	document.getElementById('info').style.visibility="visible";
	//setting counter and getting the caption
	svcCount=0;
	bigCount=0;
	getCaption(what);
	//num = 0;
	
	//setting image and disabling slide show buttons
	document.getElementById('img').src = currentContext + svcCount + ".jpg";
	document.getElementById('img').alt = "Services Picture";
	document.getElementById('prev').disabled = true;
	document.getElementById('next').disabled = true;
		
	//enabling the next option if there is more than one picture
	if((svcCount+1) < svcCounter)
	{
		document.getElementById('next').disabled = false;
		svcCount++;
	}
	//setting the counter back to 0
	else
		svcCount = 0;
}

/**************************************************************
* getCaption()
* function to get the caption that goes with the images in the
* galleries
**************************************************************/
function getCaption(what)
{
	caption = document.getElementById('text');
	
	//switching on what has been passed in
	switch(what)
	{
		case "engineering":
			html = "Allied has a team of highly skilled engineers whose abilities, ";
			html += "coupled with the various technologies we employ, allow us to provide ";
			html += "viable solutions to your design challenges efficiently and economically.";
			caption.innerHTML = html;
			break;
		case "metalstamp":
			html = "Through technique and technology, Allied produces a wide range of Metal ";
			html += "Stamping products and can do so at tolerances that meet standards required ";
			html += "to be used for organizations such as NASA.";
			caption.innerHTML = html;
			break;
		case "lasermach":
			html = "Allied's six-axis laser machining offers a unique flexibility in design and ";
			html += "product development.  By removing much of the guesswork in parts development, ";
			html += "laser machining affords us greater precision, economy, and quality on short ";
			html += "runs and prototypes.  Being the first contract manufacturer in Arizona to utilize ";
			html += "laser machining speaks to Allied's commitment to competitiveness and forward-thinking relevence.";
			caption.innerHTML = html;
			break;
		case "welding":
			html = "Allied employs various welding methods including TIG and Laser welding. It should be ";
			html += "noted that with the employeement of laser welding, we gain the flexibility to join exotic, ";
			html += "and even dissimilar materials, with less distortion and in difficult areas.";
			caption.innerHTML = html; 
			break;
		case "cncmach":
			html = "Allied's CNC department provides ever expanding services for our customers. Our vertical ";
			html += "machining center, turning center, and wire EDM afford us the ability to produce in-house ";
			html += "almost anything ranging from basic machining to 3D surfacing.  Additionally, the CNC ";
			html += "machines are interfaced with our CAD/CAM system to expodite the turnaround from design to production.";
			caption.innerHTML = html;
			break;
		case "more":
			html = "Allied employs various machine presses to both change the shape and, in some cases, the internal ";
			html += "structure of the material to produce whatever parts/products are required.  Also, Wire EDM ";
			html += "Machining, Surface Gindering, non-CNC Milling, and other equipment, methods, and techniques are ";
			html += "employed to aid in production.";
			caption.innerHTML = html;
			break;
		case "testing":
			html = "Allied has in-house capabilities to perform product testing to ensure the meeting of industry ";
			html += "standards as well as certifying to customer-specific ones and our inspection system meets or ";
			html += "exceeds the requirements of MIL-I-45208-A and maintains SPC capabilities.";
			caption.innerHTML = html;
			break;
		case "finished":
			caption.innerHTML = "These products represent a sampling and idea of our overall capabilities.";
			break;
		default:
			caption.innerHTML = 'Click on a link on the left to "have a look"';
			break;
	}
	
	//setting the style
	caption.style.textAlign = "justify";
	caption.style.fontSize = "20px";
	caption.style.fontWeight = "bold";		
}

//not sure I use this - will check
function svcTimer()
{
	if(timerID) clearInterval(timerID);
    timerID = setInterval(function(){getServicesPics();},100);		
}

//not sure I use this - will check
function getServicesPics()
{
	var viewer = document.getElementById('img');
	
	if(navigator.appName == "Microsoft Internet Explorer" && num < 100)
	{
		num += 5;
		viewer.style.filter = "alpha(opacity=" + (100-num) + ")";
	}
	
	if(num == 100)
		viewer.src = currentContext + svcCount + ".jpg";
		
	if(navigator.appName == "Microsoft Internet Explorer" && num > 100 && num < 200)
	{
		num += 5;
		viewer.style.filter = "alpha(opacity=" + (num - 100) + ")";
	}
	if(num > 200)
	{
		num = 0;
		clearInterval(timerID);
	}
	
	if(navigator.appName == "Netscape" && num < 1);
	{
		num += .05;
		viewer.style.MozOpacity = 100 - num;
	}
	
	if(navigator.appName == "Netscape" && num > 1 && num < 2);
	{
		num += .05;
		viewer.style.MozOpactiy = num - 100;
	}
	
	if(navigator.appName == "Netscape" && num > 2);
	{
		num = 0;
		clearInterval(timerID);
	}
}
/**************************************************************
* prev()
* function to get previous images on product and service galleries
**************************************************************/
function prev()
{
	svcCount--;
	
	//enabling the next button if disabled
	if(document.getElementById('next').disabled == true)
		document.getElementById('next').disabled = false;
	
	//setting new image
	document.getElementById('img').src = currentContext + svcCount + ".jpg";
	bigCount = svcCount;
	
	//disabling the previous button if at the first image
	if(svcCount == 0)
	{
		document.getElementById('prev').disabled = true;
		svcCount++;
	}
}

/**************************************************************
* next()
* function to get next image on product and service galleries
**************************************************************/
function next()
{
	//this may be a redundant check not needed - will check
	if((svcCount+1) > svcCounter)
	{
		document.getElementById('next').disabled = true;
		svcCount--;
		return;
	}
	else
	{	//enabling previous button if disabled
		if(document.getElementById('prev').disabled == true)
		{
			document.getElementById('prev').disabled = false;
		}
	
		//setting image and avancing counter
		document.getElementById('img').src = currentContext + svcCount + ".jpg";
		bigCount = svcCount;
		svcCount++;
				
		//if at the last image then disabling next button
		if((svcCount+1) > svcCounter)
		{
			document.getElementById("next").disabled=true;
			svcCount--;
		}
	}

}

/**************************************************************
* getEquip()
* function to populate the equipment when a category is clicked on
* on the equipment page
**************************************************************/
function getEquip(what)
{
	var output = "<table>";
	switch (what)
	{
		case 'cncmills':
			output += "<tr><td style='text-align:left; font-size:18px;font-weight:bold;width:250px;'>CNC Mills</td>";
			output += "<td style='text-align:center; font-size:18px;font-weight:bold;width:150px'>Capacities</td></tr>";
			output += getIt('1 Leadwell V20I','4th axis rotary head');
			output += getIt('1 TDC 510 Mini Mill','5th axis rotary head');
			output += getIt('3 Matsuura 500V', '20" x 14" x 14" (Rotary)');
			output += getIt('1 Matsuura 510V','20" x 14" x 18.1" ');
			output += getIt('2 Matsuura 800VG','32" x 20" x 20" (Rotary)');
			output += getIt('1 Matsuura 760VX','32" x 20" x 20" (Rotary');
			output += getIt('1 Matsuura ES-450H','17.7" x 15.7" x 15.7" (Rotary)');
			break;
		case 'cnclathes':
			output += "<tr><td style='text-align:left; font-size:18px;font-weight:bold;width:250px;'>CNC Lathes</td>";
			output += "<td style='text-align:center; font-size:18px;font-weight:bold;width:150px'>Dimensions</td></tr>";
			output += getIt('3 LEADwell T6','NEW 2008');
			output += getIt('2 Leadwell T7 ','8" chuck (NEW 2008)');
			output += getIt('1 Ameri-Seiki 2 axis turning center','24" dia. turn capacity');
			output += getIt('1 Nakamura-Tome TMC-300 - 2 Axis','2.79" bar cap.');
			output += getIt('1 Nakamura-Tome SC300M - 3 Axis Turning Center','30HP 12 station, backface turning, 2.79" round collet cap.');
			output += getIt('1 Nakamura-Tome TMC-20 Turning Center','10 HP 10 station, 2" bar cap., 11.02 max. workpiece dia.');
			output += getIt('1 Nakamura-Tome SC250M - 3 Axis Turning Center','2" bar cap., 6 Live Heads');
			output += getIt('1 Moriseiki - 2 Axis Turning Center','2" bar cap.');
			break;
		case 'edm':
			output += "<tr><td style='text-align:left; font-size:18px;font-weight:bold;width:250px;'>Wire E.D.M.</td>";
			output += "<td style='text-align:center; font-size:18px;font-weight:bold;width:150px'>Dimensions</td></tr>";
			output += getIt('1 Charmilles Robofil 330F - 5 Axis','15.75"x11.8"x15.75", 30 deg. taper');
			break;
		case 'lasers':
			output += "<tr><td style='text-align:left; font-size:18px;font-weight:bold;width:250px;'>Lasers</td>";
			output += "<td style='text-align:center; font-size:18px;font-weight:bold;width:150px'>Dimensions</td></tr>";
			output += getIt('1 Sylvania 1610 - 5 Axis 150 Watt', '18"x18"x10"(16" Rotary Tilt)');
			output += getIt('1 Raytheon - 4 Axis 300 Watt', '16"x32"x10"(13.5 Rotary)');
			output += getIt('1 Raytheon','4 Axis 400 Watt', '18"x18"x12"(13.5 Rotary)');
			output += getIt('1 Lumonics - 4 Axis 400 Watt', '24"x36"x 8"');
			output += getIt('1 ILM - 5 Axis 400 Watt', '32" X, Y, and Z plus rotary and rotary nozzle');
			output += getIt('1 Lee Laser Part Marker - 2 Axis 50 Watt', '24"x18"x11"');
			break;
		case 'obi':
			output += "<tr><td style='text-align:left; font-size:18px;font-weight:bold;width:250px;'>O.B.I. Presses</td>";
			output += "<td style='text-align:center; font-size:18px;font-weight:bold;width:150px'>Dimensions</td></tr>";
			output += getIt('1 V & O','25 Ton');
			output += getIt('1 Minster / Back Geared with Air Cushion','60 Ton');
			output += getIt('1 Walsh / Back Geared with Air Cushion','65 Ton');
			break;
		case 'gap':
			output += "<tr><td style='text-align:left; font-size:18px;font-weight:bold;width:250px;'>Gap Frame Presses</td>";
			output += "<td style='text-align:center; font-size:18px;font-weight:bold;width:150px'>Dimensions</td></tr>";
			output += getIt('1 Stamtec High Speed Punch Press','400 s.p.m. 22 Ton');
			output += getIt('1 Komatsu','45 Ton');
			output += getIt('1 Minster / with Air Cushion','75 Ton');
			output += getIt('1 Rosselle / with Air Cushion','150 Ton');
			break;
		case 'ssp':
			output += "<tr><td style='text-align:left; font-size:18px;font-weight:bold;width:250px;'>Straight Side Presses</td>";
			output += "<td style='text-align:center; font-size:18px;font-weight:bold;width:150px'>Dimensions</td></tr>";
			output += getIt('1 Minster Piece-Maker','60 Ton 600 s.p.m.');
			output += getIt('1 Minster Piece-Maker','60 Ton 325 s.p.m.');
			output += getIt('1 Minster Piece-Maker','100 Ton 160 s.p.m.');
			break;
		case 'lathes':
			output += "<tr><td style='text-align:left; font-size:18px;font-weight:bold;width:250px;'>Lathes</td>";
			output += "<td style='text-align:center; font-size:18px;font-weight:bold;width:150px'>Capacities</td></tr>";
			output += getIt('2 LeBlond Engine Lathes','19" dia x 72"');
			output += getIt('1 Cadillac Gap Bed Lathe','25" dia x 40"');
			output += getIt('1 Hardinge Manual Chucker Lathe','8" dia.');
			output += getIt('2 Hardinge Tooling Lathes','8" dia.');
			output += getIt('1 Hardinge Second Operation Lathe','8" dia.');
			break;
		case 'mills':
			output += "<tr><td style='text-align:left; font-size:18px;font-weight:bold;width:250px;'>Mills</td>";
			output += "<td style='text-align:center; font-size:18px;font-weight:bold;width:150px'>Capacities</td></tr>";
			output += getIt('8 Bridgeport Vertical with Digital Readouts & Power Feeds','&nbsp;');
			output += getIt('2 Bridgeport Vertical Mills','9" x 42"');
			output += getIt('1 Moore #3 Precision Jig Borer with Grinding Attachment','12" x 18"');
			break;
		case 'grinding':
			output += "<tr><td style='text-align:left; font-size:18px;font-weight:bold;width:250px;'>Grinding</td>";
			output += "<td style='text-align:center; font-size:18px;font-weight:bold;width:150px'>Capacities</td></tr>";
			output += getIt('4 Manual Surface Grinders with Digital Readouts','6" x 18"');
			output += getIt('1 Okamoto Automatic Surface Grinder','12" x 24"');
			output += getIt('1 ID / OD Grinder Mighty','13" x 34"');
			output += getIt('1 OD Grinder Studer','4.5" x 12"');
			output += getIt('1 ID Grinder Heald','15" x 10"');
			output += getIt('2 Sunnen Honing Machines','&nbsp;');
			break;
		case 'mfinish':
			output += "<tr><td style='text-align:left; font-size:18px;font-weight:bold;width:250px;'>Metal Finishing Equipment</td>";
			output += "<td style='text-align:center; font-size:18px;font-weight:bold;width:150px'>Capacities</td></tr>";
			output += getIt('1 ADF Auger Style Parts Cleaning System ','&nbsp;');
			output += getIt('1 Tore / 10 Cubic ft. Vibrator Deburr','&nbsp;');
			output += getIt('2 Ultra-Matic / 3 Cubic ft. Vibratory Deburr','&nbsp;');
			output += getIt('1 Time Saver / Deburr','&nbsp;');
			output += getIt('1 Cress Heat Treat Furnace with Rockwell Testing ','2000&deg;');
			output += getIt('1 Blue M Heat Treat Furnace','9 cu. ft. / 662&deg;');
			break;
		case 'weld':
			output += "<tr><td style='text-align:left; font-size:18px;font-weight:bold;width:250px;'>Welding</td>";
			output += "<td style='text-align:center; font-size:18px;font-weight:bold;width:150px'>Capacities</td></tr>";
			output += getIt('1 Miller Syncrowave 351 T.I.G.','400 Amp.');
			output += getIt('3 Miller Syncrowave 250\'s T.I.G.','300 Amp.');
			output += getIt('1 Miller Millermatic 250 M.I.G.','200 Amp.');
			output += getIt('1 Unitek Resistance Welder','16 KvA');
			output += getIt('1 Aircrafter 2A Rotary Welding Positoner','6" dia. 0-90 tilt');
			output += getIt('1 Lincoln Pro-Cut 60 Plasma Cutter','45 Amp');
			break;
		case 'sms':
			output += "<tr><td style='text-align:left; font-size:18px;font-weight:bold;width:250px;'>Sheet Metal Support</td>";
			output += "<td style='text-align:center; font-size:18px;font-weight:bold;width:150px'>Capacities</td></tr>";			       
			output += getIt('1 Muratec turret press','25 Ton');
			output += getIt('1 Accupress brake press','10 ft. bed 130 Ton');
			output += getIt('1 Accupress brake press','8 ft. bed 60 ton');
			output += getIt('2 Heager hardware presses','n/a');
			output += getIt('1 Enerpac Hydraulic Press','25 Ton');
			output += getIt('2 Diacro Rolling Mills','n/a');
			output += getIt('1 Pexto Shear','16 Ga. x 3 ft.');
			output += getIt('1 TruFab Shear','1/4" x 4 ft.');
			output += getIt('1 Niagara Shear','3/16" x 12 ft.');
			break;
		case 'saws':
			output += "<tr><td style='text-align:left; font-size:18px;font-weight:bold;width:250px;'>Saws</td>";
			output += "<td style='text-align:center; font-size:18px;font-weight:bold;width:150px'>Dimensions</td></tr>";	
			output += getIt('1 DoAll Contour Saw','&nbsp;');
			output += getIt('1 Drake Saw','&nbsp;');
			output += getIt('1 Hyd-Mech Saw','18"dia');
			output += getIt('1 Master Cut Auto Band Saw','&nbsp;');
			break;
		case 'cad':
			output += "<tr><td style='text-align:left; font-size:18px;font-weight:bold;width:250px;'>Cad/Cam</td>";
			output += "<td style='text-align:center; font-size:18px;font-weight:bold;width:50px'>&nbsp;</td></tr>";	
			output += "<td colspan='2'>10 TekSoft Drawing Systems w/ 3D capabilities<br />";
			output += "Gibbs Cam<br />Solid Works</td></tr>";
			break;
		case 'insp':
			output += '<tr><td colspan="2">Complete Quality Assurance Department</td></tr>';
			output += getIt('ISO9001:2000 SAE AS9100B:2004 certified','&nbsp;');
			output += getIt('Nadcap Accredited Welding/Brazing','&nbsp;');
			output += getIt('2  Master View Suburban 14" comparator','&nbsp;');
			output += getIt('Jones & Lamson 30" Comparator','&nbsp;');
			output += getIt('2 Brown & Sharpe CMM','18 X 20 X 16');
			output += getIt('80 X Microscope ','&nbsp;');
			output += getIt('Wilson Rockwell Tester','&nbsp;');
			output += getIt('Starett Rockwell Tester','&nbsp;');
			output += getIt('S.P.C. Capability','&nbsp;');
			break;
		case 'cap':
			output += '<tr><td colspan="2" style="text-align:left">36,000 sq. ft. Manufacturing<br />';
			output += '84 Full Time Employees<br />';
			output += '56 years experience in Aerospace, Automotive, Commercial, Electronic, and ';
			output += 'Medical Manufacturing. Stamping, Laser Cutting, Laser Welding, Laser Part Marking, ';
			output += 'Conventional Welding, Conventional Part Marking, Tool & Die, Prototype, Assemblies, ';
			output += 'Conventional Machining, and Precision CNC Machining.	';

			break;
	}
	output += "</table>";
	
	//placing results
	document.getElementById('equip').innerHTML = output;
}

/***************************************************************************
* getIt()
* function to build the equipment list cells (saves on repetitive code)
* called by getEquip()
***************************************************************************/
function getIt(what, specs)
{
	returnValue = '<tr><td style="vertical-align:top;width:250px;text-align:left">'+what;
	returnValue += '</td><td style="vertical-align:top;text-align:center;">'+specs+'</td></tr>';

	return returnValue;
}


/**************************************************************
* getURLParams()
* function to get the parameters and set who email is being sent
* to on the contact page - called by quality
*************************************************************
function getURLParams()
{
	//getting the query
	urlquery=window.location.href.split("?");
	
	//building contact list
	output = '<select id="contactlist" name="contactlist" ';
    output += 'onFocus="this.style.background=\'#FFFBCF\'" ';
	output += 'onBlur="this.style.background=\'#FFFFFF\'">';
	
	output += buildContactMenu(urlquery[1]);
	
	//placing the dropdown menu
	document.getElementById('emaillist').innerHTML = "";
	document.getElementById('emaillist').innerHTML = output;
}*/
/**************************************************************
* getURLParams2()
* function to get the parameters and set the position textbox
* on the online app page
**************************************************************/
function getURLParams2()
{
	//getting the query
	urlquery=window.location.href.split("?");
	
	//if it matches the proper length put the position in the position sought textbox
	if(urlquery.length==3)
	{
		//cleaning up if there is a %20 (space) in the parameter
		cleaned = cleanParam(urlquery[2]);
		document.getElementById('position').value=urlquery[1] + " - " + cleaned;
		return true;
	}
	
	return false;
}

//function to clean up any spaces in parameters passed through url
function cleanParam(param)
{
	regexp = new RegExp("%20");
	cleaned = param.replace( regexp, " ");
	return cleaned;
}


/**************************************************************
* buildContactMenu()
* function to build the contact menu when a specific contact
* has been specified in the url
**************************************************************/
function buildContactMenu(urlquery)
{
	var selected = new Array();

	//setting all the selected options to blank
	for(i=0;i<11;i++) selected[i] = "";
		
	//switching on the param passed
	//setting whichever one to "selected"
	switch(eval(urlquery))
	{
		case 1:
			selected[1]="selected";
			break;
		case 2:
			selected[2] = "selected";
			break;
		case 3:
			selected[3] = "selected";
			break;
		case 4:
			selected[4]="selected";
			break;
		case 5:
			selected[5] = "selected";
			break;
		case 6:
			selected[6] = "selected";
			break;
		case 7:
			selected[7]="selected";
			break;
		case 8:
			selected[8] = "selected";
			break;
		case 9:
			selected[9] = "selected";
			break;
		case 10:
			selected[10]="selected";
			break;
		default:
			selected[0] = "selected";
			break;
	}
	
	//building the dropdown and placing selected in the appropriate position 
	returnVal = '<option value="" '+selected[0]+'> - Please Select -</option>\n';
	returnVal += '<option value="ceo" '+selected[1]+'>Chuck Eriksen - CEO</option>\n';
	returnVal += '<option value="acctrcvbl" ' +selected[2] + '>whomever - Accounts Receivable</option>\n';
	returnVal += '<option value="acctpybl" '+selected[3]+'>Marilyn Silaghi - Accounts Payable</option>\n';
	returnVal += '<option value="prodctrl" '+selected[4]+'>Doug Harkins - Production Control</option>\n';
	returnVal += '<option value="qualmgr" '+selected[5]+'>Bill Jordan - Quality Manager</option>\n';
	returnVal += '<option value="purchase" '+selected[6]+'>Dale Whipple - Purchasing</option>\n';
	returnVal += '<option value="salesmkt" '+selected[7]+'>Jeff Moorhead - Sales/Marketing</option>\n';
	returnVal += '<option value="engineer" '+selected[8]+'>Mike Furbacher - Engineering</option>\n';		
	returnVal += '<option value="docdata" '+selected[9]+'>Rob Bonham - Document &amp; Data Control</option>\n';
	returnVal += '<option value="humanrec" '+selected[10]+'>Human Resources</option>\n';
	returnVal += "</select>";

	//returning the build
	return returnVal;
}

/**************************************************************
* textLimit()
* function to limit text in text area in the change request section
**************************************************************/
function textLimit(field, maxlen) 
{
	my = document.getElementById(field);
	if (my.value.length > maxlen + 1)
		alert('You have exceeded the maximum characters allowed.  Your input has been truncated!');
	if (my.value.length > maxlen)
		my.value = my.value.substring(0, maxlen);
}

/***************************************************************************
	getDiscipline()
	function to populate quote machine discipline
	accepts the selected option from the machining category
	calls the function that builds the dropdown
***************************************************************************/
function getDiscipline(what)
{
	switch(what)
	{
		case "0":
			buildNothing();
			break;
		case "1":
			buildProd();
			break;
		case "2":
			buildMetal();
			break;
		case "3":
			buildTool();
			break;
		case "4":
			buildLaserM();
			break;
		case "5":
			buildLaserW();
			break;
		case "6":
			buildCNC();
			break;
		case "7":
			buildWeld();
			break;
		default:
			buildNothing();
			break;
	}
}

//building nothing selected
function buildNothing()
{
	build = "Manufacturing Discipline";
	build += '<select name=\"mdis\" id=\"mdis\" tabindex=\"2\" onFocus=\"this.style.background=\'#FFFBCF\'\" onBlur=\"this.style.background=\'#FFFFFF\'\">';
	build += '<option selected="selected" value=""> - Please Select - </option>';
	build += '<option value="Not Sure">Not Sure</option>';
	build += '</select>';
	
	document.getElementById('discipline').innerHTML = build;
}

//building production
function buildProd()
{
	build = "Manufacturing Discipline";
	build += '<select name=\"mdis\" id=\"mdis\" tabindex=\"2\" onFocus=\"this.style.background=\'#FFFBCF\'\" onBlur=\"this.style.background=\'#FFFFFF\'\">';
	build += '<option selected=\"selected\" value=\"\"> - Please Select - </option>';
	build += '<option value=\"Production Machining\">Production Machining</option>';
	build += '<option value=\"Not Sure\">Not Sure</option>';
	build += '</select>';
	
	document.getElementById('discipline').innerHTML = build;
}

//building metal stamping
function buildMetal()
{
	build = "Manufacturing Discipline";
	build += '<select name=\"mdis\" id=\"mdis\" tabindex=\"2\" onFocus=\"this.style.background=\'#FFFBCF\'\" onBlur=\"this.style.background=\'#FFFFFF\'\">';
	build += '<option selected=\"selected\" value=\"\"> - Please Select - </option>';
	build += '<option value=\"Metal Stamping\">Metal Stamping</option>';
	build += '<option value=\"Not Sure\">Not Sure</option>';
	build += '</select>';
	
	document.getElementById('discipline').innerHTML = build;
}

//building tool & die
function buildTool()
{
	build = "Manufacturing Discipline";
	build += '<select name=\"mdis\" id=\"mdis\" tabindex=\"2\" onFocus=\"this.style.background=\'#FFFBCF\'\" onBlur=\"this.style.background=\'#FFFFFF\'\">';
	build += '<option selected=\"selected\" value=\"\"> - Please Select - </option>';
	build += '<option value=\"Tool And Die\">Tool &amp; Die</option>';
	build += '<option value=\"Not Sure\">Not Sure</option>';
	build += '</select>';
	
	document.getElementById('discipline').innerHTML = build;	
}

//building laser machining
function buildLaserM()
{
 	build = "Manufacturing Discipline";
	build += '<select name=\"mdis\" id=\"mdis\" tabindex=\"2\" onFocus=\"this.style.background=\'#FFFBCF\'\" onBlur=\"this.style.background=\'#FFFFFF\'\">';
	build += '<option selected=\"selected\" value=\"\"> - Please Select - </option>';
	build += '<option value=\"Laser Machining\">Laser Machining</option>';
	build += '<option value=\"Not Sure\">Not Sure</option>';
	build += '</select>';
	
	document.getElementById('discipline').innerHTML = build;	
}

//building laser welding
function buildLaserW()
{
	build = "Manufacturing Discipline";
	build += '<select name=\"mdis\" id=\"mdis\" tabindex=\"2\" onFocus=\"this.style.background=\'#FFFBCF\'\" onBlur=\"this.style.background=\'#FFFFFF\'\">';
	build += '<option selected=\"selected\" value=\"\"> - Please Select - </option>';
	build += '<option value=\"Laser Welding\">Laser Welding</option>';
	build += '<option value=\"Not Sure\">Not Sure</option>';
	build += '</select>';
	
	document.getElementById('discipline').innerHTML = build;	
}

//building cnc machining
function buildCNC()
{
	build = "Manufacturing Discipline";
	build += '<select name=\"mdis\" id=\"mdis\" tabindex=\"2\" onFocus=\"this.style.background=\'#FFFBCF\'\" onBlur=\"this.style.background=\'#FFFFFF\'\">';
	build += '<option selected=\"selected\" value=\"\"> - Please Select - </option>';
	build += '<option value=\"CNC Machining\">CNC Machining</option>';
	build += '<option value=\"Not Sure\">Not Sure</option>';
	build += '</select>';
	
	document.getElementById('discipline').innerHTML = build;	
}

//building weld testing
function buildWeld()
{
	build = "Manufacturing Discipline";
	build += '<select name=\"mdis\" id=\"mdis\" tabindex=\"2\" onFocus=\"this.style.background=\'#FFFBCF\'\"';
	build += 'onBlur=\"this.style.background=\'#FFFFFF\'\">';
	build += '<option selected=\"selected\" value=\"\"> - Please Select - </option>';
	build += '<option value=\"Weld Testing\">Weld Testing</option>';
	build += '<option value=\"Not Sure\">Not Sure</option>';
	build += '</select>';
	
	document.getElementById('discipline').innerHTML = build;	
}

//getting the date to put to fields that need it
function gettoday()
{
	today= new Date();
	
	//IE - normal
	if(navigator.appName=="Microsoft Internet Explorer")
		date = (today.getMonth()+1) + "/" + today.getDate() + "/" + today.getYear();
	//FF - adding 1900 because their date rendering is the suck for the year
	else
		date = (today.getMonth()+1) + "/" + today.getDate() + "/" + (today.getYear()+1900);
	
	
	//return date;
	//output results
	document.getElementById('todaysdate').innerHTML = date;
}

/* Used to populate hidden date value on survey form */
function settoday()
{
	tdate = document.getElementById('todaysdate').innerHTML;
	document.getElementById('tdate').value = tdate;
}



/*****************************************************
* checkLen()
* function to advance the cursor to the next field
* when user inputs phone #'s and/or social security #'s
*****************************************************/
function checkLen(x,y)
{
if (y.length==x.maxLength)
  {
  var next=x.tabIndex;
  if (next<document.getElementById("myform").length)
    {
    document.getElementById("myform").elements[next+1].focus();
    }
  }
}

/****************************************************
* changejobs()
* function to change the pic on the admin.html
* that is the gateway to the change/add jobs pages
****************************************************/
function changejobs(what, pic)
{
	document.getElementById(what).src=pic;
}

function regularSiteMap(what)
{
	output = "";
	swapping =document.getElementById("swap");
	if(what=='njs')
	{
			
			
		output += '<div style="width:800px; font-size:36px;">';
		output += '<img src="images/atdlogo.gif" alt="Allied Tool & Die" /><br /></div><br />';
		output += '<h1>Site Map</h1>';
		output += '<table style="width:800px; text-align:left;">';
		output += '<tr style="font-size:16px; text-align:center">';
		output += '<td style="border-right:1px solid #000066"><a class="njs" href="index.html">Home</a></td>';
		output += '<td style="border-right:1px solid #000066">Order Request</td>';
		output += '<td style=" border-right:1px solid #000066">Job Openings</td>';
		output += '<td style="border-right: 1px solid #000066"><a class="njs" href="survey.html">Customer Survey</a></td>';
		output += '<td style="border-right: 1px solid #000066">About Us</td>';
		output += '<td style="border-right:1px solid #000066">Contact Us</td>';
		output += '</tr>';
		output += '<tr style="font-size:12px">';
			output += '<td>&nbsp;</td>';
			output += '<td><a class="njs" href="quote.html">Get A Quote</a></td>';
			output += '<td><a class="njs" href="address.html">Open Positions</a></td>';
			output += '<td>&nbsp;</td>';
			output += '<td><a class="njs" href="company.html">About Our Company</a></td>';
			output += '<td><a class="njs" href="address.html">Info & Directions</a></td>';
		output += '</tr>';
		output += '<tr style="font-size:12px">';
			output += '<td>&nbsp;</td>';
			output += '<td><a class="njs" href="online_change.php">Online Change Request</a></td>';
			output += '<td><a class="njs" href="appdownload.html">Printable Application</a></td>';
			output += '<td>&nbsp;</td>';
			output += '<td><a class="njs" href="services.php">What We Do</a></td>';
			output += '<td><a class="njs" href="appdownload.html">Contact Us Form</a></td>';
		output += '</tr>';
		output += '<tr style="font-size:12px">';
			output += '<td>&nbsp;</td>';
			output += '<td><a class="njs" href="download_change.php">Download Change Request</a></td>';
			output += '<td><a class="njs" href="onlineapp.html">Online Application</a></td>';
			output += '<td>&nbsp;</td>';
			output += '<td><a class="njs" href="quality.html">Quality Assurance</a></td>';
			output += '<td>&nbsp;</td>';
		output += '</tr>';
		output += '<tr style="font-size:12px">';
			output += '<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>';
			output += '<td><a class="njs" href="equipment.html">Equipment List</a></td>';
			output += '<td>&nbsp;</td>'; 
		output += '</tr>';
		output += '<tr style="font-size:12px">';
			output += '<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>';
			output += '<td><a class="njs" href="nojava/equipment.html">Non-JavaScript Equip. List</a></td>';
			output += '<td>&nbsp;</td>'; 
		output += '</tr>';
		output += '<tr style="font-size:12px">';
			output += '<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>';
			output += '<td><a class="njs" href="kpoc.php">Key Points of Contact</a></td>';
			output += '<td>&nbsp;</td>'; 
		output += '</tr>';
		output += '</table>';
	
		output += '<span id="toggle"';
		output += 'style="background-color:#000066;color:#CCCCCC;border: 1px solid #CCCCCC;';
        output += 'cursor: pointer; cursor:hand;" onclick="regularSiteMap(\'js\')">';
        output += 'JavaScript Sitemap</span>';
		output += '<center><br /><hr class="spacer" />';
		
		output += '<table id="footer">';
			output += '<tr>';
				output += '<td id="left">&copy; 2008 Allied Tool &amp; Die Company</td>';
				output += '<td id="right">';
					output += 'Web Design by <a id="design" style="text-decoration:none" ';
					output += 'href="http://www.monsonsolutions.com">Monson Internet Solutions &trade;</a>';
				 output += '</td></tr></table></center>';
		
		
		swapping.innerHTML=output;
		document.getElementById('toggle').innerHTML = "JavaScript Sitemap";
	}
	else
		window.location.reload();
}

function killEmp(emp)
{
	if(!document.getElementById('abrv'+emp).disabled)
	{
		document.getElementById("abrv"+emp).disabled=true;
		document.getElementById("pos"+emp).disabled=true;
		document.getElementById("name"+emp).disabled=true;
		document.getElementById("ext"+emp).disabled=true;
		document.getElementById("eml"+emp).disabled=true;
		document.getElementById("bio"+emp).disabled=true;
	}
	else
	{
		document.getElementById("abrv"+emp).disabled=false;
		document.getElementById("pos"+emp).disabled=false;
		document.getElementById("name"+emp).disabled=false;
		document.getElementById("ext"+emp).disabled=false;
		document.getElementById("eml"+emp).disabled=false;
		document.getElementById("bio"+emp).disabled=false;
	}
}

function newEmp(emp)
{
	if(!document.getElementById('abrv'+emp).disabled)
	{
		document.getElementById("abrv"+emp).disabled=true;
		document.getElementById("pos"+emp).disabled=true;
		document.getElementById("name"+emp).disabled=true;
		document.getElementById("ext"+emp).disabled=true;
		document.getElementById("eml"+emp).disabled=true;
		document.getElementById("bio"+emp).disabled=true;
	}
	else
	{
		document.getElementById("abrv"+emp).disabled=false;
		document.getElementById("pos"+emp).disabled=false;
		document.getElementById("name"+emp).disabled=false;
		document.getElementById("ext"+emp).disabled=false;
		document.getElementById("eml"+emp).disabled=false;
		document.getElementById("bio"+emp).disabled=false;
	}
}
	
function killJob(job)
{
	if(!document.getElementById('job'+job).disabled)
	{
		document.getElementById("job"+job).disabled=true;
		document.getElementById("date"+job).disabled=true;
		document.getElementById("cat"+job).disabled=true;
		document.getElementById("rate"+job).disabled=true;
		document.getElementById("desc"+job).disabled=true;
		document.getElementById("req"+job).disabled=true;
	}
	else
	{
		document.getElementById("job"+job).disabled=false;
		document.getElementById("date"+job).disabled=false;
		document.getElementById("cat"+job).disabled=false;
		document.getElementById("rate"+job).disabled=false;
		document.getElementById("desc"+job).disabled=false;
		document.getElementById("req"+job).disabled=false;
	}
}

function newJob(job)
{
	if(!document.getElementById('job'+job).disabled)
	{
		document.getElementById("job"+job).disabled=true;
		document.getElementById("date"+job).disabled=true;
		document.getElementById("cat"+job).disabled=true;
		document.getElementById("rate"+job).disabled=true;
		document.getElementById("desc"+job).disabled=true;
		document.getElementById("req"+job).disabled=true;
	}
	else
	{
		document.getElementById("job"+job).disabled=false;
		document.getElementById("date"+job).disabled=false;
		document.getElementById("cat"+job).disabled=false;
		document.getElementById("rate"+job).disabled=false;
		document.getElementById("desc"+job).disabled=false;
		document.getElementById("req"+job).disabled=false;
	}
}


function showLarge()
{
    if(document.getElementById('img').alt == "AT&D")
		return;
	
	var myImage = new Image();
	myImage.src = currentLarge+bigCount+".jpg";
    
    var output = "<div style=\"height:100%; width:100%;\">";
    
    output += "<center><img src='" + currentLarge + bigCount + ".jpg' alt='Service Image" + 
                     "' style=\"margin:40px;\" /></center>";
    output += "<center><span style='color:gray'>&copy Allied Tool &amp; Die</span><br /><br />";
	output += "<input type='button' onclick='self.close();' value='Close Me!' /></center></div>";
     //building the new window
    newWin = window.open( "" ,"subwindow", "width='1800', height='1400', location=no, menubar=no, "  +
                "status=no, toolbar=no, scrollbars=yes, resizable=no");
    newWin.document.writeln(output);
    newWin.document.title="Image File";
	newWin.document.body.background = "images/bg1.jpg";
    newWin.resizeTo(850,750);
   
}
function newCaptcha()
{
	var datevar = new Date();
	timevar = datevar.getTime();
	document.getElementById('captchaIMG').src='CaptchaSecurityImages1.php?width=150&height=40&characters=6&time='+timevar;
}