// this must be an absolute link to this section!
var SiteRootFolder = "http://www.aap.org/sections/ypn/ms"; // aap production server
// var SiteRootFolder = "http://dev1.aap.org/sections/ypn/ms"; // aap development server
// var SiteRootFolder = "/aap_r/ms"; // eo server

var RowNum = 0;
var SubRowNum = 0;


var StaticNavMenu = '';
var SubMenuYOffset = "-19px"; 
var MenuYOffset = "0px";
/*
var StaticNavMenu = '<img width="599" height="26" src="'+SiteRootFolder+'/shared/spacer.gif" border="0" usemap="#NavMenuMap">'+
    '<map name="NavMenuMap" id="Map"><area shape="rect" coords="-4,-1,78,34" href="/about/" />'+
    '<area shape="rect" coords="79,0,145,50" href="/services/" />'+
    '<area shape="rect" coords="147,1,233,86" href="/general/" />'+
    '<area shape="rect" coords="235,0,322,62" href="/employment" />'+
    '<area shape="rect" coords="325,1,455,54" href="/programs/" />'+
    '<area shape="rect" coords="457,1,512,31" href="/events/" />'+
    '<area shape="rect" coords="515,1,616,38" href="/contact/" /></map>';
*/

// Preload hover images
window.onload = function() {  
	Image1 = new Image();
	Image2 = new Image();
	Image1.src = SiteRootFolder+"/shared/left_menu/bullet_top_over.gif";
	Image2.src = SiteRootFolder+"/shared/left_menu/bullet_bottom_over.gif";
}

//
// Menu functions
//
function MenuRow(in_Title, in_Link, in_MenuRowPopup, in_LinkExternalTarget)
{
	// in_LinkExternalTarget is optional
	LinkTarget = "";
	if (typeof in_LinkExternalTarget != "undefined")
		if (in_LinkExternalTarget)
			LinkTarget = " target='_blank' ";

	var Style = '';
	RowNum++;

	if (RowNum % 2)
		Style = 'TopMenuSub1';
	else
		Style = 'TopMenuSub2';

	if ((in_Link.search(/http:/i) != -1) || (in_Link.search(/https:/i) != -1))
		Link = in_Link;
	else
		Link = SiteRootFolder+in_Link;	

	return '	<li><a class="'+Style+'" href="'+Link+'" '+LinkTarget+'>'+in_Title+'</a>'+in_MenuRowPopup+'</li>';
}

function StartMenu(in_MenuName, in_Width, in_Height, in_Link, in_MenuRowWidth, in_LeftOffset)
{
	// in_LeftOffset is optional
	if (typeof in_LeftOffset == "undefined")
		in_LeftOffset = "0";
	RowNum = 0;

	if ((in_Link.search(/http:/i) != -1) || (in_Link.search(/https:/i) != -1))
        Link = in_Link;
    else
        Link = SiteRootFolder+in_Link;

	return 	'<li style="width:'+in_Width+'px;"><a href="'+Link+'">'
		+'<img src="'+SiteRootFolder+'/shared/spacer.gif" width="'+(in_Width-40)+'" height="'+in_Height+'" border="0" ></a>'
	+'<div><div style="width:'+in_MenuRowWidth+'px;top:'+MenuYOffset+';left:'+in_LeftOffset+'px;"><ul style="">';
}

function EndMenu()
{	
	return '</ul></div></div></li>';
}

function StartMenuNoRows(in_MenuName, in_Width, in_Height, in_Link, in_MenuRowWidth)
{
	RowNum = 0;

	if ((in_Link.search(/http:/i) != -1) || (in_Link.search(/https:/i) != -1))
        Link = in_Link;
    else
        Link = SiteRootFolder+in_Link;

	return 	'<li style="width:'+in_Width+'px;"><a href="'+Link+'">'
		+'<img src="'+SiteRootFolder+'/shared/spacer.gif" width="'+(in_Width-40)+'" height="'+in_Height+'" border="0" ></a></li>';
}

// Submenu functions
function SubMenuRow(in_Title, in_Link, in_MenuRowPopup, in_LinkExternalTarget)
{
	// in_LinkExternalTarget is optional
	LinkTarget = "";
	if (typeof in_LinkExternalTarget != "undefined")
		if (in_LinkExternalTarget)
			LinkTarget = " target='_blank' ";

	var Style = '';
	SubRowNum++;

	if (typeof in_MenuRowPopup == "undefined")
		in_MenuRowPopup = '';
		
	if (SubRowNum % 2)
		Style = 'TopMenuSub1';
	else
		Style = 'TopMenuSub2';

	if ((in_Link.search(/http:/i) != -1) || (in_Link.search(/https:/i) != -1))
        Link = in_Link;
    else
        Link = SiteRootFolder+in_Link;

	return '<li ><a class="'+Style+'" href="'+Link+'" '+LinkTarget+'>'+in_Title+'</a>'+in_MenuRowPopup+'</li>';
}
function StartSubMenu(in_Width, in_LeftOffset, in_YOffset)
{
	// in_LeftOffset is optional
	if (typeof in_YOffset == "undefined")
		in_YOffset = SubMenuYOffset;
	else
		in_YOffset = in_YOffset + "px";

	SubRowNum = 0;
	return '<div><div style="width:'+in_Width+'px;top:'+in_YOffset+';left:'+in_LeftOffset+'px;"><ul style="">';
}
function EndSubMenu()
{
	return '</ul></div></div>';
}

//
// Display popup menu if not AOL Mac
//
IsAolMac = false;

Browser = navigator.userAgent;
if ((Browser.indexOf("Macintosh") != -1) && (Browser.indexOf("AOL") != -1))
	IsAolMac = true;

MenuTabHeight = 36;
FullMenuWidth = 765;

IsAolMac = false;

if (IsAolMac)
{	
	document.write(StaticNavMenu);
}
else
{

	//background-image:url(mainnav.gif);
	document.write('<div><div><div style="display:none;width:'+ FullMenuWidth +';padding:0;margin:0;border:0;"><ul id="imenus0" style="width:'+ FullMenuWidth +'px">');

	// What's New
	Menu = StartMenu('Whats New', 106, MenuTabHeight, '/whats_new/index.html', 143, 1);
//function StartMenu(in_MenuName, in_Width, in_Height, in_Link, in_MenuRowWidth, in_LeftOffset)
	//Menu += MenuRow(' Economic Loan Deferment 20/220 - Pathway', '/whats_new/index.html', '');
	//Menu += MenuRow('Leadership Opportunities for Medical Students', '/getting_involved/medsubcomm.html', ''); 
	//Menu += MenuRow('Med-Peds Newsletter', '/whats_new/MPStudentNewsletterApril2008.doc', '');
	Menu += EndMenu();

	// Pediatrics Career 
	SubMenuWidth = 130;
	Menu += StartMenu('Pediatrics Career', 94, MenuTabHeight, '/ped_career/', 166);

	Menu += MenuRow('Pediatrics 101', '/ped_career/', '');
	Menu += MenuRow('General Pediatrics', '/ped_career/genpeds.html', '');
	Menu += MenuRow('Pediatric Subspecialties', 'http://www.aap.org/family/pedspecfactsheets.htm', '');
	Menu += MenuRow('Alternative Careers in Pediatrics', '/ped_career/alt_careers.html', '');
	Menu += MenuRow('Practice Management Online', '/ped_career/pmo.html', '');
		
	Menu += EndMenu();
	

	// Educational Resources
	Menu += StartMenu('Educational Resources', 105, MenuTabHeight, '/educ_resources/nce.html', 177);

	Menu += MenuRow('Medical Student Newsletter', '/educ_resources/newsletter.html', '');
	Menu += MenuRow('AAP National Conference', '/educ_resources/nce.html', '');
	Menu += MenuRow('Online Resources & Publications', '/educ_resources/ed_resources.html', '');

	Menu += EndMenu();


	// Advocacy
	MenuWidth = 158;
	SubMenuWidth = 168;
	Menu += StartMenu('Advocacy', 86, MenuTabHeight, '/advocacy/', (MenuWidth+3));

	SubMenu = StartSubMenu(SubMenuWidth, MenuWidth);
	SubMenu += SubMenuRow('SOMSRFT Advocacy', '/advocacy/adv_campaigns.html');
	SubMenu += SubMenuRow('State, Chapter, and District Advocacy', '/advocacy/adv_resources.html');
	SubMenu += SubMenuRow('Department of Federal Affairs', '/advocacy/dept_fed_affairs.html');
	SubMenu += EndSubMenu();
	Menu += MenuRow('Getting Involved', '/advocacy/', SubMenu);
	
	
	SubMenu = StartSubMenu(SubMenuWidth, MenuWidth);
	SubMenu += SubMenuRow('Picking an Advocacy Project', '/advocacy/adv_project.html', '');
	SubMenu += SubMenuRow('Talking with Your Legislator', '/advocacy/talk_legislator.html', '');
	SubMenu += SubMenuRow('How Does a Bill Become Law?', '/advocacy/bill_law.html', '');
	SubMenu += SubMenuRow('IRB: What, When, and Where', '/advocacy/irb.html', '');
	SubMenu += EndSubMenu();

	Menu += MenuRow('The Basics - Getting Started', '/advocacy/adv_project.html', SubMenu);
	
	SubMenu = StartSubMenu(SubMenuWidth, MenuWidth);
	SubMenu += SubMenuRow('Child Advocate in 5 Minutes', '/advocacy/become_child_advocate.html', '');
	SubMenu += SubMenuRow('Voter Registration', '/advocacy/voter_registration.html', '');
	SubMenu += SubMenuRow('Additional Resources', '/advocacy/add_resources.html', '');
	SubMenu += EndSubMenu();

	Menu += MenuRow('Advocacy Resources', '/advocacy/become_child_advocate.html', SubMenu);
	
	Menu += MenuRow('Leadership Resources', '/advocacy/leader_resources.html', '');
	
	SubMenu = StartSubMenu(SubMenuWidth, MenuWidth);
	SubMenu += SubMenuRow('Introduction', '/advocacy/leader_resources.html', '');
	SubMenu += EndSubMenu();



	Menu += EndMenu();


	// Getting Involved
	Menu += StartMenu('Getting Involved', 82, MenuTabHeight, '/getting_involved/', 186);
	
	Menu += MenuRow('Clinical Case Presentations', '/getting_involved/clinicalcasepres.html', '');
	Menu += MenuRow('Medical Student Subcommittee', '/getting_involved/medsubcomm.html', '');
	Menu += MenuRow('Pediatric Interest Groups', '/getting_involved/', '');
	Menu += MenuRow('Medical Student Organizations', '/getting_involved/organizations.html', '');
	Menu += MenuRow('SOMSRFT Opportunities', '/getting_involved/opportunities.html', '');

	Menu += EndMenu();


	// Meetings & Events
	Menu += StartMenu('Meetings & Events', 86, MenuTabHeight, '/meetings_events/', 180);
	
	Menu += MenuRow('National Conference and Exhibition (NCE)', 'http://www.aap.org/nce/', '');
	Menu += MenuRow('AAP Chapter & District information', 'http://www.aap.org/member/chapters/chapserv.htm', '');
	Menu += MenuRow('PediaLink CME Finder', 'http://www.pedialink.org/cme/_coursefinder/', '');

	Menu += EndMenu();

	// Residency
	MenuWidth = 94;
	SubMenuWidth = 120;
	Menu += StartMenu('Education', 89, MenuTabHeight, '/residency/', 133);

	Menu += MenuRow('The MATCH', '/residency/', '');
	Menu += MenuRow('Residency Requirements', '/residency/res_requirements.html', '');
	
	Menu += EndMenu();

	// SOMSRFT
	MenuWidth = 94;
	SubMenuWidth = 120;
	Menu += StartMenu('SOMSRFT', 111, MenuTabHeight, '/aap_resident/', 172, -58);

	Menu += MenuRow('About SOMSRFT', '/aap_resident/', '');
	// Menu += MenuRow('Letter from Chair', '/aap_resident/letter_chair.html', '');
	// Menu += MenuRow('Current Resident Section Leaders', '/aap_resident/section_leaders.html', '');
	// Menu += MenuRow('Current Resident Section Liaisons', '/aap_resident/section_liaisons.html', '');
	// Menu += MenuRow('Resident District Web Pages', '/aap_resident/res_webpages.html', '');
	// Menu += MenuRow('Resident Report', '/aap_resident/res_report.asp', '');
	// Menu += MenuRow('Resident District Newsletters', '/aap_resident/newsletters.html', '');
	
	Menu += EndMenu();

document.write(Menu+'</ul><div style="clear:left;"></div></div></div></div>');

/*

     Tips & Tricks

       1: Adjust the "function menudata0()" numeric id in the statement below to match the numeric id of
        the id='imenus0' statement within the menu structure and links secion above. The numbers must 
        match for the menu to work, multiple menus may be used on a single page by adding new sections 
        with new id's.

       2: To specifically define settings for an individual item or container, apply classes or inline styles
        directly to the UL and A tags in the HTML tags which define your menus structure and links above.

       3: Use the parameter options below to define borders and padding. Borders and padding specified
        within the menus HTML structure may cause positioning and actual sizing to be offset a bit in
        some browsers.
 
*/




/*-------------------------------------------------
************* Parameter Settings ******************
---------------------------------------------------*/


function imenus_data0(){


	this.enable_visual_design_mode = false			//turns the visual design pad option on or off
	this.main_is_horizontal = true
	this.menu_showhide_delay = 220;//180


  /*---------------------------------------------
  Expand Icon Images
  ---------------------------------------------*/

	this.main_expand_image = ""
	this.main_expand_image_hover = ""
	this.main_expand_image_width = ""
	this.main_expand_image_height = ""
	this.main_expand_image_offx = ""
	this.main_expand_image_offy = ""

	this.sub_expand_image = SiteRootFolder+"/shared/arrow_sub.gif"
	this.sub_expand_image_hover = SiteRootFolder+"/shared/arrow_sub.gif"
	this.sub_expand_image_width = "10"
	this.sub_expand_image_height = "13"
	this.sub_expand_image_offx = "0"
	this.sub_expand_image_offy = "0"



  /*---------------------------------------------
  Global Menu Styles
  ---------------------------------------------*/

	//Main Menu
//background-color:#06437d; 
	this.main_container_styles = "border-style:solid; border-color:#769bba; border-width:1px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; "
	this.main_item_styles = "background-color:; background-image:; color:#e6e6e6; text-align:center; font-family:Arial; font-size:12px; font-weight:bold; text-decoration:none; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-style:none; border-color:#000000; border-width:0px;"
	this.main_item_hover_styles = "color:#FAF4E5; "
	this.main_item_active_styles = ""



	//Sub Menu
//background-color:#E5F4E1;
	this.subs_container_styles = "background-color:#E5F4E1;border-style:solid; border-color: #B5D8AB; border-width:1px 1px 1px 1px; padding-top:0px; padding-right:0px; padding-bottom:6px; padding-left:0px; margin-left:1px;"
	this.subs_item_styles = "background-color:#E5F4E1; color:#456B3B; text-align:left; font-family:arial; font-size:10px; font-weight:normal; text-decoration:none; padding-top:3px; padding-right:5px; padding-bottom:3px; padding-left:7px; margin:0"
	this.subs_item_hover_styles = "background-color:#317121;font-weight:;text-decoration:;"
	this.subs_item_active_styles = "background-color:#317121; color:#FAF4E5; font-weight:; text-decoration:;"




}

} // end if IsAolMac
