// Cascading Popup Menus v5.2 - Single Frame Menu example script.

// 'horizontal Bar' style: menu items that use this ItemStyle are 40px wide, have 10px gaps
// between them, no popout indicator (the ">" in some menus) or popout indicator position,
// 0px padding of the text within items, #A3BE1F background colour, a hover colour of #036339,
// 'highText' is the stylesheet class used for the menu text both normally and when highlighted,
// no border styles, 'null' means fully opaque items (set them to numbers between 0 and 100 to
// enable semitranslucency), and the 'hand'/'default' cursors are used for linked/submenu items.
var hBar = new ItemStyle(40, 1, '', 0, 0, '15#A3BE1F', '10#036339', 'highText', 'highText', '', '', null, null, 'hand', 'hand');

// The 'sub Menu' items: these have popout indicators of "Greater Than" signs ">" 15px from their
// right edge, and CSS borders. Text class also changes on mouseover.
var subM = new ItemStyle(22, 0, '&gt;', -15, 3, '#A3BE1F', '#036339', 'lowText', 'highText',
 'itemBorder', 'itemBorder', null, null, 'hand', 'hand');

// 'subBlank' is similar, but has an 'off' border the same colour as its background so it
// appears borderless when dim, and 1px spacing between items to show the hover border.
var subBlank = new ItemStyle(22, 1, '&gt;', -15, 3, '#000000', '#6699CC', 'lowText', 'highText',
 'itemBorderBlank', 'itemBorder', null, null, 'hand', 'hand');

// The purplish 'button' style also has 1px spacing to show up the fancy border, and it has
// different colours/text and less padding. They also have translucency set -- these items
// are 80% opaque when dim and 95% when highlighted. It uses the 'crosshair' cursor for items.
var button = new ItemStyle(22, 0, '&gt;', -15, 3, '10#A3BE1F', '10#036339', 'lowText', 'highText',
 'itemBorderBlank', 'itemBorder', null, null, 'hand', 'hand');


// Create a PopupMenu() object, and pass its own name so it can reference itself later on.
// We also use a 'with' block to work with its properties and functions below.

var pMenu = new PopupMenu('pMenu');
with (pMenu)
{

// The example 'root' menu is horizontal (false), positioned at (x = 10, y = 0), is 17px high,
// and items use the colours and dimensions in the 'hBar' ItemStyle defined above by default.
// If you want a vertical menu, change "false" to "true", and raise 17 to about 100 for the width.
// Most of these are 'sm:' items popping out submenus, except the last 'js:' JavaScript command to
// pop open a new window. It also has its own ItemStyle and width specified, longer than the rest.


startMenu('root', false, 0, 0, 20, hBar);
addItem('2010 Fixed Departures', 'mWinter', 'sm:', hBar, 140);
addItem('Camps & Retreats', 'mCamps', 'sm:', hBar, 120);
addItem('Tours', 'mTours', 'sm:',hBar, 48);
addItem('Treks', 'mTreks', 'sm:', hBar, 45);
addItem('Pictures', 'Pictures.asp', '', hBar, 58);
addItem('FAQs', 'mFaq', 'sm:',hBar, 40);

// This is a vertical menu positioned 0px across and 22px down from its trigger, and is 80px wide.
// The URLs are set to # here, be sure to replace them with your path/file names or JS functions!
// Also note how the types are '', indicating these links open in the current frame/window.
// The last item here changes its text on mouseover (^ separates the two strings), links to my site,
// and has a custom ItemStyle and length specified so it's longer than the rest.

startMenu('mCamps', true, 0, 22, 125, subM);
addItem('Overview', 'Camps_Overview.asp', '');
addItem('Sangla&nbsp;', 'mSangla', 'sm:',subM, 22);
addItem('Thanedar&nbsp;', 'mThanedar', 'sm:',subM, 22);
//addItem('Tabo&nbsp;', 'mTabo', 'sm:',subM, 22);
addItem('Kaza&nbsp;', 'mKaza', 'sm:',subM, 22);
addItem('Sojha&nbsp;', 'mShoja', 'sm:',subM, 22);
//addItem('Shogi', 'Camps_Shogi.asp', '');
addItem('Tariff Plan', 'Camps_Tariff.asp', '');
addItem('Distance Chart', 'Camps_Distance.asp', '');	

    startMenu('mSangla', true, 126, 0, 130, button);
	addItem('Sangla Valley Camp', 'Camps_Sangla.asp', '');
	addItem('How To Reach', 'Camps_Sangla_Reach.asp', '');
	addItem('About Sangla', 'Camps_Sangla_About.asp', '');
	
	startMenu('mThanedar', true, 126, 0, 130, button);
	addItem('Thanedar Retreat', 'Camps_Thanedar.asp', '');
	addItem('How To Reach', 'Camps_Thanedar_Reach.asp', '');
	addItem('About Thanedar', 'Camps_Thanedar_About.asp', '');

	startMenu('mTabo', true, 126, 0, 130, button);
	addItem('About Tabo', 'Camps_Tabo_About.asp', '');

	startMenu('mKaza', true, 126, 0, 130, button);
	addItem('Kaza Retreat', 'Camps_Kaza.asp', '');
	addItem('How To Reach', 'Camps_Kaza_Reach.asp', '');
	addItem('About Kaza', 'Camps_Kaza_About.asp', '');

	startMenu('mShoja', true, 126, 0, 130, button);
	addItem('Sojha Retreat', 'Camps_Shoja.asp', '');
	addItem('How To Reach', 'Camps_Shoja_Reach.asp', '');
	addItem('About Sojha', 'Camps_Shoja_About.asp', '');

	startMenu('mWinter', true, 0, 22, 150, subM);
    //addItem('Level1', 'mHoliday', 'sm:',subM, 22);
    //addItem('Level2', 'mGateway','',subM, 22);
    addItem('Treks', 'treks.asp', '',subM, 22);
    addItem('Jeep Safaris', 'safari.asp', '',subM, 22);
	addItem('Special Interest Tours', 'special_tours.asp', '',subM, 22);
	addItem('Women Only Tours', 'women_only.asp', '',subM, 22);

	//startMenu('mGateway', true, 126, 0, 130, button);
    //addItem('Culture&nbsp;', 'mCulture', 'sm:',subM, 22);
     //addItem('Wildlife&nbsp;', 'mWild', 'sm:',subM, 22);
     //addItem('Mountains&nbsp;', 'mMountains', 'sm:',subM, 22);

     startMenu('mHoliday', true, 126, 0, 130, button);
     addItem('Treks ', 'treks.asp', '');
     addItem('Jeep Safaris ', 'safari.asp', '');
     addItem('Special Interest Tours ', 'special_tours.asp', '');
     addItem('Womens only ', 'women_only.asp', '');
     //addItem('Exotic North East', 'Exotic_East.asp', '');
     //addItem('Best of Uttarakhand', 'Uttarakhand.asp', '');
     //addItem('Colours of Rajasthan', 'Rajasthan.asp', '');
     //addItem('Pride of Gujarat', 'Gujarat.asp', '');

      startMenu('mCulture', true, 131, 0, 130, button);
      addItem('Shekhawati', 'shekhavati.asp', '');
      addItem('Khajuraho', 'Khajuraho.asp', '');
      addItem('Orchha', 'Orchha.asp', '');
      addItem('Pragpur', 'Pragpur.asp', '');

       startMenu('mWild', true, 131, 0, 130, button);
       addItem('Corbett National Park', 'Corbett_Park.asp', '');
       addItem('Gir N P', 'Gir_Park.asp', '');
     addItem('Kanha N P', 'Kanha_Park.asp', '');
addItem('Bandhavgarh N P', 'Bandhavgarh_Park.asp', '');
addItem('Kaziranga N P', 'Kaziranga_Park.asp', '');

	startMenu('mMountains', true, 131, 0, 130, button);
addItem('Kashmir', 'Kashmir.asp', '');
//addItem('Sojha', 'Sojha.asp', '');
//addItem('Thanedar', 'Thanedar.asp', '');
addItem('Pangot', 'Pangot.asp', '');

	

startMenu('mTours', true, 0, 22, 115, subM);
addItem('Himachal&nbsp;', 'toursHimachal', 'sm:',subM, 22);
addItem('Ladakh&nbsp;', 'toursLadakh', 'sm:',subM, 22);
addItem('Uttarakhand&nbsp;', 'toursUttarakhand', 'sm:',subM, 22);
addItem('Sikkim&nbsp;', 'toursSikkim', 'sm:',subM, 22);
addItem('Bhutan&nbsp;', 'toursBhutan', 'sm:',subM, 22);
addItem('Tibet&nbsp;', 'toursTibet', 'sm:',subM, 22);
addItem('Nepal&nbsp;', 'toursNepal', 'sm:',subM, 22);
//addItem('Wild Life Tour&nbsp;', 'toursWild Life Tour', 'sm:',subM, 22);
addItem('North East Tour&nbsp;', 'toursNorth East Tour', 'sm:',subM, 22);

	startMenu('toursHimachal', true, 116, 0, 220, button);
	addItem('Overview', 'Tours_Himachal_Overview.asp', '');
	addItem('Places of Interest', 'Tours_Himachal_Interest.asp', '');
	addItem('Apple Circuit', 'Tours_Himachal_Apple.asp', '');
	addItem('Best of Kinnaur', 'Tours_Himachal_Kinnaur.asp', '');
	addItem('Best of Banjara', 'Tours_Himachal_Banjara.asp', '');
	addItem('Cherry Blossoms at Thanedar', 'Tours_Himachal_Cherry.asp', '');
	addItem('Fishing Destinations', 'Tours_Himachal_Fishing.asp', '');
	addItem('Cold Desert of Spiti', 'Tours_Himachal_Cold.asp', '');
	addItem('Hidden Himachal', 'Tours_Himachal_Hidden.asp', '');
	addItem('Quick Refresher in the Himalayas', 'Tours_Himachal_Quick.asp', '');
	addItem('Himalayan Advn Cultural Bonanza', 'Tours_Himachal_Himalayan.asp', '');
	addItem('Sangla Sojha Sojourn', 'Tours_Himachal_Sangla.asp', '');
	addItem('Retreat in Sojha', 'Tours_Himachal_Retreat.asp', '');
	addItem('The Unexplored Seraj Valley', 'Tours_Himachal_Unexplores.asp', '');
	addItem('Cycling in Himachal', 'Tours_Himachal_Cycling.asp', '');
	addItem('West Himachal Jeep Safari', 'Tours_Himachal_West.asp', '');

	startMenu('toursLadakh', true, 116, 0, 120, button);
	addItem('Overview', 'Tours_Ladakh_Overview.asp', '');
	addItem('Places of Interest', 'Tours_Ladakh_Interest.asp', '');
	addItem('Festival Dates', 'Tours_Ladakh_Festival.asp', '');
	addItem('Wonders of Ladakh', 'Tours_Ladakh_Wonders.asp', '');
	addItem('Ladakh Calling', 'Tours_Ladakh_Calling.asp', '');
	addItem('Ladakh Safari', 'Tours_Ladakh_Safari.asp', '');
	addItem('Rendezvous Ladakh', 'Tours_Ladakh_Rendezvous.asp', '');
	addItem('Nubra Valley', 'Tours_Ladakh_Nubra.asp', '');
	addItem('LADAKH: A road lesser travelled', 'tour_ladakh_ladakh_2008.asp', '');
		
	startMenu('toursUttarakhand', true, 116, 0, 200, button);
	addItem('Overview', 'Tours_Uttarakhand_Overview.asp', '');
	addItem('Places of Interest', 'Tours_Uttarakhand_Interest.asp', '');
	addItem('Himachal and Garhwal Blend', 'Tours_Uttarakhand_Himachal.asp', '');
	addItem('Kumaon hills', 'Tours_Uttarakhand_Kumaon.asp', '');
	addItem('Trek and culture', 'Tours_Uttarakhand_Trek.asp', '');
	addItem('Uttarakhand, An active holiday', 'Tours_Uttarakhand_Uttarakhand.asp', '');

	startMenu('toursSikkim', true, 116, 0, 220, button);
	addItem('Overview', 'Tours_Sikkim_Overview.asp', '');
	addItem('Places of Interest', 'Tours_Sikkim_Interest.asp', '');
	addItem('Complete Sikkim Tour', 'Tours_Sikkim_Complete.asp', '');
	addItem('Sikkim & Darjeeling, Lakes & passes', 'Tours_Sikkim_Sikkim.asp', '');	
	addItem('Scenic Sikkim', 'Tours_Sikkim_Scenic.asp', '');
	addItem('SIKKIM AT LEISURE', 'tour_sikkim_sikkim_2008.asp', '');
	
	startMenu('toursBhutan', true, 116, 0, 140, button);
	addItem('Overview', 'Tours_Bhutan_Overview.asp', '');
	addItem('Places of Interest', 'Tours_Bhutan_Interest.asp', '');
	addItem('Visa Application Form', 'Tours_Bhutan_Visa.asp', '');
	addItem('Drukyul Walking Tour', 'Tours_Bhutan_Drukyul.asp', '');
	addItem('Glimpses of Bhutan', 'Tours_Bhutan_Glimpses.asp', '');
	addItem('Magical Bhutan', 'Tours_Bhutan_Magical.asp', '');
	addItem('A Journey into Bhutan', 'tour_bhutan_bhutan_2008.asp', '');

	startMenu('toursTibet', true, 116, 0, 200, button);
	addItem('Overview', 'Tours_Tibet_Overview.asp', '');
	addItem('Trip Information', 'Tours_Tibet_Information.asp', '');
	addItem('Kailash Manasarover Overland', 'Tours_Tibet_Kailash_overland.asp', '');
	addItem('Kailash Manasarover Helicopter', 'Tours_Tibet_Kailash_helicopter.asp', '');
	addItem('Kailash Manasarover via Lhasa', 'Tours_Tibet_Kailash_Lhasa.asp', '');

    startMenu('toursNepal', true, 116, 0, 200, button);
	addItem('Overview', 'Tours_Nepal_Overview.asp', '');
	addItem('Places of interest-Nepal', 'Tours_Nepal_PlaceOfInterest.asp', '');
	addItem('All Nepal Tour', 'Tours_Nepal_All.asp', '');
	addItem('Kathmandu-Nagarkot-Dhulikhe', 'Tours_Nepal_Kathmandu.asp', '');
	addItem('Nepal-An active tour', 'Tours_Nepal_Active.asp', '');
	
    startMenu('toursWild Life Tour', true, 116, 0, 300, button);
	addItem('Overview', 'Tours_Wild_Overview.asp', '');
	addItem('List of animals', 'Tours_Wild_Life_Animal.asp', '');
	addItem('FAQ', 'Tours_Wild_Life_FAQ.asp', '');
	addItem('Corbette', 'Tours_Wild_Life_Corbette.asp', '');
	addItem('Jim Corbette Weekend Getaway', 'Tours_Wild_Life_Jim_Corbette.asp', '');
	addItem('Angling Tour - Cobette and Ramganga', 'Tours_Wild_Life_Corbette_Ramganga.asp', '');
	addItem('Golden Triangle with Corbette National Park', 'Tours_Wild_Life_Corbette_Ramganga.asp', '');
	addItem('Bharatpur Weekend Getaway', 'Tours_Wild_Life_Bharatpur.asp', '');
	addItem('Golden Triangle of North East', 'Tours_Wild_Life_Tringle.asp', '');
	addItem('Kaziranga and Tawang', 'Tours_Wild_Life_Kaziranga.asp', '');
	addItem('Kiplings Playground', 'Tours_Wild_Life_Kiplings.asp', '');
	addItem('Weekend Tour to Kanha', 'Tours_Wild_Life_Kanha.asp', '');
	addItem('Tigers in Central India', 'Tours_Wild_Life_Central.asp', '');
	addItem('India Nepal Wildlife Tour', 'Tours_Wild_Life_India_Nepal.asp', '');
	addItem('Temples and Tigers in Nepal', 'Tours_Wild_Life_Tigers.asp', '');
	addItem('Wildlife Tour of Rajasthan', 'Tours_Wild_Life_Rajasthan.asp', '');
	addItem('National Parks of Central India', 'Tours_Wild_Life_National_Park.asp', '');
	addItem('Kaziranga and Nemeri WLS', 'Tours_Wild_Life_Kaziranga_Nemeri.asp', '');
	addItem('Wildlife and Tribal tour of North East', 'Tours_Wild_Life_Tribal.asp', '');
	addItem('Tigers and Tea Estates of Assam', 'Tours_Wild_Life_Tea_Estates.asp', '');
	addItem('Tour to Panna and Khajuraho', 'Tours_Wild_Life_Panna.asp', '');
	addItem('Gir National Park', 'Tours_Wild_Life_Gir_National.asp', '');
	addItem('Wild West', 'Tours_Wild_Life_West.asp', '');
	addItem('Nagarhole - Bandipur - Periyar', 'Tours_Wild_Life_Nagarhole.asp', '');
	addItem('Sundarbans Weekend Getaway', 'Tours_Wild_Life_Sundarbans.asp', '');
	
	
	startMenu('toursNorth East Tour', true, 116, 0, 200, button);
	addItem('Overview', 'Tours_North_East_Overview.asp', '');
	addItem('Places of Interest of North East', 'Tours_North_East_PlaceOfInterest.asp', '');
	addItem('Abode of Clouds - Meghalaya', 'Tours_North_East_Clouds.asp', '');
	addItem('Best of Assam', 'Tours_North_East_BAssam.asp', '');
	addItem('Manipur Cultural Tour', 'Tours_North_East_ManipurCul.asp', '');	
	addItem('Mizoram Cultural Tour', 'Tours_North_East_MizormCul.asp', '');	
	addItem('Monasteries and Tribal Tour of Arunachal', 'Tours_North_East_Monasteries.asp', '');		
	addItem('Nagaland Cultural Tour', 'Tours_North_East_NagalandCul.asp', '');			
	addItem('Rafting & Angling in Arunachal', 'Tours_North_East_Rafting.asp', '');			
	addItem('Tripura Cultural Tour', 'Tours_North_East_TripuraCul.asp', '');
	addItem('A Jurney to North East India', 'tour_northeast_northeast_2008.asp', '');
	
startMenu('mTreks', true, 0, 22, 98, subM);
addItem('Himachal&nbsp;', 'treksHimachal', 'sm:',subM, 22);
addItem('Ladakh&nbsp;', 'treksLadakh', 'sm:',subM, 22);
addItem('Uttarakhand&nbsp;', 'treksUttarakhand', 'sm:',subM, 22);
addItem('Sikkim&nbsp;', 'treksSikkim', 'sm:',subM, 22);
addItem('Bhutan&nbsp;', 'treksBhutan', 'sm:',subM, 22);
addItem('Nepal&nbsp;', 'treksNepal', 'sm:',subM, 22);
addItem('NorthEast&nbsp;', 'treksNorthEast', 'sm:',subM, 22);


	startMenu('treksHimachal', true, 99, 0, 170, button);
	addItem('Bashleo Pass', 'Treks_Himachal_Bashleo.asp', '');
	addItem('Bhabha Pass', 'Treks_Himachal_Bhabbha.asp', '');
	addItem('Pin-Parbati Pass', 'Treks_Himachal_Pin.asp', '');
	addItem('Kinner Kailash', 'Treks_Himachal_Kinner.asp', '');
	addItem('Hamta Pass Trek', 'Treks_Himachal_Hamta.asp', '');
	addItem('Lingti Valley', 'Treks_Himachal_Lingti.asp', '');
	addItem('Sarahan to Sangla Trek', 'Treks_Himachal_Sarahan_Sangla.asp', '');
	addItem('Chandertal Trek', 'Treks_Himachal_Chandertal.asp', '');	
	addItem('Parang La trek', 'Treks_Himachal_Parang.asp', '');
	addItem('Walking Trails of Little Tibet', 'Treks_Himachal_Walking.asp', '');		
	
	startMenu('treksLadakh', true, 99, 0, 120, button);
	addItem('Markha Valley', 'Treks_Ladakh_Markha.asp', '');
	addItem('Sham Trek', 'Treks_Ladakh_Sham.asp', '');
	addItem('Padum-Lamayuru', 'Treks_Ladakh_Padum.asp', '');
	addItem('Lamayuru-Stok La', 'Treks_Ladakh_Lamayuru.asp', '');
	addItem('Nubra Valley Trek', 'Treks_Ladakh_Nubra.asp', '');

	startMenu('treksUttarakhand', true, 99, 0, 120, button);
	addItem('Har - Ki - Dun', 'Treks_Uttarakhand_Har.asp', '');
	addItem('Kuari pass', 'Treks_Uttarakhand_Kuari.asp', '');
	addItem('Tapovan trek', 'Treks_Uttarakhand_Tapovan.asp', '');
	addItem('Nanda Devi Inner Sanctuary Trek', 'Treks_Uttarakhand_NandaDevi.asp', '');

	startMenu('treksSikkim', true, 99, 0, 120, button);
	addItem('Goechala trek', 'Treks_Sikkim_Goechala.asp', '');
	addItem('Green Lake trek', 'Treks_Sikkim_Green.asp', '');
	

	startMenu('treksBhutan', true, 99, 0, 250, button);
	addItem('Druk Path', 'Treks_Bhutan_Druk.asp', '');
	addItem('Jumolhari Yaksa trek', 'Treks_Bhutan_Jumolhar.asp', '');
	addItem('Chorten Path', 'Treks_Bhutan_Chorten.asp', '');
	addItem('Essence of Bhutan', 'Treks_Bhutan_Essence.asp', '');
	addItem('Complete Lunana Snowman trek', 'Treks_Bhutan_Lunana.asp', '');
	addItem('Hidden Kingdom Trek', 'Treks_Bhutan_Kingdom.asp', '');
	addItem('The Old Smugglers Route - Ha Valley', 'Treks_Bhutan_OldSmuggler.asp', '');
	addItem('Red Rice Trade Route - Eastern Bhutan', 'Treks_Bhutan_RedRice.asp', '');
	addItem('Sacred Mountains, Sacred Valley', 'Treks_Bhutan_Mountains.asp', '');
	addItem('The Treasure Discoverers Trek Bhutan', 'Treks_Bhutan_Discoverers.asp', '');
	
	startMenu('treksNepal', true, 99, 0, 250, button);
	addItem('Annapurna Circuit', 'Treks_Nepal_Annapurna.asp', '');
	addItem('Annapurna Sanctuary', 'Treks_Nepal_Sanctuary.asp', '');
	addItem('Dhaulagiri Circuit', 'Treks_Nepal_Dhaulagiri.asp', '');
	addItem('The Kali Gandaki Gorge to Jomsom Trek', 'Treks_Nepal_KaliGandak.asp', '');
	addItem('Kanchanjunga North & South Base Camps', 'Treks_Nepal_Kanchanjunga.asp', '');
	addItem('Kingdom of Mustang', 'Treks_Nepal_Kingdom.asp', '');	
	addItem('Trek - Everest Base Camp', '#', '');		
	
	startMenu('treksNorthEast', true, 99, 0, 300, button);
	addItem('The Eastern Himalaya and Tawang Monastery', 'Treks_North_Eastern.asp', '');
	addItem('Lost Pass Trek', 'Treks_North_LostPass.asp', '');
	addItem('Towards the Tsang Po Gorges - Arunachal Pradesh', 'Treks_North_Towards.asp', '');
	
startMenu('mFaq', true, 0, 22, 140, subM);
addItem('Camps & Retreats', 'Faq_Camps.asp', '');
addItem('Banjara Tours', 'Faq_Banjara.asp', '');
//addItem('Wild Life FAQ', 'Tours_Wild_Life_FAQ.asp', '');

// This menu is aligned slightly left of its trigger (-10px).
// Instead of using spaces to indent, consider 'text-indent' in the stylesheet class perhaps?
// The last item is an example of adding extra optional parameters to the addItem() command.
// It uses the subM ItemSyle (regardless of what the rest of this menu uses), is 22px long,
// has 0px spacing after it, and a lesser-than-sign popout indicator positioned 3px from the left
// edge of this item. Note that the parameters after the ItemStyle name are in the same order as
// the ItemStyle command itself, and you can have as many as you want (e.g. background colours).



// This is across but not down... a horizontal popout.
// Again these items have their own ItemStyles, and unique lengths / spacings between specified.

//startMenu('mReopen', true, 85, 0, 100, button);
//addItem('Proceed 1', 'AllProjects.html#Education', '', button, 35);
//addItem('Proceed 2','AllProjects.html#Rural Development', '', button, 35);
//addItem('Proceed 3', 'AllProjects.html#Tribal Development1', '', button, 35);
//addItem('Proceed 4', 'AllProjects.html#Health', '', button, 35);
//addItem('Proceed 5', 'AllProjects.html#Labour', '', button, 35);
//addItem('Proceed 6', 'AllProjects.html#Environment', '', button, 35);


// This uses the subBlank ItemStyle which gives the items no borders when dim. The border around
// the whole menu comes from a JavaScript function in the "Menu Effects" section.




// Leftwards popout with a negative x and y relative to its trigger. The item has a custom height.

startMenu('mAbout', true, -85, -18, 80, subM);
addItem('Leftwards!<br>And up!', '#', '', subM, 40);



// You can also customise hide or show delays (in milliseconds) to the menus. Defaults are:
//showDelay = 0;
//hideDelay = 500;
// Specify hideDelay as zero if you want to disable autohiding, and showDelay as a couple of
// hundred if you don't want the menus showing instantaneously when moused over.
//
// You can assign 'oncreate' events to specific menus. By default, the script has only one for
// the root menu that shows it when it is created. You may wish to change it to something like the
// following, which uses the animation function to show the menu, or delay its show altogether.
//menu.root[0].oncreate = function() { pMenu.doVis('root', true) }

// End of 'with (pMenu)' block. That's one menu object created!

}



// CREATE ANOTHER MENU OBJECT here if you want multiple menus on a page, or you can just
// duplicate this entire file and rename 'pMenu' to something else.
// Every menu object MUST have a menu named 'root' in it, as that's always visible.

//var anotherMenu = new PopupMenu('anotherMenu');
//with (anotherMenu)
//{
// startMenu('root', .....);
// ... make menus here ...
//}









// ******************** MENU EFFECTS ********************
//
// Now you've created a basic menu object, you can add optional effects like borders and
// shadows to specific menus. You can remove this section entirely if you want, the
// functions called are found at the bottom of this file.



// Border: Added to all menus in a named object using a specified ItemStyle. The syntax is:
//  addMenuBorder(menuObject, ItemStyle,
//   opacity of border, 'border colour', border width, 'padding colour', padding width);
// Opacity is a number from 0 to 100, or null for solid colour (just like the ItemStyles).

addMenuBorder(pMenu, window.subBlank,
 null, '#666666', 1, '#CCCCDD', 2);



// Dropshadow: added to specific ItemStyles again. The syntax is similar, but later on you
// pass arrays [...] for each layer of the shadow you want. I've used two grey layers
// here, but you can use as many or as few as you want. The syntax for the layers is:
//  [opacity, 'layer colour', X offset, Y offset, Width Difference, Height difference]
// Opacity is from 0 to 100 (or null to make it solid), and the X/Y offsets are the
// distance in pixels from the menu's top left corner to that shadow layer's corner.
// The width/height differences are added or subtracted to the current menu size, for
// instance the first layer of this shadow is 4px narrower and shorter than the menu
// it is shadowing.

addDropShadow(pMenu, window.subM,
 [40,"#333333",6,6,-4,-4], [40,"#666666",4,4,0,0]);
addDropShadow(pMenu, window.subBlank,
 [40,"#333333",6,6,-4,-4], [40,"#666666",4,4,0,0]);



// Animation: We add this to the 'pMenu' menu object for supported browsers.
// IE4/Mac and Opera 5/6 don't support clipping, and Mozilla versions prior to 1.x (such as
// Netscape 6) are too slow to support it, so I'm doing some browser sniffing.
// If you don't want animation, delete this entirely, and the menus will act normally.
// Change the speed if you want... it's the last number, between -100 and 100, and is
// defined as the percentage the animation moves each frame (defaults are 10 and 15).

if ((navigator.userAgent.indexOf('rv:0.')==-1) &&
    !(isOp&&!document.documentElement) && !(isIE4&&!window.external))
{
 pMenu.showMenu = new Function('mN','menuAnim(this, mN, 10)');
 pMenu.hideMenu = new Function('mN','menuAnim(this, mN, -15)');

 // Alternatively: try the IE5.5+/Windows filters. If you are doing this make sure that you either
 // enable translucency in the ItemStyles or disable it in the dropshadows otherwise it looks weird.
 // Comment the above two lines out and uncomment this:
 //pMenu.showMenu = function(mN)
 //{ menuFilterShow(this, mN, 'progid:DXImageTransform.Microsoft.GradientWipe(' +
 //   'GradientSize=0.75,duration=0.5,wipestyle=1,motion=forward)') }
 
 // There's a good list of transitions and documentation available from:
 //  http://msdn.microsoft.com/workshop/author/filter/reference/reference.asp
 // for a whole lot more PowerPoint-like effects you can use.

 // Add animation to other menu objects like this...
 //anotherMenu.showMenu = new Function('mN','menuAnim(this, mN, 10)');
 //anotherMenu.hideMenu = new Function('mN','menuAnim(this, mN, -10)');
}



// Custom mouse events (for things like click handler, status messages, select box hiding...):
//
// If you want, you can assign functions to handle menu mouse events like mouse over/out/click.
// 'with (this)' means use the properties of the menu object, and they're passed the current
// menu name (mN) and item number (iN) you can use to determine the source of the event.
// To uncomment and activate, delete the /* and */ at the start and end.

/*
pMenu.onclick = function(mN, iN) { with (this)
{
 // Do actions depending on the item that the mouse was over at the time of the click.
 // You may with to use nested IFs or 'switch' statements etc. if you're familiar with JS.

 if (mN == 'root')
 {
  if (iN == 1) window.status = 'Congratulations, you\'ve mastered clicking!';
  if (iN == 2) location.href = 'edit.html';
  if (iN == 3) location.href = 'help.html';
  // For frameset navigation, use this syntax:
  //targetFrameName.location.href = 'blah.html';
 }
}}

// Set the status message to the URL if the 'action type' is nothing, and clear on mouseout.
// By now, you either have my 'JS Object Browser' script from my site or you need it... try
// embedding in an IFrame and typing 'pMenu' into its Go To field to see the menu internals.
pMenu.onmouseover = function(mN, iN) { with (this)
{
 with (menu[mN][iN]) if (type!='sm:' && type!='js:') window.status = href;
}}
pMenu.onmouseout = function() { window.status = '' }
*/



// Custom item arrangement: rearrange items within your menu, or alter overall menu size.
// Individual items have .iX and .iY which are positions and .iW and .iH which are dimensions.
// I recommend doing this *before* calling the border or shadow commands too :).

//with (pMenu.menu)
//{
// mFile[0].menuW += 20;
// mFile[0].menuH += 20;
// mFile[1].iX += 5;
// mFile[2].iX += 2;
// mFile[2].iW -= 2;
// mFile[3].iX += 5;
// mFile[4].iX += 10;
// mFile[4].iW += 10;
// mFile[4].iY += 3;
//}








// FUNCTIONS CALLED BY THE EFFECTS SECTION: Can be deleted if you're not using them.
// Alternatively, if you're using several menu data files, you may want to move them to the
// "core" script file.


// This is the "positioning from page anchors" code used by the advanced positioning expressions.
page.elmPos=function(e,p)
{
 var x=0,y=0,w=p?p:this.win;
 e=e?(e.substr?(isNS4?w.document.anchors[e]:getRef(e,w)):e):p;
 if(isNS4){if(e&&(e!=p)){x=e.x;y=e.y};if(p){x+=p.pageX;y+=p.pageY}}
 else while(e){x+=e.offsetLeft;y+=e.offsetTop;e=e.offsetParent}
 return{x:x,y:y};
}



// Animation:
//
// Each menu object you create by default shows and hides its menus instantaneously.
// However you can override this behaviour with custom show/hide animation routines,
// as we have done in the "Menu Effects" section. Feel free to edit this, or delete
// this entire function if you're not using it. Basically, make functions to handle
// menuObj.showAnim() and .hideAnim(), both of which are passed menu names.
//
// Customisers: My lyr.clip() command gets passed the parameters (x1, y1, x2, y2)
// so you might want to adjust the direction etc. Oh, and I'm adding 2 to the dimensions
// to be safe due to different box models in some browsers.
// Another idea: add some if/thens to test for specific menu names...?

function menuAnim(menuObj, menuName, dir)
{
 // The array index of the named menu (e.g. 'mFile') in the menu object (e.g. 'pMenu').
 var mD = menuObj.menu[menuName][0];
 // Add timer and counter variables to the menu data structure, we'll need them.
 if (!mD.timer) mD.timer = 0;
 if (!mD.counter) mD.counter = 0;

 with (mD)
 {
  // Stop any existing animation.
  clearTimeout(timer);

  // If the litNow() array doesn't show this menu as lit, and we're still showing it,
  // force a quick hide (this stops miscellaneous timer errors).
  //if (dir>0 && !menuObj.litNow[menuObj.menu[menuName][0].parentMenu]) dir = -100;

  // If the layer doesn't exist (cross-frame navigation) quit.
  if (!lyr || !lyr.ref) return;
  // This next line is not strictly necessary, but it stops the one-in-a-hundred menu that
  // shows and doesn't hide on very quick mouseovers.
  if (!visNow && dir>0) dir = 0-dir;
  // Show the menu if that's what we're doing.
  if (dir>0) lyr.vis('visible');
  // Also raise showing layers above hiding ones.
  lyr.sty.zIndex = 1001 + dir;

  // Alpha fade in IE5.5+. Mozilla's opacity isn't well suited to this as it's an inheritable
  // property rather than a block-level filter, and it's slow, but uncomment and try it perhaps.
  // WARNING: This looks funny if you're mixing opaque and translucent items e.g. solid menus
  // with dropshadows. If you're going to use it, either disable dropshadows or set the opacity
  // values for your items to numbers instead of null.
  //if (isIE && window.createPopup) lyr.alpha(counter&&(counter<100) ? counter : null);

  // Clip the visible area. Tweak this if you want to change direction/acceleration etc.
  // As you can see, the visibile clipping region is from (0, 0) which is the top left corner,
  // to the right edge of the menu 'menuW+2', and a complicated formula that sets the bottom
  // edge of the clipping region based on the 'counter' variable so it accelerates.
  lyr.clip(0, 0, menuW+2, (menuH+2)*Math.pow(Math.sin(Math.PI*counter/200),0.75) );

  // Increment the counter and if it hasn't reached the end (counter is 0% or 100%),
  // set the timer to call the showMenu/hideMenu function again in 40ms to contine the animation.
  // Note that we hide the menu div on animation end in that direction.
  counter += dir;
  if (counter>100) counter = 100;
  else if (counter<0) { counter = 0; lyr.vis('hidden') }
  else timer = setTimeout(menuObj.myName+'.'+(dir>0?'show':'hide')+'Menu("'+menuName+'")', 40);
 }
}



// Here's the alternative IE5.5+ filter animation function, which is unused by default.
function menuFilterShow(menuObj, menuName, filterName)
{
 var mD = menuObj.menu[menuName][0];
 with (mD.lyr)
 {
  sty.filter = filterName;
  var f = ref.filters, doF = (f&&f.length&&f[0]);
  if (doF) f[0].Apply();
  vis('visible');
  if (doF) f[0].Play();
 }
}



// Borders and Dropshadows:
//
// Here's the menu border and dropshadow functions we call above. Edit ot delete if you're
// not using them. Basically, they assign a string to pMenu.menu.menuName[0].extraHTML, which
// is written to the document with the menus as they are created -- the string can contain
// anything you want, really. They also adjust the menu dimensions and item positions
1// to suit. Dig out the Object Browser script and open up "pMenu" for more info.

function addMenuBorder(mObj, iS, alpha, bordCol, bordW, backCol, backW)
{
 // Loop through the menu array of that object, finding matching ItemStyles.
 for (var mN in mObj.menu)
 {
  var mR=mObj.menu[mN], dS='<div style="position:absolute; background:';
  if (mR[0].itemSty != iS) continue;
  // Loop through the items in that menu, move them down and to the right a bit.
  for (var mI=1; mI<mR.length; mI++)
  {
   mR[mI].iX += bordW+backW;
   mR[mI].iY += bordW+backW;
  }
  // Extend the total dimensions of menu accordingly.
  mW = mR[0].menuW += 2*(bordW+backW);
  mH = mR[0].menuH += 2*(bordW+backW);

  // Set the menu's extra content string with divs/layers underneath the items.
  if (isNS4) mR[0].extraHTML += '<layer bgcolor="'+bordCol+'" left="0" top="0" width="'+mW+
   '" height="'+mH+'" z-index="980"><layer bgcolor="'+backCol+'" left="'+bordW+'" top="'+
   bordW+'" width="'+(mW-2*bordW)+'" height="'+(mH-2*bordW)+'" z-index="990"></layer></layer>';
  else mR[0].extraHTML += dS+bordCol+'; left:0px; top:0px; width:'+mW+'px; height:'+mH+
   'px; z-index:980; '+(alpha!=null?'filter:alpha(opacity='+alpha+'); -moz-opacity:'+(alpha/100):'')+
   '" >'+dS+backCol+'; left:'+bordW+'px; top:'+bordW+'px; width:'+(mW-2*bordW)+'px; height:'+
   (mH-2*bordW)+'px; z-index:990"></div></div>';
 }
}

function addDropShadow(mObj, iS)
{
 // Pretty similar to the one above, just loops through list of extra parameters making
 // dropshadow layers (from arrays) and extending the menu dimensions to suit.
 for (var mN in mObj.menu)
 {
  var a=arguments, mD=mObj.menu[mN][0], addW=addH=0;
  if (mD.itemSty != iS) continue;
  for (var shad=2; shad<a.length; shad++)
  {
   var s = a[shad];
   if (isNS4) mD.extraHTML += '<layer bgcolor="'+s[1]+'" left="'+s[2]+'" top="'+s[3]+'" width="'+
    (mD.menuW+s[4])+'" height="'+(mD.menuH+s[5])+'" z-index="'+(arguments.length-shad)+'"></layer>';
   else mD.extraHTML += '<div style="position:absolute; background:'+s[1]+'; left:'+s[2]+
    'px; top:'+s[3]+'px; width:'+(mD.menuW+s[4])+'px; height:'+(mD.menuH+s[5])+'px; z-index:'+
    (a.length-shad)+'; '+(s[0]!=null?'filter:alpha(opacity='+s[0]+'); -moz-opacity:'+(s[0]/100):'')+
    '"></div>';
   addW=Math.max(addW, s[2]+s[4]);
   addH=Math.max(addH, s[3]+s[5]);
  }
  mD.menuW+=addW; mD.menuH+=addH;
 }
}
