/*
Description: Allied Minds
Author: Barnum Design
*/

function TopNav() {
TopNv = document.getElementById('TopNav');
TopNv_mask = document.getElementById('TopNav_mask');
var Main_LI_Array = TopNv.getElementsByTagName('ul')[0].childNodes;
	for (var a=0; a<Main_LI_Array.length; a++) {
	Main_LI_Array[a].className = ('dynMenu_TopNav_main');
	TopNv_mask.style.height = TopNv.offsetHeight + "px";
	var Main_Link_ArrayHit = Main_LI_Array[a].firstChild;
	Main_Link_ArrayHit.onmouseover = function Main_Link_ArrayHit_Over(e) {
		if (!e) e = window.event;
		var SrcElement = (window.event) ? e.srcElement : e.target;
		for (var b=0; b<Main_LI_Array.length; b++) {
		Main_LI_Array[b].firstChild.style.cssText = "color:#fbfbfb;";
			if (Main_LI_Array[b].firstChild.nextSibling) {
			Main_LI_Array[b].firstChild.nextSibling.style.display = "none";
			}
			if (SrcElement.nextSibling) {
			SrcElement.nextSibling.style.display = "block";
			}
		SrcElement.style.cssText = "color:#8fbbd5;";
		}
	}
		if (Main_Link_ArrayHit.nextSibling) {
    var Sub1_LI_Array = Main_Link_ArrayHit.nextSibling.childNodes;
		  for (var c=0; c<Sub1_LI_Array.length; c++) {
		  Sub1_LI_Array[c].className = ('dynMenu_TopNav_sub1');
		  Main_Link_ArrayHit.nextSibling.lastChild.className = ('dynMenu_TopNav_sub1_mask');
		  var Sub1_Link_ArrayHit = Sub1_LI_Array[c].firstChild;
			 if (Main_Link_ArrayHit.href.split('/')[3] == Loc.split('/')[3]) {
			 Main_Link_ArrayHit.style.cssText = "color:#8fbbd5;";
			 Main_Link_ArrayHit.nextSibling.style.display = "block";
				if (Sub1_Link_ArrayHit.href.split('/')[4] == Loc.split('/')[4]) {
				Sub1_Link_ArrayHit.style.cssText = "color:#8fbbd5;";
				}
			}
		}
	}
	else if (Main_Link_ArrayHit.href.split('/')[3] == Loc.split('/')[3]) {
			 Main_Link_ArrayHit.style.cssText = "color:#8fbbd5;";
	}
}
}

function LeftNav() {
LeftNv = document.getElementById('LeftNav');
LeftNv_mask = document.getElementById('LeftNav_mask');
LeftNv_hld = document.getElementById('LeftNav_holder');
LeftNv_hld_mask = document.getElementById('LeftNav_holder_mask');
var Main_LI_Array = LeftNv.getElementsByTagName('ul')[0].childNodes;
	for (var a=0; a<Main_LI_Array.length; a++) {
	Main_LI_Array[a].className = ('dynMenu_LeftNav_main');
	var Main_Link_ArrayHit = Main_LI_Array[a].firstChild;
	var MainL = Main_Link_ArrayHit.href;
		if (((MainL.split('/')[4] == Loc.split('/')[4]) || (Loc.substring(Loc.lastIndexOf("/") + 1, 63) == "Default.aspx?PageID=1055301" && MainL.substring(MainL.lastIndexOf("/") + 1, MainL.length) == "Home.htm") || (Loc.split('/')[3] == MainL.split('/')[3])) && (Loc.split('/')[4] != "index.htm" || Loc.split('/')[3] == "Portfolio") && Loc.substring(Loc.lastIndexOf("/") + 1, Loc.length) != "Access_Request.htm"
&& Loc.substring(Loc.lastIndexOf("/") + 1, Loc.length) != "Password_Retrieve.htm") {
		LeftNv_hld.style.visibility = "hidden";
		LeftNv_hld_mask.style.visibility = "hidden";
    LeftNv.style.visibility = "visible";
		LeftNv_mask.style.visibility = "visible";
		Main_LI_Array[a].style.display = "block";
			if (Main_Link_ArrayHit.nextSibling) {
			Main_Link_ArrayHit.nextSibling.style.display = "block";
			var Sub1_LI_Array = Main_Link_ArrayHit.nextSibling.childNodes;
        for (var b=0; b<Sub1_LI_Array.length; b++) {
        Sub1_LI_Array[b].className += (' dynMenu_LeftNav_sub1');
        var Sub1_Link_ArrayHit = Sub1_LI_Array[b].firstChild;
        var Sub1L =  Sub1_Link_ArrayHit.href;
          if ((Sub1L.split('/')[5] == Loc.split('/')[5] && Sub1L.split('/')[5] != "index.htm") || Loc.substring((Loc.indexOf("/",Loc.indexOf("/") + 3 )) + 1,Loc.lastIndexOf("/")) == Sub1L.substring((Sub1L.indexOf("/",Sub1L.indexOf("/") + 3 )) + 1,Sub1L.lastIndexOf("/"))) {
          Sub1_Link_ArrayHit.style.cssText = "color:#8fbbd5; text-transform:uppercase;";
          Sub1_Link_ArrayHit.innerHTML = Sub1_Link_ArrayHit.innerHTML.substring(2,Sub1_Link_ArrayHit.innerHTML.length);
						if (Sub1_Link_ArrayHit.nextSibling) {
			      Subsid_LI_Array = Main_LI_Array[0].childNodes[1].childNodes;
			       	for (var d=0; d<Subsid_LI_Array.length; d++) {
			       	Subsid_LI_Array[d].style.display = "none";
			       	}
						Sub1_Link_ArrayHit.parentNode.style.display = "block";
						Sub1_Link_ArrayHit.nextSibling.style.display = "block";
						var Sub2_LI_Array = Sub1_Link_ArrayHit.nextSibling.childNodes;
							for (var c=0; c<Sub2_LI_Array.length; c++) {
							Sub2_LI_Array[c].className = ('dynMenu_LeftNav_sub2');
							var Sub2_Link_ArrayHit = Sub2_LI_Array[c].firstChild;
								if (Sub2_Link_ArrayHit.href == Loc) {
								Sub2_Link_ArrayHit.style.cssText = "color:#8fbbd5;";
								}
							}
						}
					}
				}
			}
		}
	}
LeftNv_mask.style.height = LeftNv.offsetHeight + "px";
}

function FooterNav() {
FooterNv = document.getElementById('FooterNav');
var Main_LI_Array = FooterNv.getElementsByTagName('ul')[0].childNodes;
	for (var a=0; a<Main_LI_Array.length; a++) {
	Main_LI_Array[a].className = ('dynMenu_FooterNav_main');
	var Main_Link_ArrayHit = Main_LI_Array[a].firstChild;
    if (Main_Link_ArrayHit.href.split('/')[3] == Loc.split('/')[3]) {
		Main_Link_ArrayHit.style.cssText = "color:#8fbbd5;";
		}
	}
}

function TopBanner() { 
Banner_A = document.getElementById('TopBanner_A');
Banner_B = document.getElementById('TopBanner_B');
Banner_C = document.getElementById('TopBanner_C');
Banner_A.src =  "/Images/Banner_" +(Loc.split('/')[3])+ "_A.jpg";
Banner_B.src =  "/Images/Banner_" +(Loc.split('/')[3])+ "_B.jpg";
Banner_C.src =  "/Images/Banner_" +(Loc.split('/')[3])+ "_C.jpg";
  if(Loc.split('/')[5] != null) {
    if(Loc.split('/')[3] == "Extranet" || "Portfolio") {
    Banner_A.src =  "/Images/Companies/Banner_" +(Loc.split('/')[4])+ "_A.jpg";
    Banner_B.src =  "/Images/Companies/Banner_" +(Loc.split('/')[4])+ "_B.jpg";
    Banner_C.src =  "/Images/Companies/Banner_" +(Loc.split('/')[4])+ "_C.jpg";
    }
    else {
    Banner_A.src =  "/Images/Banner_" +(Loc.split('/')[4])+ "_A.jpg";
    Banner_B.src =  "/Images/Banner_" +(Loc.split('/')[4])+ "_B.jpg";
    Banner_C.src =  "/Images/Banner_" +(Loc.split('/')[4])+ "_C.jpg";
    }
  }
  setTimeout("TopBanner_Reset()",0550);
}

function TopBanner_Reset(){
  if (Banner_A.offsetHeight < 40) {
  Banner_A.src = "/Images/Banner_Home_A.jpg";
  Banner_B.src = "/Images/Banner_Home_B.jpg";
  Banner_C.src = "/Images/Banner_Home_C.jpg";
  }
  setTimeout("TopBanner_Reveal()",0500);
}

function TopBanner_Reveal() {
    Banner_A.style.visibility = "visible";
    Banner_B.style.visibility = "visible";
    Banner_C.style.visibility = "visible";
}

function RightRotator() {
var Rotator = new Array() 

Rotator[0] = "AXI_Swap.htm";
Rotator[1] = "BA_Logix_Swap.htm";
Rotator[2] = "BioTectix_Swap.htm";
Rotator[3] = "Cephalogics_Swap.htm";
Rotator[4] = "CryoXtract_Swap.htm";
Rotator[5] = "GliaGen_Swap.htm";
Rotator[6] = "Illumasonix_Swap.htm";
Rotator[7] = "Precision_Biopsy_Swap.htm";
Rotator[8] = "Purtein_Swap.htm";
Rotator[9] = "RF_Biocidics_Swap.htm";
Rotator[10] = "SaltCheck_Swap.htm";
Rotator[11] = "SiEnergy_Systems_Swap.htm";
Rotator[12] = "Spin_Transfer_Tech_Swap.htm";
Rotator[13] = "ProGDerm_Swap.htm";

var whichRotator = Math.floor(Math.random()*(Rotator.length))
SwapBox = document.getElementById('RightSwap_Box');
	if (SwapBox) {
	SwapBox.src = "/RightBox_Swaps/" + (Rotator[whichRotator]);
	}
}

function RightBox() {
SubRgt = document.getElementById('SubRight');
SubsidBox = document.getElementById('SubsidiaryBox');
SubsidBox_Con = document.getElementById('SubsidiaryBox_Content');
RightBox_Con = document.getElementById('RightBox_Content');
  if (RightBox_Con) {
    if (RightBox_Con.getElementsByTagName('br').length > 0 || RightBox_Con.getElementsByTagName('img').length > 0 || RightBox_Con.getElementsByTagName('p').length > 0 || RightBox_Con.getElementsByTagName('iframe').length > 0) {
    SubRgt.style.width = "501px";
    SubsidBox_Con.innerHTML = RightBox_Con.innerHTML;
    SubsidBox.style.display = "block";
    }
  }
}

function Sub_HeightFix() {
	if (SubRgt.offsetHeight < LeftNv.offsetHeight) {
	SubRgt.style.height = LeftNv.offsetHeight + 15 + "px";
	}
}

function SearchResults() {
SearchResults = document.getElementById('SearchResults');
if (document.getElementById('PageBody')) {
var PageBody = document.getElementById('PageBody');
	if (SearchResults.innerHTML != "") {
	SearchResults.style.display = "block";
	PageBody.style.display = "none";
	}
}
}

function ExtranetNav() {
ExtLogin = document.getElementById('Top_SZLogIn');
ExtRequest = document.getElementById('Top_SZRequest');
ExtRequest_mask = document.getElementById('Top_SZRequest_mask');
ExtRequest_mask.style.height = ExtRequest.offsetHeight + "px";
ExtRequest_mask.style.width = ExtRequest.offsetWidth + "px";
ExtLogin.onmouseover = function () {
ExtRequest.style.visibility = "visible";
ExtRequest_mask.style.visibility = "visible";
}
ExtRequest.onmouseout = function () {
ExtRequest.style.visibility = "hidden";
ExtRequest_mask.style.visibility = "hidden";
}
}

function WinOnLoadItems() {
Loc = document.location.href;
TopBanner();
TopNav();
LeftNav();
FooterNav();
RightRotator();
RightBox();
Sub_HeightFix();
ExtranetNav();
SearchResults();
}

window.onload = WinOnLoadItems;

function open_video_window()
{
window.open("http://www.alliedminds.com/Portfolio/BA_Logix/video.htm","_blank","location=0, toolbar=no, directories=no, status=no, menubar=no, scrollbars=no, width=420, height=330, resizable=no titlebar=no");
}

function open_login_window()
{
window.open("/Portfolio/BA_Logix/login.htm","_blank","location=0, toolbar=no, directories=no, status=no, menubar=no, scrollbars=no, width=420, height=330, resizable=no titlebar=no");
}

function open_SysReq_window()
{
window.open("http://www.alliedminds.com/Portfolio/BA_Logix/EMSysReq.htm","_blank","location=0, toolbar=no, directories=no, status=no, menubar=no, scrollbars=no, width=500, height=250, resizable=no titlebar=no");
}
function open_popup_window(destination,Wid,Hgt)
{
var txt;
txt ="location=0, toolbar=no, directories=no, status=no, menubar=no,scrollbars=no,resizable=no titlebar=no,width="+Wid+",height="+Hgt
window.open(destination,"_blank",txt);
}
// --------------------Notes --------------------
		//alert(ML.substring((ML.lastIndexOf("/",ML.lastIndexOf("/") - 1 )) + 1,ML.lastIndexOf("/")) + " " + "ML");
  //alert(DL.substring(DL.lastIndexOf("/") + 1, 48));
//alert(DL.substring((DL.indexOf("/",DL.indexOf("/") + 3 )) + 1,DL.lastIndexOf("/")));
  //alert(ML.substring(ML.lastIndexOf("/") + 1, ML.length));
  //alert(DL.split('/')[3]);
