﻿/*
*
*  
*  This code is protected under open source laws.
*  This code is not to be used without the express permission of Action Bindery, Inc.
*  
*
*/


    var actionMenuImage = new Image();
    var actionMenuImageSrc = null;
    var actionMenu = null;
    var menu;
    var menuImage;
    var interval = null;
    var directory = "index";
    var page;
    var depth = "";
    var rollovers = new Array(16);
   
function setInitialMenu () {
    if (directory == "index") {
       show ('action','actionImage',0,1,true);
    } else if (directory == "academic") {
       show ('academic','academicImage',2,3,true);
    } else if (directory == "business") {
       show ('business','businessImage',4,5,true);
    } else if (directory == "fundraiser") {
        show ('fundraiser','fundraiserImage',6,7,true);
    } else if (directory == "store") {
        show ('store','store',8,9,true);
    } else if (directory == "free") {
        show ('fundraiser','fundraiserImage',6,7,true);
    } else if (directory == "switch") {
    	show ('academic', 'academicImage',2,3,true);
    }
}
 
function init () {
    if (!(document.getElementById && document.images)) return;
    
    pathElements = parsePath();
    
    if (pathElements.length > 0) {
        page = pathElements[pathElements.length-1];
    }
    if (pathElements.length > 1) {
        directory = pathElements[0];
        for (var i=0; i< (pathElements.length-1); i++) {
            depth += "../";
        }
    }
    
    if (directory == "press" || directory == "customer_tools" || directory == "news") {
        directory = "index";
    }
    
    if (directory == "switch")
    	directory = "academic";
    	
    if (directory == "free") {
        directory = "fundraiser";
    }
   		    
}
function submitForm(form) {
    document.forms[form].submit();
}
function accessoriesMenu (imgDirectory,menuType) {
    var submenu = "";
    submenu += "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">";
    submenu += "<tr><td><img src=\""+depth+"images/spacer.gif\" height=\"1\" width=\"1\" border=\"0\"></td></tr>";
    submenu += "<tr><td><img src=\""+depth+"images/"+imgDirectory+"_pg_images/accessories.gif\" border=\"0\"></td></tr>";
    submenu += "<tr><td>"+writeAccessoriesLinks(menuType)+"</td></tr>";
    submenu += "</table>";
    return submenu;
}
function writeAcademicSideBar () {
    var pathToImage = "images/agenda_pg_images";
    if (directory == "academic" && page == "achieve") {
         pathToImage = "images/achieve_pg_images";
    } else if (directory == "academic" && page == "advance") {
         pathToImage = "images/advance_pg_images";
    } else if (directory == "academic" && page == "aspire") {
         pathToImage = "images/aspire_pg_images";
    }
    var sidebar = "";
    sidebar += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"100%\">";
    sidebar += "<tr><td height=\"1\"><img src=\""+depth+"images/spacer.gif\" width=\"1\" height=\"1\" border=\"0\"></td></tr>";
    sidebar += "<tr height=\"15\">";
    sidebar += "<td width=\"151\" height=\"15\"><a href=\""+depth+"customer_tools/request_quote.php?type=academic\"<img src=\""+depth+"images/"+directory+"_pg_images/quote_request.gif\" alt=\"\" border=\"0\"></a></td>";
    sidebar += "</tr><tr height=\"1\">";
    sidebar += "<td width=\"151\" height=\"1\"><img src=\""+depth+"images/spacer.gif\" alt=\"\" height=\"1\" width=\"1\" border=\"0\"></td>";
    sidebar += "</tr><tr height=\"14\">";
    sidebar += "<td width=\"151\" height=\"14\"><a href=\""+depth+"customer_tools/catalog_request.php?type=academic\"><img src=\""+depth+"images/"+directory+"_pg_images/catalog_request.gif\" alt=\"\" border=\"0\"></a></td>";
    sidebar += "</tr><tr height=\"166\">";
    sidebar += "<td class=\"sidebar1\" width=\"151\" height=\"166\"><img src=\""+depth+"images/agenda_pg_images/action_extras.gif\" alt=\"\" width=\"151\" height=\"166\" border=\"0\"></td>";
    sidebar += "</tr><tr height=\"1\">";
    sidebar += "<td width=\"151\" height=\"1\"><img src=\""+depth+"images/spacer.gif\" alt=\"\" height=\"1\" width=\"1\" border=\"0\"></td>";
    sidebar += "</tr><tr height=\"19\">";
    sidebar += "<td class=\"sidebar2\" width=\"151\" height=\"19\"><a href=\""+depth+"academic/custom.php\"><img src=\""+depth+pathToImage+"/customize.gif\" border=\"0\"></a></td>";
	sidebar += "</tr><tr height=\"1\">";								
	sidebar += "<td width=\"151\" height=\"1\"><img src=\""+depth+"images/spacer.gif\" alt=\"\" height=\"1\" width=\"1\" border=\"0\"></td>";								
	sidebar += "</tr><tr height=\"80\">";
	sidebar += "<td class=\"sidebar2\" width=\"151\" height=\"80\">";
	sidebar += "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\">";
	sidebar += "<tr><td><a href=\""+depth+"academic/custom.php#plastic\">Clear Cover</a><br><a href=\""+depth+"academic/custom.php#classic\">Classic Cover</a><br><a href=\""+depth+"academic/custom.php#logo\">Custom Logo Creation</a><br><a href=\""+depth+"academic/custom.php#handbookworksheet\">Handbook Worksheet</a><br><a href=\""+depth+"academic/custom.php#coverworksheet\">Cover Worksheet</a></td></tr></table>";
	sidebar += "</td></tr><tr height=\"1\">";
	sidebar += "<td width=\"151\" height=\"1\"><img src=\""+depth+"images/spacer.gif\" alt=\"\" height=\"1\" width=\"1\" border=\"0\"></td>";
	sidebar += "</tr><tr height=\"19\">";
	sidebar += "<td width=\"151\" height=\"19\"><a href=\""+depth+"academic/access.html\"><img src=\""+depth+pathToImage+"/accessories.gif\" alt=\"\" border=\"0\"></a></td>";
	sidebar += "</tr><tr height=\"1\">";
	sidebar += "<td width=\"151\" height=\"1\"><img src=\""+depth+"images/spacer.gif\" alt=\"\" height=\"1\" width=\"1\" border=\"0\"></td>";
	sidebar += "</tr><tr height=\"116\">";
	sidebar += "<td class=\"sidebar2\" width=\"151\" height=\"116\">";
	sidebar += "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\">";
	sidebar += "<tr><td><a href=\""+depth+"academic/gradebook.html\">Gradebook/Lesson Planner</a><br><a href=\""+depth+"academic/notebook.html\">School Notebook</a><br><a href=\""+depth+"academic/stickers.html\">Stickers</a><br><a href=\""+depth+"academic/wallchart.html\">Wall Chart</a><br><a href=\""+depth+"academic/carrypockets.html\">Carry Pockets</a><br><a href=\""+depth+"academic/binder.html\">Zipper Binder<br><a href=\""+depth+"academic/pagemarkers.html\">Page Marker</a><br><a href=\""+depth+"academic/hallpass.html\">Hall Pass Sheet</a><br><a href=\""+depth+"academic/phonebook.html\">Phone/Address Book</a></td></tr></table>";
	sidebar += "</td></tr>";
	sidebar += "<tr height=\"1\">";								
	sidebar += "<td width=\"151\" height=\"1\"><img src=\""+depth+"images/spacer.gif\" alt=\"\" height=\"1\" width=\"1\" border=\"0\"></td>";									
	sidebar += "</tr><tr height=\"19\">";			
	sidebar += "<td width=\"151\" height=\"19\"><a href=\""+depth+"academic/specialedition.html\"><img src=\""+depth+pathToImage+"/editions.gif\" alt=\"\" border=\"0\"></a></td>";								
	sidebar += "</tr><tr height=\"1\">";									
	sidebar += "<td width=\"151\" height=\"1\"><img src=\""+depth+"images/spacer.gif\" alt=\"\" height=\"1\" width=\"1\" border=\"0\"></td>";								
	sidebar += "</tr><tr>";								
	sidebar += "<td class=\"sidebar2\" valign=\"top\" width=\"151\">";									
	sidebar += "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\">";										
	sidebar += "<tr><td><a href=\""+depth+"academic/specialedition.html#teacher\">Teacher</a><br><a href=\""+depth+"academic/specialedition.html#character\">Character</a><br><a href=\""+depth+"academic/specialedition.html#college\">College</a><br></td></tr></table>";											
	sidebar += "</td></tr></table>";												
	document.write(sidebar);													

}

function writeHeader() {
    
	if(ns4)_d.write("<scr"+"ipt type=text/javascript src=../js/mmenuns4.js><\/scr"+"ipt>");		
	else _d.write("<scr"+"ipt type=text/javascript src=../js/mmenudom.js><\/scr"+"ipt>");
	
	header  = "<table cellspacing=\"0\" cellpadding=\"0\" class=\"headerTable\">";
	header += "<tr>";
	header += "<td id=\"logoCell\" rowspan=\"2\" width=\"249\" height=\"66\"><img src=\"../images/header/actionlogo.jpg\" alt=\"Action Agendas Logo\" width=\"249\" height=\"70\" border=\"0\" /></td>";
	header += "<td id=\"pnCell\" height=\"46\"><span class=\"14pt\">1.800.388.2919</span></td>";
	header += "</tr>";
	header += "<tr>";
	header += "<td id=\"menuCell\">";
	header += "<script type=\"text/javascript\" src=\"../js/menu_data.js\"></script>";
	header += "<script>";
	header += "with(milonic=new menuname(\"Main Menu\")){";
	header += "style=menuStyle;";
	header += "itemwidth=\"100\"";
	header += "itemheight=\"23\"";
	header += "alwaysvisible=1";
	header += "orientation=\"horizontal\"";
	header += "position=\"relative\"";
	header += "aI(\"text=Action;showmenu=Action;\")";
	header += "aI(\"text=Academic;showmenu=Academic;\")";
	header += "aI(\"text=Business;showmenu=Business;\")";
	header += "aI(\"text=Fundraiser;showmenu=Fundraiser;\")";
	header += "aI(\"text=Store;showmenu=Store;\")";
	header += "}";
	header += "drawMenus();";
	header += "</script>";
	header += "</td>";
	header += "</tr>";
	header += "</table>";
	
	document.write (header);
	

}

function writeFooter() {
    var footer = "";
    footer += "<table width=\"800\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
	footer += "<tr><td><a href=\""+depth+"customer_tools/contact_us.php\"><img src=\""+depth+"images/"+directory+"_pg_images/Contact_Us!.gif\" alt=\"\" border=\"0\"></a><img src=\""+depth+"images/index_pg_images/Contact_Divider1.gif\" alt=\"\" height=\"14\" width=\"5\" border=\"0\"><a href=\""+depth+"customer_tools/contact_us.php?type=general\"><img src=\""+depth+"images/"+directory+"_pg_images/Contact_General.gif\" alt=\"\" width=\"53\" height=\"14\" border=\"0\"></a><img src=\""+depth+"images/index_pg_images/Contact_Divider1.gif\" alt=\"\" height=\"14\" width=\"5\" border=\"0\"><a href=\""+depth+"customer_tools/contact_us.php?type=sales\"><img src=\""+depth+"images/"+directory+"_pg_images/Contact_Sales.gif\" alt=\"\" width=\"36\" height=\"14\" border=\"0\"></a></td><td valign=\"bottom\"><span class=\""+directory+"_phone\">Call 1.800.388.2919 today!</span></td>";					
	footer += "</tr><tr>";
	footer += "<td><img src=\""+depth+"images/index_pg_images/Bottom_Bar1.gif\" alt=\"\" width=\"363\" height=\"21\" border=\"0\"></td><td><img src=\""+depth+"images/"+directory+"_pg_images/Bottom_Bar2.gif\" alt=\"\" width=\"437\" height=\"21\" border=\"0\"></td>";					
	footer += "</tr></table>";					
	document.write(footer);						
}

window.onLoad = init();

function show(id,img,onsrc,offsrc,page_load) {
    if (!(document.images && document.getElementById && document.getElementsByTagName)) return;
    menu = document.getElementById(id);
    
    menuImage = new Image();
    menuImage = document.images[img];

    if (page_load)
    {
    	showSubNav(id,onsrc,offsrc);
    	actionMenuImageSrc = offsrc;
    	actionMenuImage = menuImage;
    	actionMenu = menu;
    }
    else 
    {
        interval = window.setTimeout ('showSubNav("'+id+'",'+onsrc+','+offsrc+')',500);
    }
}

function clearTimer () {
    window.clearTimeout(interval);
    
}

function showSubNav (el,onsrc,offsrc) {
	if ((el = document.getElementById(el)) != actionMenu) {
		menuImage.src = rollovers[onsrc].src;
		el.style.visibility = "visible";
	
		if (actionMenu != null) {
		    actionMenuImage.src = rollovers[actionMenuImageSrc].src;
			actionMenu.style.visibility = "hidden";
    	}
    
    	actionMenuImageSrc = offsrc;
    	actionMenuImage = menuImage;
    	actionMenu = menu;
    }	  
}

function switchImage (img,id) {
    if (document.images) document.images[img].src = rollovers[id].src;
}

function parsePath() {
    var pathname = window.location.pathname;
    if (pathname == null || pathname == "") return;
    pathname = pathname.substring(1);
	var pathArray = pathname.split("/");	
    var delimiter;
	for (var i = 0; i < pathArray.length; i++) {
	    if ((delimiter = pathArray[i].indexOf(".")) != -1) pathArray[i] = pathArray[i].slice(0,delimiter);
	}
	return pathArray;
}

