/***********************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
*
* This code has been modified from the orginal source code obtained from
* the source mentioned above.
***********************************************/

/**************************************
* This section defines the links in the drop downs
*
*
*
***************************************/
var ProductsMenu = new Array();
ProductsMenu[1]='<a href="http://store.dunnlum.com/builderwire20/common/main/main.aspx" '+
    'title="Catalog" >Catalog</a>';
ProductsMenu[2]='<a href="http://store.dunnlum.com/builderwire20/common/store/attributeitemgridbycategory.aspx?code=QP" '+
    'title="Quick Price">Quick Price</a>';
ProductsMenu[3]='<a href="http://www.dunnlum.com/products/clearance/"' +
    ' title="Clearance Items">Clearance Items</a>';
ProductsMenu[4]='<a href="http://store.dunnlum.com/builderwire20/common/store/attributeitemgridbycategory.aspx?code=GRN" '+
    'title="Green Products List">Green Products List</a>';
ProductsMenu[5]='<a href="http://www.dunnlum.com/resources/products/" '+
    'title="Product Literature">Product Literature</a>';
ProductsMenu[6]='<a href="javascript:void(0);" onclick="window.open(\'http://www.dunnlum.com/resources/pdf/Catalogue_1_1.pdf\')" '+
    'title="Moulding Patterns (1.3MB PDF)">Moulding Patterns</a>';


var AccountMenu = new Array();
AccountMenu[1] = '<a href="http://store.dunnlum.com/builderwire20/common/store/account/accounthome.aspx" '+
    'title="Account Status" >Account Status</a>';
AccountMenu[2] = '<a href="http://www.dunnlum.com/join/"'+
    'title="Apply for an Account" >Apply for an Account</a>';


var CustomerMenu = new Array();

CustomerMenu[1]= '<a href="http://www.dunnlum.com/advice/"'+
    'title="Project Advice Scheduling">Project Advice Appointment</a>';

CustomerMenu[2]= '<a href="http://www.dunnlum.com/industrial/estimator/"'+
    'title="Estimating hits the ground running">Estimating Services</a>';

CustomerMenu[3]= '<a href="http://www.dunnlum.com/contractor_sales/"'+
    'title="Contractor Sales Team">Contractor Sales Team</a>';
CustomerMenu[4]= '<a href="http://www.dunnlum.com/industrial/"'+
    'title="Industrial &amp; Commercial">Industrial &amp; Commercial</a>';
CustomerMenu[5]= '<a href="http://www.dunnlum.com/resources/clinics/"'+
    'title="Contractor Clinics &amp; Events">Contractor Clinics &amp; Events';
CustomerMenu[6]= '<a href="http://store.dunnlum.com/builderwire20/help/main.aspx"'+
    'title="Site Help">Site Help</a>';
CustomerMenu[7]= '<a href="http://www.dunnlum.com/industrial/delivery/"'+
    'title="Dunn Lumber Delivers">Dunn Lumber Delivers</a>';
CustomerMenu[8]= '<a href="http://www.parkerlumbereast.com/"'+
    'title="Lumber Packages">Lumber Packages</a>';
CustomerMenu[9]= '<a href="http://www.trussworksllc.com/"'+
    'title="Engineered Truss Manufacturing">Engineered&nbsp;Truss&nbsp;Manufacturing</a>';
CustomerMenu[10]= '<a href="http://www.dunnlum.com/contractor_sales/windows/"'+
    'title="Window Sales">Windows</a>';
CustomerMenu[11]= '<a href="http://www.pacificsidingco.com/"'+
    'title="Siding Installation Services">Siding Installation Services</a>';


var LocationsMenu = new Array();
  LocationsMenu[1] = '<a href="http://www.dunnlum.com/locations/"'+
    'title="Store Hours">Store Hours</a>';
  LocationsMenu[2] = '<a href="http://www.dunnlum.com/locations/bellevue/"'+
    'title="Bellevue">Bellevue</a>';
  LocationsMenu[3] = '<a href="http://www.dunnlum.com/locations/everett/"'+
    'title="Everett">Everett</a>';
  LocationsMenu[4] = '<a href="http://www.dunnlum.com/locations/kirkland/"'+
    'title="Kirkland">Kirkland</a>';
  LocationsMenu[5] = '<a href="http://www.dunnlum.com/locations/lynnwood/"'+
    'title="Lynnwood">Lynnwood</a>';
  LocationsMenu[6] = '<a href="http://www.dunnlum.com/locations/marysville/"'+
    'title="Marysville">Marysville</a>';
  LocationsMenu[7] = '<a href="http://www.dunnlum.com/locations/normandypark/"'+
    'title="Normandy Park">Normandy Park</a>';
  LocationsMenu[8] = '<a href="http://www.dunnlum.com/locations/greenlake/"'+
    'title="Greenlake (Olson Lumber)">Greenlake (Olson Lumber)</a>';
  LocationsMenu[9] = '<a href="http://www.dunnlum.com/locations/renton/"'+
    'title="Renton">Renton</a>';
  LocationsMenu[10] = '<a href="http://www.dunnlum.com/locations/richmond/"'+
    'title="Shoreline">Shoreline</a>';
  LocationsMenu[11] = '<a href="http://www.dunnlum.com/locations/seattle/"'+
    'title="Seattle">Seattle</a>';
  LocationsMenu[12] = '<a href="http://www.dunnlum.com/locations/southseattle/"'+
    'title="Boulevard Park">Boulevard Park</a>';
  LocationsMenu[13] = '<a href="http://www.parkerlumbereast.com/"'+
    'title="Parker Lumber East">Parker Lumber East</a>';
  LocationsMenu[14] = '<a href="http://www.trussworksllc.com/"'+
    'title="Trussworks">Trussworks</a>';
  LocationsMenu[15] = '<a href="http://www.pacificsidingco.com/"'+
    'title="Pacific Siding Company">Pacific&nbsp;Siding&nbsp;Company</a>';

var ResourcesMenu = new Array();
    ResourcesMenu[1] = '<a href="http://www.dunnlum.com/resources/links/"'+
       'title="Related Links">Related Links</a>';
	ResourcesMenu[2] = '<a href="http://www.dunnlum.com/resources/boardreport/"'+
	   'title="Dunn Newsletter">Dunn Newsletter</a>';
	ResourcesMenu[3] = '<a href="http://www.dunnlum.com/resources/ads/"'+
	   'title="Ad Archive">Ad Archive</a>';
	ResourcesMenu[4] = '<a href="javascript:void(0);" '+
	   ' onclick="window.open(\'http://www.dunnlum.com/resources/pdf/Catalogue_1_1.pdf\')"'+
	   'title="Moulding Patterns">Moulding Patterns</a>';
	ResourcesMenu[5] = '<a href="javascript:void(0);" '+
	   ' onclick="window.open(\'http://www.dunnlum.com/resources/pdf/abbreviations.pdf\')"'+
	   'title="Abbreviations">Abbreviations</a>';
	ResourcesMenu[6] = '<a href="http://www.dunnlum.com/resources/logos/"'+
	   'title="Dunn Logos">Dunn Logos</a>';
	ResourcesMenu[7] = '<a href="http://www.dunnlum.com/resources/vendor/"'+
	   'title="Vendor Support">Vendor Support</a>';


var CompanyMenu = new Array();
    CompanyMenu[1] ='<a href="http://www.dunnlum.com/company/"'+
        'title="About Dunn Lumber">About Dunn Lumber</a>';
    CompanyMenu[2] ='<a href="http://www.dunnlum.com/company/family/"'+
        'title="The Dunn Family">The Dunn Family</a>';
    CompanyMenu[3] ='<a href="http://www.dunnlum.com/company/community/"'+
        'title="Community Support">Community Support</a>';


var GreenTeamMenu = new Array();
    GreenTeamMenu[1] = '<a href="http://www.dunnlum.com/resources/green/products/" '+
        'title="Green Products">Green Products</a>';
    GreenTeamMenu[2] = '<a href="http://www.dunnlum.com/resources/green/" '+
        'title="Green Policy">Green Policy</a>';
    GreenTeamMenu[3] = '<a href="javascript:void(0);" '+
        ' onclick="window.open(\'http://www.dunnlum.com/resources/pdf/wood_is_good.pdf\')" '+
        ' title="Wood is Good">Wood is Good</a>';
    GreenTeamMenu[4] = '<a href="http://www.dunnlum.com/resources/green/fleet/" '+
        'title="Green Fleet">Green Fleet</a>';

var JobsMenu = new Array();
    JobsMenu[1] = '<a href="http://www.dunnlum.com/employment/" '+
        'title="Current Openings (apply on-line)">Job Opportunitites</a>';
    JobsMenu[2] = '<a href="javascript:void(0);" '+
        ' onclick="window.open(\'http://www.dunnlum.com/employment/EMPLOYMENT_APPLICATION.pdf\')" '+
        ' title="Application (pdf)">Application Form</a>';
    JobsMenu[3] = '<a href="javascript:void(0);" '+
        ' onclick="OpenNewJobApp(0,\'http://www.dunnlum.com/employment/\');" '+
        ' title="On-line Application">Apply on line</a>';


function OpenNewJobApp(JobId, JobsURL) {
    if (JobId) {
        var u ='application/?action=new&id='+JobId;
    }else{
        var u ='application/?action=new&nojob=1';
    }
    if (JobsURL) {
        u =JobsURL+u;
    }
    var o = 'scrollbars=yes,resizable=yes,width=800,height=500';
    var w = window.open(u,'Application',o);
    w.focus();
}

/*********************************
*
*  End of drop down defs
*
**********************************/

var menuwidth='100px' //default menu width
var menubgcolor='#0055A4'  //menu bgcolor
var menuactivecolor = '#0055A4';
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?
var MenuObjRestoreStyle = false; // stores style of  menu obj

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6) {
    document.write('<div id="DropMenuDiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></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 showhide(obj, e, visible, hidden, menuwidth){
    if (ie4||ns6) {
        dropmenuobj.style.left=dropmenuobj.style.top="50px"
    }
    if (menuwidth!=""){
        dropmenuobj.widthobj=dropmenuobj.style
        dropmenuobj.widthobj.width=menuwidth
    }
    if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover") {
        obj.visibility=visible;
    }else if (e.type=="click"){
        obj.visibility=hidden
    }
}

function iecompattest(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
    return 0;// so the menu will not reposition to avoid windows edge
    var edgeoffset=0
    if (whichedge=="rightedge"){
        var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
        dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
        if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
            edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
    }else{
        var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
        var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
        dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
        if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
            edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
            if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
                edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
        }
    }
    return edgeoffset
}

function populatemenu(what){
    if (ie4||ns6) {
        dropmenuobj.innerHTML=what.join("");
    }
}


function dropdownmenu(obj, e, menucontents, menuwidth) {
    MenuObjRestoreStyle = obj.style.backgroundColor;
    obj.style.backgroundColor = menuactivecolor;
    if (window.event) {
        event.cancelBubble=true
    }else if (e.stopPropagation) {
        e.stopPropagation()
    }
    clearhidemenu()
    dropmenuobj=document.getElementById? document.getElementById("DropMenuDiv") : DropMenuDiv
    populatemenu(menucontents)
    if (ie4||ns6){
        showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
        dropmenuobj.x=getposOffset(obj, "left")
        dropmenuobj.y=getposOffset(obj, "top")
        dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
        dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
    }
    return clickreturnvalue()
}

function clickreturnvalue(){
    if (ie4||ns6) {
        return false
    }else{
        return true
    }
}

function contains_ns6(a, b) {
    while (b.parentNode) {
        if ((b = b.parentNode) == a) {
            return true;
        }
    }
    return false;
}

function dynamichide(e){
    if (ie4&&!dropmenuobj.contains(e.toElement)) {
        delayhidemenu();
    }else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget)) {
        delayhidemenu();
    }
}

function hidemenu(e){
    if (typeof dropmenuobj!="undefined") {
        if (ie4||ns6) {
            dropmenuobj.style.visibility="hidden";
        }
    }
}

function delayhidemenu(obj) {
    if (typeof obj!="undefined") obj.style.backgroundColor =  menubgcolor;
    if (ie4||ns6) {
        delayhide=setTimeout("hidemenu()",disappeardelay);
    }
     if (typeof obj!="undefined") {
       obj.style.backgroundColor = MenuObjRestoreStyle;
    }
}

function clearhidemenu(){
    if (typeof delayhide!="undefined") {
        clearTimeout(delayhide);
    }
}

if (hidemenu_onclick=="yes") {
    document.onclick=hidemenu;
}
