// Custom JavaScript file for Sector 4 Web pages
// 05/11/2006
// Author: Jonathan C. Lang (XSD)
//

// FUNCTION: anlBreadCrumbs(string baseURL)
//
// Last Modified: 05/11/2006
//



// Redefine a modified version of anlBreadCrumbs so that does not add "index.html" to base directory

function s4BreadCrumbs(baseURL){
	breadCrumbs4("http://www.aps.anl.gov",">","index.html",null,null,null,"0");
}

function breadCrumbs4(base) {
   var path = "";
   var href = document.location.href;
   var s = href.split("/");
   for (var i=3;i<(s.length-1);i++) {
     path+="<A HREF=\""+href.substring(0,href.indexOf("/"+s[i])+s[i].length+1)+"/\">"+s[i]+"</A> > ";
   }
   var url = path;
   document.writeln(url);
}


//
// S4intranet Navigation menu code from SoThink DHTMLMenu Dreamweaver Extension
//
// Use SoThink program to define the menu structure, then save as Java script include file.  
// Copy code into this file and define as a function. 
// This way you can dynamically show/not show this menu dependent on the location of the remote browser.
// We do this using a php function call defined in /Sector4/lib/sector4.inc

function generateS4intranetMenu()
{
stm_bm(["uueoehr",650,"/anl_templates/images/","blank.gif",0,"","",0,0,0,0,0,1,0,0,"","",0,0,1,1,"default","hand",""],this);
stm_bp("p0",[0,4,0,0,3,2,0,7,100,"",-2,"",-2,90,0,0,"#000000","#444444","",3,0,0,"#000000"]);
stm_ai("p0i0",[0,"S4 Intranet","","",-1,-1,0,"/Sector4/S4intranet/index.php","_self","","","","",0,0,0,"/anl_templates/images/arrow_white_down.gif","/anl_templates/images/arrow_white_down.gif",7,7,0,0,1,"#444444",1,"#444444",1,"","",3,3,0,0,"#FFFFF7","#000000","#FFFFFF","#FFFFFF","bold 8pt 'Arial','Verdana'","bold 8pt 'Arial','Verdana'",0,0]);
stm_bp("p1",[1,4,-3,3,2,2,6,0,100,"progid:DXImageTransform.Microsoft.Fade(overlap=.5,enabled=0,Duration=0.43)",-2,"",-2,67,2,3,"#999999","#FFFFFF","",3,1,1,"#ACA899"]);
stm_aix("p1i0","p0i0",[0,"Beamtime Schedules","","",-1,-1,0,"/Sector4/S4intranet/schedules/index.php","_self","","","","",6,0,0,"","",0,0,0,0,1,"#FFFFFF",0,"#666666",0,"","",3,3,0,0,"#FFFFF7","#000000","#000000","#FFFFFF","8pt 'Arial','Verdana'","8pt 'Arial','Verdana'"]);
stm_aix("p1i1","p1i0",[0,"Presentations","","",-1,-1,0,"/Sector4/S4intranet/presentations/index.php"]);
stm_aix("p1i2","p1i0",[0,"Phone List","","",-1,-1,0,"/Sector4/S4intranet/phonelist.php","_self","","","","",0]);
stm_aix("p1i3","p1i2",[0,"DatabaseApps","","",-1,-1,0,"/Sector4/S4intranet/databases.php"]);
stm_aix("p1i4","p1i2",[0,"Outings","","",-1,-1,0,"/Sector4/S4intranet/outings/picnic-2002.php"]);
stm_ai("p1i5",[6,1,"#000000","",-1,-1,0]);
stm_aix("p1i6","p1i2",[0,"Sector4 Web Logs","","",-1,-1,0,"http://4id.xor.aps.anl.gov/elog/"]);
stm_aix("p1i7","p1i2",[0,"4idc-Video Server","","",-1,-1,0,"http://164.54.115.28/view/view.shtml"]);
stm_aix("p1i8","p1i2",[0,"4idd-Video Server","","",-1,-1,0,"http://164.54.115.137/view/view.shtml"]);
stm_aix("p1i9","p1i2",[0,"Data Archiver","","",-1,-1,0,"/Sector4/S4intranet/archive/4id_DataArchive.php"]);
stm_ep();
stm_ep();
stm_em();
}

// function to prevent web page from being loaded in a frame.


function breakout_of_frame()
{
  if (top.location != location) {
    top.location.href = document.location.href ;
  }
}


// Java Script for dynamic sidebar ; Currently not used but leave in here in case we want to use in future

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		welcome_over = newImage("../images/menuitems/welcome_over.gif");
		beamtime_over = newImage("../images/menuitems/beamtime_over.gif");
		status_over = newImage("../images/menuitems/RingStatus_over.gif");
		software_over = newImage("../images/menuitems/software_over.gif");
		pubs_over = newImage("../images/menuitems/publications_over.gif");
		index_over = newImage("../images/menuitems/sindex_over.gif");
		contactus_over = newImage("../images/menuitems/contactus_over.gif");
		safety_over = newImage("../images/menuitems/safety_over.gif");
		UserGuide_over = newImage("../images/menuitems/UserGuide_over.gif");
		instrum_over = newImage("../images/menuitems/instrum_over.gif");
		BLoptics_over = newImage("../images/menuitems/BLoptics_over.gif");
	    idc_over = newImage("../images/menuitems/idc_over.gif");
		idd_over = newImage("../images/menuitems/idd_over.gif");
		faqs_over = newImage("../images/menuitems/faqs_over.gif");
		preloadFlag = true;
	}
}

// End side bar menu functions
