﻿// JScript File

   
function getdropdowns()
{
        var dn = 'basecampm';
        startdiv(dn,'124');
        bi('weather.aspx',dn ,'Weather Links');
        bi('outfitters.aspx',dn ,'Local Outfitters');
        bi('PerchTails.aspx',dn ,'Perch Tales');
        bi('albums.aspx',dn ,'Photo Gallery');
        bi('staff.aspx',dn ,'Our Staff Bios');
        bi('map.aspx',dn ,'Our Locator Map');
        bi('newsletter.aspx',dn ,'Our Newsletter');
        bi('employment.aspx',dn ,'Employment');
        enddiv();
        
        /*
        
        var dn = 'betam';
        startdiv(dn,'60');
        bi('Event_Calendar.aspx',dn ,'Event Calendar');
        bi('Weather.aspx',dn ,'Weather Links');
        bi('Outfitters.aspx',dn ,'Local Outfitters');
        bi('Bobs_Report.aspx',dn ,'Bobs Report');
        bi('Featured_Trails.aspx',dn ,'Featured Summer Trails');
        bi('Mountain_Bike_Ride.aspx',dn ,'Mountain Bike Ride');
        bi('Road_Bike_Ride.aspx',dn ,'Road Bike Ride');
        bi('Featured_Run.aspx',dn ,'Featured Run');
        bi('Day_Hike.aspx',dn ,'Day Hike');
        bi('Rock_Climb.aspx',dn ,'Rock Climb');
        bi('Backpack_Trip.aspx',dn ,'Backpack Trip');
        bi('Trailhead_Locator.aspx',dn ,'Trailhead Locator');
        bi('Mountain_Biking.aspx',dn ,'Mountain Biking');
        bi('Backpacking.aspx',dn ,'Backpacking');
        bi('Running_Hiking.aspx',dn ,'Running / Hiking');
        enddiv();
        
        var dn = 'eventsm';
        startdiv(dn,'60');
        bi('Event_Calendar.aspx',dn ,'Event Calendar');
        enddiv();
        
        */
        
        var dn = 'summerm';
        startdiv(dn,'60');
        bi('Summer_Gear.aspx#CyclingRM',dn ,'Cycling');
        bi('Summer_Gear.aspx',dn ,'Cycling');
        bi('Summer_Gear.aspx#DayHiking',dn ,'Day Hiking');
        bi('Summer_Gear.aspx#Backpacking',dn ,'Backpacking');
        bi('Summer_Gear.aspx#Climbing',dn ,'Climbing');
        bi('Summer_Gear.aspx#MapsAndGuides',dn ,'Maps and Guides');
        bi('Summer_Gear.aspx#LuggageTravel',dn ,'Luggage and Travel');
        bi('Summer_Gear.aspx#RentalEquipment',dn ,'Rental Equipment');
        enddiv();
        
        var dn = 'winterm';
        startdiv(dn,'60');
         bi('Winter_Gear.aspx#CrossCountry',dn ,'Cross Country');
         bi('Winter_Gear.aspx#Alpine',dn ,'Alpine Touring');
         bi('Winter_Gear.aspx#Telemark',dn ,'Telemark');
         bi('Winter_Gear.aspx#Snowshoeing',dn ,'Snowshoeing');
         bi('Winter_Gear.aspx#Mountaineering',dn ,'Winter Mountaineering');
         bi('Winter_Gear.aspx#Maps',dn ,'Maps and Guides');
         bi('Winter_Gear.aspx#Luggage',dn ,'Luggage and Travel');
         bi('Winter_Gear.aspx#RentalEquipment',dn ,'Rentals');
        enddiv();
        
        var dn = 'apparelm';
        startdiv(dn,'60');
         bi('Apparel.aspx#Jackets',dn ,'Jackets and Pants');
         bi('Apparel.aspx#Fleece',dn ,'Fleece and Insulation');
         bi('Apparel.aspx#Underwear',dn ,'Technical Underwear'); 
         bi('Apparel.aspx#Lifestyle',dn ,'Lifestyle'); 
         bi('Apparel.aspx#Eyewear',dn ,'Eyewear'); 
         bi('Apparel.aspx#Accessories',dn ,'Accessories');
        enddiv();
        
        var dn = 'footgearm';
        startdiv(dn,'60');
        bi('Footgear.aspx#Hiking',dn ,'Hiking');
        bi('Footgear.aspx#Running',dn ,'Running');
        bi('Footgear.aspx#Specialty',dn ,'Speciality Footgear');
        bi('Footgear.aspx#Lifestyle',dn ,'Lifestyle');
        enddiv();
        
        var dn = 'photom';
        startdiv(dn,'60');
        bi('Event_Calendar.aspx',dn ,'Event Calendar');
        enddiv();
        
        dn = 'contactm';
        startdiv(dn,'102');
        bi('contact.aspx#generalinfo',dn ,'General Information');
        bi('contact.aspx#directory',dn ,'Company Directory');
        bi('contact.aspx#suppliers',dn ,'Our Suppliers');
        bi('employment.aspx',dn ,'Employment');
enddiv();

}
        
        function hideDDs(sect)
        {
            tNav('basecampm',' ','hide');
            /*
            tNav('betam', ' ' ,'hide');
            tNav('eventsm', ' ' ,'hide');
            */
            tNav('summerm', ' ' ,'hide');
            tNav('winterm', ' ' ,'hide');
            tNav('apparelm', ' ' ,'hide');
            tNav('footgearm', ' ' ,'hide');
            tNav('photom', ' ' ,'hide');
            tNav('contactm', ' ' ,'hide'); 
            showElement('SELECT');
        }

        function unsetHeads()
        {
            unsetHead('basecampm');
            /*
            unsetHead('betam');
            unsetHead('eventsm');
            */
            unsetHead('summerm');
            unsetHead('winterm');
            unsetHead('apparelm');
            unsetHead('footgearm');
            unsetHead('photom');
            unsetHead('contactm');
        }
        
        function init(s) {
        }

        function startdiv(idval,w)
        {
         var s = document.write ('<div id="'+idval+'"><table width="'+w+'" border="0" cellpadding="0" cellspacing="0" class="mt">');
        }
        function enddiv(){
         var s = document.write ("</table></div>");
        }
        function bi(link,div,name){
         var s = document.write ("<tr><td onClick=\"lnk('"+link+"');\" onMouseOver=\"menuovr('"+div+"','"+pn(name)+"',this);\" onMouseOut=\"menuout('"+div+"',this);\" class=\"nav2\">"+name+"</td></tr>");
        }
        function pn(name){
         var s=name;if(s.indexOf("<")>0) {return(s.slice(0,s.indexOf("<")-1));}return(s);
        }
        function lnk(link){
         window.open(link,'_self');
        }
        function mainovr(div,status){
         bHover=status;window.status=status;unsetHeads();setDD(div,status,false);
        }
        function mainout(div){
         bHover='';window.status='';setDDTimeout(div);
        }
        function menuovr(div, link, item)
        {
         window.status=link;
        //ajax item.style.backgroundColor='#CCCCCC';
         item.style.color='#000000';
         setDD(div,'',true);
         window.status=link;
        //ajax item.style.backgroundColor='pink';
         setDD(div,'',true);
        }
        function menuout(div, item)
        {
         setDDTimeout(div);
         item.style.color='#ffffff';
        }
        function findDiv(n, d) 
        {
         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=findDiv(n,d.layers[i].document);
         if(!x && document.getElementById) x=document.getElementById(n); 
         return x;
        }
        
        function tNav() 
        {
         var i,p,v,obj,args=tNav.arguments;
         for (i=0; i<(args.length-2); i+=3) if ((obj=findDiv(args[i]))!=null) { v=args[i+2];
         if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
         obj.visibility=v; }
        }

        function hideDD(sect) 
        {
         tNav(sect,'','hide');hideDDs(sect);unsetHead(sect);
        }
        
        var secSet = null;
        var activeTimer = null;
        var bHover = '';
        
        function setDD(sect, windowStatusVal, bshow) 
        {
         setHead(sect);
         hideDDs(sect);
         if ((bHover==windowStatusVal)||(bshow)){
         tNav(sect,'','show');
         if (secSet != null) {
         window.clearTimeout(secSet);
         }
         
        // hideElement('SELECT', document.all[sect]);
         hideElement('SELECT', document.getElementById(sect));
         }
        }
        
        function setDDTimeout(sect)
        {
         if (secSet != null) window.clearTimeout(secSet);
         secSet = window.setTimeout('hideDD("' + sect + '")',500);
        }
        
        function hideElement( elmID, overDiv ) 
        {
         if(document.all) 
         {
            for(i = 0; i < document.all.tags( elmID ).length; i++) 
            {
                obj = document.all.tags( elmID )[i];
                if(!obj || !obj.offsetParent) continue;
                // Find the element's offsetTop and offsetLeft relative to the BODY tag.
                objLeft = obj.offsetLeft - overDiv.offsetParent.offsetLeft;
                objTop = obj.offsetTop;
                objParent = obj.offsetParent;
                while(objParent.tagName.toUpperCase() != 'BODY') 
                {
                    objLeft += objParent.offsetLeft;
                    objTop += objParent.offsetTop;
                    objParent = objParent.offsetParent;}
                    objHeight = obj.offsetHeight;
                    objWidth = obj.offsetWidth;
                    if((overDiv.offsetLeft + overDiv.offsetWidth) <= objLeft);
                    else if((overDiv.offsetParent.offsetTop + overDiv.offsetHeight + 20) <= objTop);
                    else if(overDiv.offsetTop >= eval(objTop + objHeight));
                    else if(overDiv.offsetLeft >= eval(objLeft + objWidth));
                    else 
                    {
                        obj.style.visibility = 'hidden';
                    }
                }
            }
        }

        function showElement(elmID) 
        {
         if(document.all) {
         for(i = 0; i < document.all.tags( elmID ).length; i++) 
         {
         obj = document.all.tags(elmID)[i];
         if(!obj || !obj.offsetParent) continue;
         obj.style.visibility = '';
         }
         }
        }
        
        function setHead(div) {
 var id = div + 'head';
 change(id,'menuselect');
}
function unsetHead(div) {
 var id = div + 'head';
 change(id,'menubase');
}

function change(id, newClass) 
{
    identity=document.getElementById(id);
    identity.className=newClass;
}
        
        function setHead(div) 
        {
         var id = div + 'head';
         change(id,'menuselect');
        }
        
        function unsetHead(div) 
        {
         var id = div + 'head';
         change(id,'menubase');
        }

        function change(id, newClass) 
        {
         identity=document.getElementById(id);
         identity.className=newClass;
        }
        
        
   