var menu1 = new Array();
menu1[0] = "<div class=\"dropped\" onMouseOut=\"hideMenu();this.className='dropped'\" onMouseOver=\"clearInterval(mierda);this.className='dropped_over'\" onClick=\"parent.location='camera_repair.php'\">Camera Repair</div>";
menu1[1] = "<div class=\"dropped\" onMouseOut=\"hideMenu();this.className='dropped'\" onMouseOver=\"clearInterval(mierda);this.className='dropped_over'\" onClick=\"parent.location='dealer_partners.php'\">Dealer Partners</div>";
menu1[2] = "<div class=\"dropped\" onMouseOut=\"hideMenu();this.className='dropped'\" onMouseOver=\"clearInterval(mierda);this.className='dropped_over'\" onClick=\"parent.location='altlookup.php'\">Repair Status Login</div>";
menu1[3] = "<div class=\"dropped\" onMouseOut=\"hideMenu();this.className='dropped'\" onMouseOver=\"clearInterval(mierda);this.className='dropped_over'\" onClick=\"parent.location='test_instruments.php'\">Test Instruments</div>";
menu1[4] = "<div class=\"dropped\" onMouseOut=\"hideMenu();this.className='dropped'\" onMouseOver=\"clearInterval(mierda);this.className='dropped_over'\" onClick=\"parent.location='mercury_battery_adapters.php'\">Mercury Battery Adapters</div>";
menu1[5] = "<div class=\"dropped\" onMouseOut=\"hideMenu();this.className='dropped'\" onMouseOver=\"clearInterval(mierda);this.className='dropped_over'\" onClick=\"parent.location='third_party_logistics.php'\">Third Party Logistics</div>";
menu1[6] = "<div class=\"dropped\" onMouseOut=\"hideMenu();this.className='dropped'\" onMouseOver=\"clearInterval(mierda);this.className='dropped_over'\" onClick=\"parent.location='third_party_logistics_pentax.php'\">Pentax</div>";

var menu2 = new Array();
menu2[0] = "<div class=\"dropped\" onMouseOut=\"hideMenu();this.className='dropped'\" onMouseOver=\"clearInterval(mierda);this.className='dropped_over'\" onClick=\"parent.location='employment.php'\">Employment</div>";
menu2[1] = "<div class=\"dropped\" onMouseOut=\"hideMenu();this.className='dropped'\" onMouseOver=\"clearInterval(mierda);this.className='dropped_over'\" onClick=\"parent.location='cris_walk_through.php'\">CRIS Walk Through</div>";

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function showMenu(menuarr,xloc,yloc,id,what){
if(id == 'nav1'){
document.getElementById('nav3').src = 'images/top_navigation_03.png';
} else if(id == 'nav3'){
document.getElementById('nav1').src = 'images/top_navigation_01.png';
}
document.getElementById('dropdiv').innerHTML = menuarr.join("");
document.getElementById('dropdiv').innerHTML += "<div class=\"bottomnav\">&nbsp;</div>";
//place the menu
xoffset = getposOffset(what,"left");
xpos = xoffset+xloc;
yoffset = getposOffset(what,"top");
ypos = yoffset+yloc;
document.getElementById('dropdiv').style.top = ypos+"px";
document.getElementById('dropdiv').style.left = xpos+"px";
// make it visible 
document.getElementById('dropdiv').style.display = "block";
}
function hideMenu(){
mierda = setTimeout('killMenu()',500);
}
function killMenu(){
document.getElementById('dropdiv').style.display = "none";
document.getElementById('nav1').src = 'images/top_navigation_01.png';
document.getElementById('nav3').src = 'images/top_navigation_03.png';
}


// J. Ian Lindsay's additions below this line.
/********************************************/
	// Set nav classes in the DOM to reflect a menu change.
	function newActiveNav(ele){
		document.getElementById('nav0').setAttribute("class", "nav_element_inactive");
		document.getElementById('nav1').setAttribute("class", "nav_element_inactive");
		document.getElementById('nav2').setAttribute("class", "nav_element_inactive");
		document.getElementById('nav3').setAttribute("class", "nav_element_inactive");
		document.getElementById('nav4').setAttribute("class", "nav_element_inactive");
		document.getElementById(ele).setAttribute("class", "nav_element_active");
		return(0);
	}

	// Get the size of the client-side page.
	function getPageSize(){var c,a;if(window.innerHeight&&window.scrollMaxY){c=document.body.scrollWidth;a=window.innerHeight+window.scrollMaxY;}else{if(document.body.scrollHeight>document.body.offsetHeight){c=document.body.scrollWidth;a=document.body.scrollHeight;}else{c=document.body.offsetWidth;a=document.body.offsetHeight;}}var b,d;if(self.innerHeight){b=self.innerWidth;d=self.innerHeight;}else{if(document.documentElement&&document.documentElement.clientHeight){b=document.documentElement.clientWidth;d=document.documentElement.clientHeight;}else{if(document.body){b=document.body.clientWidth;d=document.body.clientHeight;}}}if(a<d){pageHeight=d;}else{pageHeight=a;}if(c<b){pageWidth=b;}else{pageWidth=c;}arrayPageSize=new Array(pageWidth,pageHeight,b,d);return arrayPageSize;}

	// Splits a string by another string and subtracts the delimiter.
	// Returns an array.
	function splitStringByString(working, delimiter){
		var output	= new Array();
		var delim_0	= working.indexOf(delimiter);
		while(delim_0 != -1){	// Loop until all input has been consumed.
	 		output.push(working.substr(0, delim_0));						// Save the substring.
	 		working	= working.substr(delim_0 + delimiter.length, working.length);	// Shave out the redundancy.
	 		delim_0	= working.indexOf(delimiter);
		}
		output.push(working);
		return(output);
	}
	
	
	// Pass this function a comma-delimited string with the IDs of all input elements in a form. It will then return a delimited string
	// intended to be passed as the parameter value for refreshContent().
	function packageFormByIds(fields){
		var	field_array	=	splitStringByString(fields,",");
		var	output		=	"";
		var	working;
		var	element;
		while(field_array.length > 0){
			working	=	field_array.shift();
			element	=	document.getElementById(working);
			if(element != null){	output	=	output + element.value;	}
			else{					output	=	output + " ";			}
			if(field_array.length != 0){	output	=	output + String.fromCharCode(1);	}
		}
		return(output);
	}


	// Open a beautiful pop-up element to ask the user something about his intentions.
	// Pass the markup for the content as the argument.
	function openPopupDiv(str){
		var	pageSize	=	getPageSize();
		var objOverlay = document.getElementById('overlay');
		var x = document.getElementById('popup_window');
		x.innerHTML	=	"<div class=\"popup_menu\"><div class=\"popup_menu_divider_left\"></div><div class=\"popup_menu_divider_right\"><a href=\"#\" onclick=\"closePopupDiv();\">Dismiss</a></div></div><div class=\"popup_content\" onclick=\"closePopupDiv();\" >" + str + "</div><div class=\"popup_menu\"><div class=\"popup_menu_divider_left\"></div><div class=\"popup_menu_divider_right\"><a href=\"#\" onclick=\"closePopupDiv();\">Dismiss</a></div></div>";
		x.setAttribute("class", "popup_active");
		objOverlay.style.height = (pageSize[1] + 'px');		// set height of Overlay to take up whole page and show
		objOverlay.style.display = 'block';
		return(0);
	}

		
	// Open a beautiful pop-up element to ask the user something about his intentions.
	function closePopupDiv(){
		var objOverlay = document.getElementById('overlay');
		var x = document.getElementById('popup_window');
		x.setAttribute("class", "popup_inactive");
		x.innerHTML	=	"";
		objOverlay.style.height = '0px';		// set height of Overlay to take up whole page and show
		objOverlay.style.display = 'none';
		return(0);
	}

// Opens the status definition popup.
function openStatusPopup(){
	var status_string	=	"<table width=\"100%\" border=\"1\" align=\"center\" cellpadding=\"5\" cellspacing=\"0\"> <tr> <td valign=\"top\"><strong>Status</strong></td> <td><strong>Definition</strong></td> </tr> <tr> <td valign=\"top\">Received</td> <td>The repair item has been received at our location and is awaiting inspection.</td> </tr> <tr> <td valign=\"top\">Processing</td> <td>The repair item is under special evaluation.</td> </tr> <tr> <td valign=\"top\">With Estimator</td> <td>The repair item is in line for examination or with an estimating technician.</td> </tr> <tr> <td valign=\"top\">In Repair</td> <td>The repair item is either in line for repair or assigned to a technician.</td> </tr> <tr> <td valign=\"top\">Parts Hold</td> <td>Parts are on order from the manufacturer.</td> </tr> <tr> <td valign=\"top\">Parts Hold Back Order</td> <td>Parts are on order to the manufacturer and the manufacturer is waiting for delivery from the factory.</td> </tr> <tr> <td valign=\"top\">Quality Assurance</td> <td>The repair item is in the quality assurance department. It is in line for examination or with a QA technician.</td> </tr> <tr> <td valign=\"top\">Process Hold</td> <td>The repair item is under special evaluation.</td> </tr> <tr> <td valign=\"top\">Repair Completed</td> <td>The repair has been completed.</td> </tr> <tr> <td valign=\"top\">Shipped</td> <td>The repair is ready to be shipped. When the tracking number appears, the repair item has been shipped from our location.</td> </tr> <tr> <td valign=\"top\">Service Warranty Analysis</td> <td>Repair item under evaluation.</td> </tr> <tr> <td valign=\"top\">Research</td> <td>Validation of warranty coverage.</td> </tr> <tr> <td valign=\"top\">Requires Attention</td> <td>Contact customer service.</td> </tr> <tr> <td valign=\"top\">Pending Delivery</td> <td>Repair item has been submitted via the website but has not arrived at our location.</td> </tr> </table>";
	openPopupDiv(status_string);
	return(0);
}

	// This object Holds responses from PHP so that the javascript can attend to them
	// at it's own pace. This is the point of entry from all responses from PHP.
	// PHP will send a packet in the following format:
	// <id>(ID-DELIM)<class>
	// <id> is the randomly generated ID for this request. Ideally, it would be matched against an array
	//        of pending requests, but as of 03.24.2008 it does not yet do this.
	// <class> is the same as the resp_class argument passed to this function. It isn't important until directPackets().
	function PHPResponse(route, str, param){
		this.xmlHttp	= GetXmlHttpObject();		// The return variable for PHP.
		this.rnd_id	= Math.random();				// The unique id for this response.
		this.url="io_port.php"+"?request="+Base64.encode(str)+"&parameter="+Base64.encode(param)+"&route="+Base64.encode(route);	// Build the URL.
		this.url=this.url+"&req_id="+this.rnd_id;
		var this_obj = this;
		this.xmlHttp.onreadystatechange = function(){
			if (this_obj.xmlHttp.readyState==4 || this_obj.xmlHttp.readyState=="complete"){ 
				directPackets(this_obj.xmlHttp.responseText);
		 		this.xmlHttp	= "";
			}
		}
		this.xmlHttp.open("GET",this.url,true);
		this.xmlHttp.send(null);
	}


	// refreshContent() is the entrance to the main conduit between the 
	// route, request, parameter
	function refreshContent(route, request, parm){
		var x = new PHPResponse(route, request, parm);
		return(0);
	} 


	// Opens the call to PHP to retrieve data.
	function GetXmlHttpObject(){
		var xmlHttp=null;
		try{ 		xmlHttp=new XMLHttpRequest();	}	// Firefox, Opera 8.0+, Safari
		catch (e){
	 		try{	xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");		}	// For IE
			catch (e){	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }
		}
		return xmlHttp;
	}

	// Responsible for pulling the router value from the front of the packets (however many there happen to be)
	// and using it to direct the packet data accordingly.
	function directPackets(mass_of_packets){
		var temp	= splitStringByString(mass_of_packets, "(ID-ROUTE)");
		var route;
		var parsed_packet;
		while(temp.length > 1){
			route		= temp.shift();
			parsed_packet	= splitStringByString(temp.shift(), "(ID-DELIM)");

	 		if(route == "0"){		alert("Packet_type=0");	}
	 		else if(route == "1"){
		 		var x = document.getElementById(parsed_packet[2]);
				if(x != null){
					var scroll_parm1	=	0;
		 			if((x.clientHeight + x.scrollTop + 10) > x.scrollHeight ){	scroll_parm1 = 1;	}		// Should we scroll the window?
			 		if(parsed_packet[2].substr(parsed_packet[2].length-8, parsed_packet[2].length) == "_console"){
			 			x.innerHTML	=	x.innerHTML + parsed_packet[1];
			 			if(scroll_parm1 == 1){	x.scrollTop = x.scrollHeight;	}
			 		}
			 		else{	x.innerHTML	=	parsed_packet[1];	}
			 	}
		 	}
		 	else if(route == "2"){
				if(parsed_packet[2] == 0){	closePopupDiv();					}
				else{						openPopupDiv(parsed_packet[1]);		}
		 	}
		 	else if(route == "3"){	alert("Packet_type=3");	}
		 	else if(route == "4"){	alert("Packet_type=4");	}
		 }
		 return(0);
	}

	// Called upon load to move content to a place that a human user would want to see it.
	function copyTextBlocks(){
		var src		=	document.getElementById('force_locus0');
		var	target	=	document.getElementById('text_body');
		target.innerHTML	=	src.innerHTML;
	}

/***************************************************************
Base64 encode / decode
MD5 (Message-Digest Algorithm)
http://www.webtoolkit.info/
*
Usage:
Base64.encode(string)
Base64.decode(string)
MD5(string)
***************************************************************/
var MD5=function(s){function L(b,a){return(b<<a)|(b>>>(32-a))}function K(k,b){var F,a,d,x,c;d=(k&2147483648);x=(b&2147483648);F=(k&1073741824);a=(b&1073741824);c=(k&1073741823)+(b&1073741823);if(F&a){return(c^2147483648^d^x)}if(F|a){if(c&1073741824){return(c^3221225472^d^x)}else{return(c^1073741824^d^x)}}else{return(c^d^x)}}function r(a,c,b){return(a&c)|((~a)&b)}function q(a,c,b){return(a&b)|(c&(~b))}function p(a,c,b){return(a^c^b)}function n(a,c,b){return(c^(a|(~b)))}function u(G,F,aa,Z,k,H,I){G=K(G,K(K(r(F,aa,Z),k),I));return K(L(G,H),F)}function f(G,F,aa,Z,k,H,I){G=K(G,K(K(q(F,aa,Z),k),I));return K(L(G,H),F)}function D(G,F,aa,Z,k,H,I){G=K(G,K(K(p(F,aa,Z),k),I));return K(L(G,H),F)}function t(G,F,aa,Z,k,H,I){G=K(G,K(K(n(F,aa,Z),k),I));return K(L(G,H),F)}function e(k){var G;var d=k.length;var c=d+8;var b=(c-(c%64))/64;var F=(b+1)*16;var H=Array(F-1);var a=0;var x=0;while(x<d){G=(x-(x%4))/4;a=(x%4)*8;H[G]=(H[G]|(k.charCodeAt(x)<<a));x++}G=(x-(x%4))/4;a=(x%4)*8;H[G]=H[G]|(128<<a);H[F-2]=d<<3;H[F-1]=d>>>29;return H}function B(c){var b="",d="",k,a;for(a=0;a<=3;a++){k=(c>>>(a*8))&255;d="0"+k.toString(16);b=b+d.substr(d.length-2,2)}return b}function J(b){b=b.replace(/\r\n/g,"\n");var a="";for(var k=0;k<b.length;k++){var d=b.charCodeAt(k);if(d<128){a+=String.fromCharCode(d)}else{if((d>127)&&(d<2048)){a+=String.fromCharCode((d>>6)|192);a+=String.fromCharCode((d&63)|128)}else{a+=String.fromCharCode((d>>12)|224);a+=String.fromCharCode(((d>>6)&63)|128);a+=String.fromCharCode((d&63)|128)}}}return a}var C=Array();var P,h,E,v,g,Y,X,W,V;var S=7,Q=12,N=17,M=22;var A=5,z=9,y=14,w=20;var o=4,m=11,l=16,j=23;var U=6,T=10,R=15,O=21;s=J(s);C=e(s);Y=1732584193;X=4023233417;W=2562383102;V=271733878;for(P=0;P<C.length;P+=16){h=Y;E=X;v=W;g=V;Y=u(Y,X,W,V,C[P+0],S,3614090360);V=u(V,Y,X,W,C[P+1],Q,3905402710);W=u(W,V,Y,X,C[P+2],N,606105819);X=u(X,W,V,Y,C[P+3],M,3250441966);Y=u(Y,X,W,V,C[P+4],S,4118548399);V=u(V,Y,X,W,C[P+5],Q,1200080426);W=u(W,V,Y,X,C[P+6],N,2821735955);X=u(X,W,V,Y,C[P+7],M,4249261313);Y=u(Y,X,W,V,C[P+8],S,1770035416);V=u(V,Y,X,W,C[P+9],Q,2336552879);W=u(W,V,Y,X,C[P+10],N,4294925233);X=u(X,W,V,Y,C[P+11],M,2304563134);Y=u(Y,X,W,V,C[P+12],S,1804603682);V=u(V,Y,X,W,C[P+13],Q,4254626195);W=u(W,V,Y,X,C[P+14],N,2792965006);X=u(X,W,V,Y,C[P+15],M,1236535329);Y=f(Y,X,W,V,C[P+1],A,4129170786);V=f(V,Y,X,W,C[P+6],z,3225465664);W=f(W,V,Y,X,C[P+11],y,643717713);X=f(X,W,V,Y,C[P+0],w,3921069994);Y=f(Y,X,W,V,C[P+5],A,3593408605);V=f(V,Y,X,W,C[P+10],z,38016083);W=f(W,V,Y,X,C[P+15],y,3634488961);X=f(X,W,V,Y,C[P+4],w,3889429448);Y=f(Y,X,W,V,C[P+9],A,568446438);V=f(V,Y,X,W,C[P+14],z,3275163606);W=f(W,V,Y,X,C[P+3],y,4107603335);X=f(X,W,V,Y,C[P+8],w,1163531501);Y=f(Y,X,W,V,C[P+13],A,2850285829);V=f(V,Y,X,W,C[P+2],z,4243563512);W=f(W,V,Y,X,C[P+7],y,1735328473);X=f(X,W,V,Y,C[P+12],w,2368359562);Y=D(Y,X,W,V,C[P+5],o,4294588738);V=D(V,Y,X,W,C[P+8],m,2272392833);W=D(W,V,Y,X,C[P+11],l,1839030562);X=D(X,W,V,Y,C[P+14],j,4259657740);Y=D(Y,X,W,V,C[P+1],o,2763975236);V=D(V,Y,X,W,C[P+4],m,1272893353);W=D(W,V,Y,X,C[P+7],l,4139469664);X=D(X,W,V,Y,C[P+10],j,3200236656);Y=D(Y,X,W,V,C[P+13],o,681279174);V=D(V,Y,X,W,C[P+0],m,3936430074);W=D(W,V,Y,X,C[P+3],l,3572445317);X=D(X,W,V,Y,C[P+6],j,76029189);Y=D(Y,X,W,V,C[P+9],o,3654602809);V=D(V,Y,X,W,C[P+12],m,3873151461);W=D(W,V,Y,X,C[P+15],l,530742520);X=D(X,W,V,Y,C[P+2],j,3299628645);Y=t(Y,X,W,V,C[P+0],U,4096336452);V=t(V,Y,X,W,C[P+7],T,1126891415);W=t(W,V,Y,X,C[P+14],R,2878612391);X=t(X,W,V,Y,C[P+5],O,4237533241);Y=t(Y,X,W,V,C[P+12],U,1700485571);V=t(V,Y,X,W,C[P+3],T,2399980690);W=t(W,V,Y,X,C[P+10],R,4293915773);X=t(X,W,V,Y,C[P+1],O,2240044497);Y=t(Y,X,W,V,C[P+8],U,1873313359);V=t(V,Y,X,W,C[P+15],T,4264355552);W=t(W,V,Y,X,C[P+6],R,2734768916);X=t(X,W,V,Y,C[P+13],O,1309151649);Y=t(Y,X,W,V,C[P+4],U,4149444226);V=t(V,Y,X,W,C[P+11],T,3174756917);W=t(W,V,Y,X,C[P+2],R,718787259);X=t(X,W,V,Y,C[P+9],O,3951481745);Y=K(Y,h);X=K(X,E);W=K(W,v);V=K(V,g)}var i=B(Y)+B(X)+B(W)+B(V);return i.toLowerCase()};var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(c){var a="";var k,h,f,j,g,e,d;var b=0;c=Base64._utf8_encode(c);while(b<c.length){k=c.charCodeAt(b++);h=c.charCodeAt(b++);f=c.charCodeAt(b++);j=k>>2;g=((k&3)<<4)|(h>>4);e=((h&15)<<2)|(f>>6);d=f&63;if(isNaN(h)){e=d=64}else{if(isNaN(f)){d=64}}a=a+this._keyStr.charAt(j)+this._keyStr.charAt(g)+this._keyStr.charAt(e)+this._keyStr.charAt(d)}return a},decode:function(c){var a="";var k,h,f;var j,g,e,d;var b=0;c=c.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(b<c.length){j=this._keyStr.indexOf(c.charAt(b++));g=this._keyStr.indexOf(c.charAt(b++));e=this._keyStr.indexOf(c.charAt(b++));d=this._keyStr.indexOf(c.charAt(b++));k=(j<<2)|(g>>4);h=((g&15)<<4)|(e>>2);f=((e&3)<<6)|d;a=a+String.fromCharCode(k);if(e!=64){a=a+String.fromCharCode(h)}if(d!=64){a=a+String.fromCharCode(f)}}a=Base64._utf8_decode(a);return a},_utf8_encode:function(b){b=b.replace(/\r\n/g,"\n");var a="";for(var e=0;e<b.length;e++){var d=b.charCodeAt(e);if(d<128){a+=String.fromCharCode(d)}else{if((d>127)&&(d<2048)){a+=String.fromCharCode((d>>6)|192);a+=String.fromCharCode((d&63)|128)}else{a+=String.fromCharCode((d>>12)|224);a+=String.fromCharCode(((d>>6)&63)|128);a+=String.fromCharCode((d&63)|128)}}}return a},_utf8_decode:function(a){var b="";var d=0;var e=c1=c2=0;while(d<a.length){e=a.charCodeAt(d);if(e<128){b+=String.fromCharCode(e);d++}else{if((e>191)&&(e<224)){c2=a.charCodeAt(d+1);b+=String.fromCharCode(((e&31)<<6)|(c2&63));d+=2}else{c2=a.charCodeAt(d+1);c3=a.charCodeAt(d+2);b+=String.fromCharCode(((e&15)<<12)|((c2&63)<<6)|(c3&63));d+=3}}}return b}};

/********************************************/
// J. Ian Lindsay's additions end here.



//google tracking.  don't touch me
// ---Haha! Sorry, Treads.
//          -Ian 2010.08.08
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-69675-1']);
_gaq.push(['_trackPageview']);

(function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
