// Switches mainMasthead Img
var image = new Array(8) // do not change this

image[0] = "./pix/healthMast_03.jpg"; 
image[1] = "./pix/itMast_03.jpg"; 
image[2] = "./pix/agricultureMast_03.jpg"; 
image[3] = "./pix/businessMast_03.jpg";  
image[4] = "./pix/familyMast_03.jpg"; 
image[5] = "./pix/marketingMast_03.jpg"; 
image[6] = "./pix/skilledMast_03.jpg"; 
image[7] = "./pix/techMast_03.jpg";   
var p = image.length;

var map = new Array(8)

map[0] = "#healthSci";
map[1] = "#IT"; 
map[2] = "#agriculture"; 
map[3] = "#business";  
map[4] = "#family"; 
map[5] = "#marketing"; 
map[6] = "#skilled"; 
map[7] = "#tech"; 
  
var whichImage = Math.round(Math.random()*(p-1));
var whichMap = whichImage
function  showText(){
//$('#masthead').css('background-image','url('+image[whichImage]+')');
document.write('<img src='+image[whichImage]+' usemap='+map[whichMap]+'>');

}


   $(document).ready(function(){  
       
       
     //decide what page we're on and then change the rotating facts
   
    var $url = window.location.pathname;
    $url = $url.split('/');
    $str = 1;
    
    if($str < 0){
        if($url[1]){
            //this will probably need to be changed to url[2]
            var $str2 = $url[1];
        }else{
            var $str2 = "";
        }
        if(!$str2){
            var HOME_DIR = '';
        }else if($str2.search('.php') > 0){
            var HOME_DIR = '../';
        }else{
            var HOME_DIR = '../../';
        }
    }else{
        var HOME_DIR = '';
    }
 

     $("ul.topnav li a").hover(function() { //When trigger is clicked...     
 //Following events are applied to the subnav itself (moving subnav up and down)  
       $(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click  
  
       $(this).parent().hover(function() {  
      }, function(){  
           $(this).parent().find("ul.subnav").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up  
      });  

      //Following events are applied to the trigger (Hover events for the trigger)  
      }).hover(function() {  
          $(this).addClass("subhover"); //On hover over, add class "subhover"  
      }, function(){  //On Hover Out  
           $(this).removeClass("subhover"); //On hover out, remove class "subhover"  
    });  
    
  
  /**
* This script finds the page we are on and then sets the header image to active
*/
var pathname = window.location.pathname;

pathname = pathname.split('/');
pathname = pathname[1]; 
switch(pathname){ 
   
    case 'about':
        $('.topnav').find('li').find("a:contains('ABOUT')").css('color','#c9cbcd');
        $("<div id=\"arrow_div\" style=\"position:relative;\"><img id=\"arrow\" src=\"../pix/activeArrow_03.png\" /></div>").appendTo(".navshadow");
        $("#arrow").css({
            'position':'absolute',
            'top':'50px',
            'left':'260px'
        });
        break;
    case 'career':
        $('.topnav').find('li').find("a:contains('CAREER')").css('color','#c9cbcd');
        $("<div id=\"arrow_div\" style=\"position:relative;\"><img id=\"arrow\" src=\"../../pix/activeArrow_03.png\" /></div>").appendTo(".navshadow");
        $("#arrow").css({
            'position':'absolute',
            'top':'50px',
            'left':'400px'
        });
		
        break;
    case 'schools':
        $('.topnav').find('li').find("a:contains('SCHOOL')").css('color','#c9cbcd');
        $("<div id=\"arrow_div\" style=\"position:relative;\"><img id=\"arrow\" src=\"../pix/activeArrow_03.png\" /></div>").appendTo(".navshadow");
        $("#arrow").css({
            'position':'absolute',
            'top':'50px',
            'left':'535px'
        });
        break;
    case 'testimonials':
        $('.topnav').find('li').find("a:contains('TESTIMONIALS')").css('color','#c9cbcd');
        $("<div id=\"arrow_div\" style=\"position:relative;\"><img id=\"arrow\" src=\"../pix/activeArrow_03.png\" /></div>").appendTo(".navshadow");
        $("#arrow").css({
            'position':'absolute',
            'top':'50px',
            'left':'655px'
        });
        break;
    case 'educators-parents':
        $('.topnav').find('li').find("a:contains('EDUCATORS')").css('color','#c9cbcd');
        $("<div id=\"arrow_div\" style=\"position:relative;\"><img id=\"arrow\" src=\"../pix/activeArrow_03.png\" /></div>").appendTo(".navshadow");
        $("#arrow").css({
            'position':'absolute',
            'top':'50px',
            'left':'820px'
        });
        break;
        
    
}

 
}); 
