// ********  determining server/directory path  *****************

//Added by UP on 09 Oct 06
var Val1, Val2, Val3, Val4, Val5, Val6;

//Global Variables
var exp;
var jspPath = '';
var htmlPath = '';
//assign the current url to a variable
var currPath = location.href;
// ********  creating dropdown nav  *****************
// Global Vars for nav
// initialize and give default values for dropdown menu color variables
var background = "#FFFFFF";
var bgcolor = "#FFFFFF";
var border_color = "#000000";
var menu_border = "#000000";
var hovercolor = "#FEE485";
var dividercolor = "#black";

// Simple Browser Check
var ie = "Microsoft Internet Explorer";
var netscape = "Netscape";
var mac = "MacPPC"
var browser = navigator.appName;
var os = navigator.platform;

var No3 = (parseInt(navigator.appVersion) > 3) ? 1:0;

if (navigator.userAgent == 'Mozilla/4.0 (compatible; MSIE 4.5; Mac_PowerPC)') { 
	No3 = 0; 
}
var layer = (document.getElementById && No3) ? "document.getElementById('L'+menu).style" : (document.all) ? "document.all['L'+menu].style" : (document.layers && No3) ? "document.layers['L'+menu]": 0;
var hideMe = (document.all || document.getElementById) ? "hidden" : "hide";
var showMe = (document.all || document.getElementById) ? "visible" : "show";
var timer;

if (document.layers && No3) {

	document.write('<style>.navdown {color:#ffffff; font-size:11px; font-family:Arial; font-weight:bolder; text-decoration:none; padding-bottom : 3;	padding-top : 3;}</style>');
	
	document.write('<style>.navind {color:#ffffff; font-size:11px; font-family:Arial; font-weight:bolder; text-decoration:none; padding-bottom : 3;	padding-top : 3;}</style>');
}
//////////////////////////////////////////////

/*	Create Your layers below by typing:
	 Layer[incrementing number] = new LayerSpecs(Left Position, Top Position, Width, cell background color, cell hover color, cell divider color, List of Links Seperated by Commas)
*/

Layer = new Array();
//Resolution Support
if(screen.width=="800"){
	Val1="120"
	Val2="120"
	Val3="268"
	Val4="332"
	Val5="422"
	Val6="507"
}
if(screen.width=="1024"){
	Val1="232"
	Val2="232"
	Val3="380"
	Val4="442"
	Val5="534"
	Val6="617"
}
if(screen.width=="1152"){
	Val1="298"
	Val2="298"
	Val3="445"
	Val4="506"
	Val5="598"
	Val6="682"
}
if(screen.width=="1280"){
	Val1="360"
	Val2="360"
	Val3="508"
	Val4="570"
	Val5="663"
	Val6="747"
}
if(screen.width=="1440"){
	Val1="420"
	Val2="420"
	Val3="587"
	Val4="649"
	Val5="743"
	Val6="826"
}

Layer[1] = new LayerSpecs(Val1,212,230,'#FFFFFF','#FEE485','#000000',
	'<a style="text-decoration:none" href="'+ htmlPath +'asd_breakstem.asp" class="smalllink">&nbsp;&nbsp;Breakstem Fastening Systems</a>',
	'<a style="text-decoration:none" href="'+ htmlPath +'asd_tifs.asp" class="smalllink">&nbsp;&nbsp;Threaded Insert Fastening Systems</a>',
	'<a style="text-decoration:none" href="'+ htmlPath +'asd_srfs.asp" class="smalllink">&nbsp;&nbsp;Speed Riveting Fastening Systems</a>',
	'<a style="text-decoration:none" href="'+ htmlPath +'asd_abf.asp" class="smalllink">&nbsp;&nbsp;Adhesive Bonded Fasteners</a>',
	'<a style="text-decoration:none" href="'+ htmlPath +'asd_hfs.asp" class="smalllink">&nbsp;&nbsp;Helicoil Fastening Systems</a>',
	'<a style="text-decoration:none" href="'+ htmlPath +'asd_sr.asp" class="smalllink">&nbsp;&nbsp;Solid Rivets</a>',
	'<a style="text-decoration:none" href="'+ htmlPath +'asd_aqnb.asp" class="smalllink">&nbsp;&nbsp;Aerospace Quality Nuts & Bolts</a>',
	'<a style="text-decoration:none" href="'+ htmlPath +'asd_mccs.asp" class="smalllink">&nbsp;&nbsp;Mechanical Cable Control Systems</a>',
	'<a style="text-decoration:none" href="'+ htmlPath +'asd_ep.asp" class="smalllink">&nbsp;&nbsp;Electrical Products</a>',
	'<a style="text-decoration:none" href="'+ htmlPath +'asd_tlss.asp" class="smalllink">&nbsp;&nbsp;Thread Locking & Security Systems</a>');

Layer[2] = new LayerSpecs(Val2,262,230,'#FFFFFF','#FEE485','#000000',
	'<a style="text-decoration:none" href="'+ htmlPath +'#" class="smalllink">&nbsp;&nbsp;Breakstem Fastening Systems</a>',
	'<a style="text-decoration:none" href="'+ htmlPath +'#" class="smalllink">&nbsp;&nbsp;Structural Fastening Systems</a>',
	'<a style="text-decoration:none" href="'+ htmlPath +'#" class="smalllink">&nbsp;&nbsp;Threaded Insert Fastening Systems</a>',
	'<a style="text-decoration:none" href="'+ htmlPath +'#" class="smalllink">&nbsp;&nbsp;Speed Riveting Fastening Systems</a>',
	'<a style="text-decoration:none" href="'+ htmlPath +'#" class="smalllink">&nbsp;&nbsp;Helicoil Fastening Systems</a>',
	'<a style="text-decoration:none" href="'+ htmlPath +'#" class="smalllink">&nbsp;&nbsp;Inserts for Plastics</a>',
	'<a style="text-decoration:none" href="'+ htmlPath +'#" class="smalllink">&nbsp;&nbsp;Steel Metal Fasteners (Clinching or Riveting)</a>',
	'<a style="text-decoration:none" href="'+ htmlPath +'#" class="smalllink">&nbsp;&nbsp;Direct Screw Fixing</a>',
	'<a style="text-decoration:none" href="'+ htmlPath +'#" class="smalllink">&nbsp;&nbsp;Spring Steel & Special Components</a>');

// Loop to create master nav table(ie/nn6) or layer(nn4.x)
for(i=1; i<Layer.length; i++) {
	// imgHilite returns the image name to the mouseover/mouseoff function in rollover.js 
	//var imgHilite = rollArray[(i-1)].name;
	
	if (document.getElementById && No3) { 
		document.write
		('<div onMouseOver="clearTimeout(timer)" onMouseOut="Hide('+i+')" ID="L'+i+'" STYLE="position:absolute; visibility:hidden; background:'+background+'; top:'+Layer[i].top+'; left:'+Layer[i].left+';"><table border="0" bordercolor="#ff0000" cellpadding="0" cellspacing="0">'+Layer[i].info+'</TABLE></div>'); 
	} else if (document.all && No3) {
		document.write('<SPAN onMouseOver="clearTimeout(timer);" onMouseOut="Hide('+i+')" ID="L'+i+'" STYLE="position:absolute; visibility:hidden; background:'+background+'; top:'+Layer[i].top+'; left:'+Layer[i].left+';"><table border="0" bordercolor="#ffffff" cellpadding="0" cellspacing="0" bgcolor="#ffffff">'+Layer[i].info+'</TABLE></SPAN>'); 
	} else if (document.layers && No3) {
		document.write('<LAYER onMouseOver="clearTimeout(timer);" onMouseOut="Hide('+i+');" ID="L'+i+'" VISIBILITY="hide" position="absolute" TOP="'+Layer[i].top+'" LEFT="'+Layer[i].left+'">'+Layer[i].info+'</LAYER>'); 
	}
}

function Show(menuNumber) {

	if(timer) { 
		clearTimeout(timer); 
	}
	for(menu=0; menu < Layer.length; menu++) {
		if(Layer[menu]) {
			eval(layer).visibility = hideMe; 
		} 
	}
	if (menuNumber > 0){
		var menu = menuNumber;
		eval(layer).visibility = showMe;
	}
}

function Hide(menuNumber) { timer = setTimeout("Show(0)", 200); }

function LayerSpecs(Left,Top,Width,bgcolor,hovercolor,dividercolor) { 
	if(No3) {
		if (document.getElementById && document.all) {
			if (homePage=="yes") {
				this.left = Left;
				this.top = Top;
			} else {
				this.left = parseInt(Left) + 10;
				this.top = parseInt(Top) - 5;
			}
		} else if (document.getElementById && navigator.userAgent.indexOf('Gecko')) {
			if (homePage=="yes") {
				this.left = Left;
				this.top = Top;
			} else {
				this.left = parseInt(Left) + 8;
				this.top = parseInt(Top) - 12;
			}
		} else if (document.all) {
			if (homePage=="yes") {
				this.left = Left;
				this.top = Top;
			} else {
				this.left = parseInt(Left) + 10;
				this.top = parseInt(Top) - 5;
			}
		} else if (document.layers) { 
			// Width = Width + 10;
			if (homePage=="yes") {
				this.left = parseInt(Left) + 0;
				this.top = parseInt(Top) - 1;
			} else {
				this.left = parseInt(Left) + 8;
				this.top = parseInt(Top) - 13;
			}
		} 
		
		this.info  = "";
		
		// initialize layer position for NN4.x
		var T = 0;
				
		// Loop to populate master nav table/layer with content
		for(i=6; i<arguments.length; i++) {
			
			// check for 2 lines of content within layer and offset accordingly
			if( arguments[i].indexOf('<br>&nbsp;') != -1 ){
				var addOffset = 0; //13;
			} else {
				var addOffset = 0;
			}
			
			// calculates table cell height for NN6 & IE
			var cellheight = 20 + addOffset;

			if (document.all){ 
				this.info += '<tr bgcolor="'+bgcolor+'" onMouseOver="this.bgColor=\''+hovercolor+'\';return true;" onMouseOut="this.bgColor=\''+bgcolor+'\';return true;"><TD WIDTH="'+Width+'" height="'+cellheight+'"><span style="line-height:103%;">'+arguments[i]+'</span></TD></TR><tr><td bgcolor="'+dividercolor+'"><img src="../images/spacer.gif" width="'+Width+'" height="1" border="0" alt=""></td></tr>'; 
			} else if (document.getElementById){ 
				this.info += '<tr bgcolor="'+bgcolor+'" onMouseOver="this.bgColor=\''+hovercolor+'\';return true;" onMouseOut="this.bgColor=\''+bgcolor+'\';return true;"><TD WIDTH="'+Width+'" height="'+cellheight+'">'+arguments[i]+'</TD></TR><tr><td bgcolor="'+dividercolor+'"><img src="../images/spacer.gif" width="'+Width+'" height="1" border="0" alt=""></td></tr>'; 
			} else if (document.layers){ 
				this.info += '<LAYER position="absolute" bgcolor="'+bgcolor+'" onMouseOver="this.bgColor=\''+hovercolor+'\';return true;" onMouseOut="this.bgColor=\''+bgcolor+'\';return true;" WIDTH="'+Width+'" TOP="'+T+'"><img src="../images/spacer_orange.gif" width="'+Width+'" height="1" border="0" alt=""><br>'+arguments[i]+'</LAYER><BR>'; 
			}
			
		// increment layer position for NN4.x
		T += 17 +addOffset;
		}
	} 
}
/* This function is for static links */
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function Fav(){
		if(navigator.appName=="Netscape"){
			window.sidebar.addPanel(document.title, location.href,"")
		}
		else {
			window.external.AddFavorite(location.href,document.title)
		}
	}
	NS4 = (document.layers);
     IE4 = (document.all);
    ver4 = (NS4 || IE4);   
   isMac = (navigator.appVersion.indexOf("Mac") != -1);
  isMenu = (NS4 || (IE4 && !isMac));
function popUp(){return};
function popDown(){return};
function startIt(){return}
if (!ver4) event=null;

function MM_openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);

}
function Validate(frm){
	if(frm.Name.value==""){
		alert("Name cannot be left blank")
		frm.Name.focus();
		return false;
	}
	if(frm.HPhone.value==""){
		alert("Home Phone cannot be left blank")
		frm.HPhone.focus();
		return false;
	}
	if(frm.Email.value==""){
		alert("E-Mail cannot be left blank")
		frm.Email.focus();
		return false;
	}
	if(frm.Email.value!=""){
		var checkStrValue = frm.Email.value;
		var goodEmail = checkStrValue.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		if (!goodEmail) {
			alert("The \"email\" field must contain a valid address. eg: john@aaacandlesupply.com");
			frm.Email.select();
			frm.Email.focus();
			return false;
		}
	}
}
