$(document).ready(function() {//CLEAR FIELDS
$("input#theemail").focus(function () {
if ($(this).val() == "Email Address") {
$(this).val("");
}
});
// MENU IMAGE ROLLOVERS //// Preload all rollovers
		$("#menu img").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			if (!rollsrc.match(/_over/)) {
			rollON = rollsrc.replace(/.gif$/ig,"_over.gif");
			$("<img>").attr("src", rollON);
		}
		});
		
		// Navigation rollovers
		$("#menu a").mouseover(function(){
			imgsrc = $(this).children("img").attr("src");
			matches = imgsrc.match(/_over/);
			if (!matches) {
			imgsrcON = imgsrc.replace(/.gif$/ig,"_over.gif"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
			}
		});
		$("#menu a").mouseout(function(){
			$(this).children("img").attr("src", imgsrc);
		});	// HOVER-FADE FUNCTIONS$("a.fade img").hover(function() {// animate opacity to full$(this).stop().animate({ opacity: 0.75 }, 200); },// on mouse outfunction () {// animate opacity to nill$(this).stop().animate({ opacity: 1 }, 200);});


//SCROLLING
$(".scroll").click(function(event){
//prevent the default action for the click event
event.preventDefault();
//get the full url - like mysitecom/index.htm#home
var full_url = this.href;
//split the url by # and get the anchor target name - home in mysitecom/index.htm#home
var parts = full_url.split("#");
var trgt = parts[1];
//get the top offset of the target anchor
var target_offset = $("#"+trgt).offset();
var target_top = target_offset.top;
//goto that anchor by setting the body scroll top to anchor top
$('html, body').animate({scrollTop:target_top}, 500);
});

//OPEN WINDOW
$('.openplayer').click(function (event){
// Gets the URL from the clicked link.
var url = $(this).attr("href");
var windowName = "playerWindow";
window.open(url, windowName, 'width=362,height=250,scrollbars=no,toolbar=no,status=no,resizable=yes');
/*Prevents the browser from executing the default action and
allows us to use the "window.open" within our script.*/
event.preventDefault();
});
});//END DOM
