$(document).ready(function() {
  // IE6 fix for menus
  $('.drop').hover(
    function() {
      $(this).addClass("over")
    },
    function() {
      $(this).removeClass("over")
    }
  )

  // Menu navigation
  $.each(['sub-nav img', 'bottom-nav img'], function() {
    $('#' + this).each(function() {
      if ($(this).attr('src').indexOf('-on') == -1) {
        $(this).hover(
          function() {
            $(this).attr('src', $(this).attr('src').replace('.gif', '-h.gif'))
          },
          function() {
            $(this).attr('src', $(this).attr('src').replace('-h.gif', '.gif'))
          }
        )
      }
    })
  })

	//Ticker code
	try
	
		{
		
			var ticker_holder = $('.ticker-holder').get(0);
		
			var ticker_text = $('.ticker').get(0);
		
			var ticker_pos = ticker_text.parentNode.offsetWidth;

		
			var ticker_data = $(ticker_holder).html();
		

			$(ticker_text).parent().html('<marquee scrollamount="2" scrolldelay="0">' + ticker_data + '</marquee>');

		
			
			$('#sub-nav').hover(
			
				function() { $('marquee', this).get(0).stop();  },
			
				function() { $('marquee', this).get(0).start(); }
		
			);

		
	
		}
	
		catch (o) {}

  // Slides navigation
  $('#slides div img').each(function() {
    $(this).hover(
      function() {
        $(this).attr('src', $(this).attr('src').replace('.jpg', '-h.jpg'))
      },
      function() {
        $(this).attr('src', $(this).attr('src').replace('-h.jpg', '.jpg'))
      }
    )
  })

  // Slides functionality
  $('#slides').glide({
    transition: 1200,
    duration: 10000
  })

  // Subnav and Admin menu highlighting
  $.each(['sub-nav p', 'admin-nav p'], function() {
    $('#' + this).each(function() {
      $(this).hover(
        function() {
          $(this).addClass('highlight')
        },
        function() {
          $(this).removeClass('highlight')
        }
      )
    })
  })
  
  // Open all external links in a new window
  $('a').filter(function() {
    if (this.hostname && (this.hostname !== location.hostname) && ($(this).attr('target') != '_blank'))
      $(this).attr('target', '_blank')
  })
})

function createBookmark() {
  title = "University of Maryland - Women's Basketball";
  url = "http://www.marylandwomensbasketball.com/";

  if (window.sidebar) {
    // Mozilla Firefox Bookmark
    alert("Add the University of Maryland Women's Basketball website to my favorites");
    window.sidebar.addPanel(title, url,"");
  } else if( window.external ) {
    // IE Favorite
    alert("Add the University of Maryland Women's Basketball website to my bookmarks");
    window.external.AddFavorite( url, title);
  } else if(window.opera && window.print) {
    // Opera Hotlist
    return true;
  }
}

function fbs_click() {
  u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer');return false;
}

function myspace_click() {
  u=location.href;t=document.title;window.open('http://www.myspace.com/Modules/PostTo/Pages/?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer');return false;
}

function twitter_click() {
  u=location.href;t=document.title;window.open('http://twitter.com/home?status=Add+This_3A'+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer');return false;
}


