// JavaScript Document
/*
		Local Variables
------------------------------------------------------------------*/

/*
		Menu Structures
------------------------------------------------------------------*/
var sub1 = '<ul id="subMenu"><li><a href="http://www.west.edu/why_wiu/WIU-The-WIU-Difference.htm">The WIU Difference</a></li><li><a href="http://www.west.edu/why_wiu/WIU-Interactive-Online.htm">WIU <strong><em>Interactive</em></strong> Online<sup>SM</sup> </a> </li><li><a href="http://www.west.edu/why_wiu/WIU-Campus-Locations.htm">Campus Locations </a> </li><li><a href="http://www.west.edu/why_wiu/WIU-About-WIU.htm">About WIU</a></li><li><a href="http://www.west.edu/why_wiu/WIU-Memberships-And-Affiliations.htm">Memberships &amp; Affiliations</a></li><li><a href="http://www.west.edu/why_wiu/WIU-Announcements.htm">Announcements</a></li></ul>';

var sub2 = '<ul id="subMenu"><li><a href="http://rfi.west.edu/">Request Information</a> </li><li><a href="http://www.west.edu/getting_started/WIU-Apply-To-WIU.htm">Apply Now </a></li><li><a href="http://www.west.edu/getting_started/WIU-Financing-Your-Education-At-WIU.htm">Financing Your Education </a> </li><li><a href="http://www.west.edu/getting_started/WIU-International-Students.htm">International Students</a></li><li><a href="http://www.west.edu/getting_started/WIU-Military-Students.htm">Military Students</a></li><li><a href="http://www.west.edu/getting_started/WIU-Apollo-Group-Employee-Application.htm">Apollo Employees</a></li></ul>';

var sub3 = '<ul id="subMenu"><li><a href="http://www.west.edu/your_education/WIU-degree-programs.htm">Degree Programs</a></li><li><a href="http://www.west.edu/your_education/WIU-Course-Schedules.htm">Course Schedules</a></li><li><a target="_self" href="http://www.west.edu/your_education/WIU-Catalog.htm">Catalog</a></li><li><a href="http://www.west.edu/your_education/WIU-Faculty.htm">Faculty </a></li><li><a href="http://www.west.edu/your_education/WIU-Student-Success.htm">Student Success</a></li><li><a href="http://www.west.edu/your_education/WIU-Honors-College.htm">WIU Honors College</a></li></ul>';

var sub4 = '<ul id="subMenu"><li><a href="http://www.west.edu/earned_credit/WIU-transcript-request-forms.htm">Transcript Request Forms</a></li><li><a href="http://www.west.edu/earned_credit/WIU-National-Tests-For-Credit.htm">National Tests for Credit</a></li><li><a href="http://www.west.edu/earned_credit/WIU-Assessment-of-Prior-Learning.htm">Assessment of Prior Learning</a></li><li><a href="http://www.west.edu/earned_credit/WIU-College-Transfer-Guides.htm">College Transfer Guides</a></li><li><a href="http://www.west.edu/earned_credit/WIU-US-Military-Experience.htm">U.S. Military Experience</a></li><li><a href="http://www.west.edu/earned_credit/WIU-Foreign-Language-Evaluation.htm">Foreign Language Evaluation</a></li></ul>';

var sub5 = '<ul id="subMenu"><li><a href="http://www.west.edu/student_services/WIU-Frequently-Asked-Questions.htm">FAQs</a></li><li><a href="http://www.west.edu/student_services/WIU-MyWIU.htm">MyWIU</a></li><li><a href="http://www.west.edu/student_services/WIU-Store.htm">WIU Store</a></li><li><a href="http://www.west.edu/student_services/WIU-Education-Resources.htm">Education Resources</a></li><li><a href="http://www.west.edu/student_services/WIU-Organizations.htm">Organizations</a></li><li><a href="http://www.west.edu/student_services/WIU-Disability-Services.htm">Disability Services</a></li></ul>'; 


/*       Check if jQuery library and menu css is loaded.
		 If not add it to the head tag and set interval to check when it is loaded,
		 Once it is add the menu code to the appropriate tags.
-----------------------------------------------------------------*/



if(typeof $ == 'undefined'){
	includeScript('http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js');
	includeStyle('includes/menu_styles.css');
	var jCheck1 = setInterval(LoadMenu,800);
}else{
      $(document).ready(function() {
			includeStyle('includes/menu_styles.css');
			LoadMenu();
      });
}



/*
		Function to load subMenu's dropdown
-----------------------------------------------------------------*/
function LoadMenu(){
	var mOver = false;
	if(typeof $ == 'undefined'){// if not loaded yet do this code
		//var msg = document.createTextNode("Loading...");
		
		//alert("testing");
	}// if it is loaded add drop down html to navigation tags, and add hover function
	else{
		// define functino to create image tags for preloading images for navigation rollovers
		jQuery.preloadImages = function()
		{
		  for(var i = 0; i<arguments.length; i++)
		  {
			jQuery("<img>").attr("src", arguments[i]);
		  }
		}
		// preload main nav rollover images
		$.preloadImages("/images/mnnav_2on.gif", "/images/mnnav_1on.gif", "/images/mnnav_3on.gif", "/images/mnnav_4on.gif", "/images/mnnav_5on.gif");
		$('.mnnv1').append(sub1);
		$('.mnnv2').append(sub2);
		$('.mnnv3').append(sub3);
		$('.mnnv4').append(sub4);
		$('.mnnv5').append(sub5);
		$('.mnnv1').addClass('ddMenu');
		$('.mnnv2').addClass('ddMenu');
		$('.mnnv3').addClass('ddMenu');
		$('.mnnv4').addClass('ddMenu');
		$('.mnnv5').addClass('ddMenu');
		// set the hover function for dropdowns
		$('.ddMenu').hover(function(){
			
			
				
				$(this).find('#subMenu').slideDown(0.5);	
			
		},function(){
				$(this).find('#subMenu').slideUp(0.5);	
			
		});				
		// stop checking if jquery is loaded
		clearInterval(jCheck1);
	}
}



/*		Function to include a script tag the head tag of the current document Taking the path String
		As an argument.
------------------------------------------------------------------*/
function includeScript(filename)
{
	var head = document.getElementsByTagName('head')[0];
	script = document.createElement('script');
	script.src = filename;
	script.type = 'text/javascript';
	head.appendChild(script);
}

/*		Function to include style tag to the head tag of the current document taking the path String
		As an argument.
-----------------------------------------------------------------*/
function includeStyle(filename){
	var head = document.getElementsByTagName('head')[0];
	style = document.createElement('link');
	style.href = filename;
	style.rel = 'stylesheet';
	style.type = 'text/css';
	style.media = 'screen';
	head.appendChild(style);
}