jQuery.preloadImages = function()
{
	for(var i = 0; i<arguments.length; i++) {
	alert('processing: ' + arguments[i]);
		jQuery("<img>").attr("src", arguments[i]);
	}
}

$(document).ready(function(){
	$("#hear_button").click(function(){
		var offset = $("#hear_button").offset();
		var offset_wrapper = $("#footer").offset();
		var pos_x = offset.left - offset_wrapper.left;
		var pos_y = offset.top;

		var w_button = $("#hear_button").width();
		var w_nav = $("#hear_subnav").width();
		var more_offset = (w_nav - w_button) / 2 + 10;
		pos_x = pos_x - more_offset;

		//with all the folding divs, window.height does not work- calculate for each menu height
		var bottom_val = 60;
		$("#hear_subnav").css("left",pos_x + "px");
		$("#hear_subnav").css("bottom",bottom_val + "px");

		var cur_stat = $("#hear_subnav").css("display");
		if(cur_stat == 'none') {
			$("#see_subnav").hide('slow');
			$("#save_subnav").hide('slow');
			$("#enhance_subnav").hide('slow');
		}
		$("#hear_subnav").toggle('slow');
	});
	$("#see_button").click(function(){
		var offset = $("#see_button").offset();
		var offset_wrapper = $("#footer").offset();
		var pos_x = offset.left - offset_wrapper.left;
		var pos_y = offset.top;

		var w_button = $("#see_button").width();
		var w_nav = $("#see_subnav").width();
		var more_offset = (w_nav - w_button) / 2 + 10;
		pos_x = pos_x - more_offset;

		var win_height = $(window).height();
		var bottom_val = 60;
		$("#see_subnav").css("left",pos_x + "px");
		$("#see_subnav").css("bottom",bottom_val + "px");

		var cur_stat = $("#see_subnav").css("display");
		if(cur_stat == 'none') {
			$("#hear_subnav").hide('slow');
			$("#save_subnav").hide('slow');
			$("#enhance_subnav").hide('slow');
		}
		$("#see_subnav").toggle('slow');
	});
	$("#save_button").click(function(){
		var offset = $("#save_button").offset();
		var offset_wrapper = $("#footer").offset();
		var pos_x = offset.left - offset_wrapper.left;
		var pos_y = offset.top;

		var w_button = $("#save_button").width();
		var w_nav = $("#save_subnav").width();
		var more_offset = (w_nav - w_button) / 2 + 10;
		pos_x = pos_x - more_offset;

		var win_height = $(window).height();
		var bottom_val = 60;
		$("#save_subnav").css("left",pos_x + "px");
		$("#save_subnav").css("bottom",bottom_val + "px");

		var cur_stat = $("#save_subnav").css("display");
		if(cur_stat == 'none') {
			$("#hear_subnav").hide('slow');
			$("#see_subnav").hide('slow');
			$("#enhance_subnav").hide('slow');
		}
		$("#save_subnav").toggle('slow');
	});
	$("#enhance_button").click(function(){
		var offset = $("#enhance_button").offset();
		var offset_wrapper = $("#footer").offset();
		var pos_x = offset.left - offset_wrapper.left;
		var pos_y = offset.top;

		var w_button = $("#enhance_button").width();
		var w_nav = $("#enhance_subnav").width();
		var more_offset = (w_nav - w_button) / 2 + 10;
		pos_x = pos_x - more_offset;

		var win_height = $(window).height();
		var bottom_val = 60;
		$("#enhance_subnav").css("left",pos_x + "px");
		$("#enhance_subnav").css("bottom",bottom_val + "px");

		var cur_stat = $("#enhance_subnav").css("display");
		if(cur_stat == 'none') {
			$("#hear_subnav").hide('slow');
			$("#see_subnav").hide('slow');
			$("#save_subnav").hide('slow');
		}
		$("#enhance_subnav").toggle('slow');
	});


	$("#background_select").click(function(){
		$("#background_changer_popup").slideToggle('normal');
	});
	$("#hear_button").hover(function() {
		$("#hear_default").fadeOut(300);
		}, function() {
		$("#hear_default").fadeIn(300);
	});
	$("#see_button").hover(function() {
		$("#see_default").fadeOut(300);
		}, function() {
		$("#see_default").fadeIn(300);
	});
	$("#save_button").hover(function() {
		$("#save_default").fadeOut(300);
		}, function() {
		$("#save_default").fadeIn(300);
	});
	$("#enhance_button").hover(function() {
		$("#enhance_default").fadeOut(300);
		}, function() {
		$("#enhance_default").fadeIn(300);
	});
	$("#support_button").hover(function() {
		$("#support_default").fadeOut(300);
		}, function() {
		$("#support_default").fadeIn(300);
	});
	$("#about_button").hover(function() {
		$("#about_default").fadeOut(300);
		}, function() {
		$("#about_default").fadeIn(300);
	});
	$("#shop_button").hover(function() {
		$("#shop_default").fadeOut(300);
		}, function() {
		$("#shop_default").fadeIn(300);
	});

	//and now the menu items
	$(".audio_ipod").hover(function() {
		$("#audio_ipod_default").fadeOut(300);
		}, function() {
		$("#audio_ipod_default").fadeIn(300);
	});
	$(".audio_portable").hover(function() {
		$("#audio_portable_default").fadeOut(300);
		}, function() {
		$("#audio_portable_default").fadeIn(300);
	});
	$(".audio_home").hover(function() {
		$("#audio_home_default").fadeOut(300);
		}, function() {
		$("#audio_home_default").fadeIn(300);
	});
	$(".audio_karaoke").hover(function() {
		$("#audio_karaoke_default").fadeOut(300);
		}, function() {
		$("#audio_karaoke_default").fadeIn(300);
	});
	$(".audio_voice").hover(function() {
		$("#audio_voice_default").fadeOut(300);
		}, function() {
		$("#audio_voice_default").fadeIn(300);
	});
	$(".audio_accessories").hover(function() {
		$("#audio_accessories_default").fadeOut(300);
		}, function() {
		$("#audio_accessories_default").fadeIn(300);
	});
	$(".video_portable").hover(function() {
		$("#video_portable_default").fadeOut(300);
		}, function() {
		$("#video_portable_default").fadeIn(300);
	});



	$(".video_home").hover(function () {
		$("#video_home_default").attr("src","/images/video_home_high.jpg");
	}, function() {
		$("#video_home_default").attr("src","/images/video_home.jpg");
	});


	
/*	$(".video_home").hover(function() {
		$("#video_home_default").fadeOut(300);
		}, function() {
		$("#video_home_default").fadeIn(300);
	});*/
	$(".video_photo").hover(function() {
		$("#video_photo_default").fadeOut(300);
		}, function() {
		$("#video_photo_default").fadeIn(300);
	});
	$(".video_accessories").hover(function() {
		$("#video_accessories_default").fadeOut(300);
		}, function() {
		$("#video_accessories_default").fadeIn(300);
	});
	$(".media_media").hover(function() {
		$("#media_media_default").fadeOut(300);
		}, function() {
		$("#media_media_default").fadeIn(300);
	});
	$(".media_drives").hover(function() {
		$("#media_drives_default").fadeOut(300);
		}, function() {
		$("#media_drives_default").fadeIn(300);
	});
	$(".media_blu").hover(function() {
		$("#media_blu_default").fadeOut(300);
		}, function() {
		$("#media_blu_default").fadeIn(300);
	});
	$(".media_simple").hover(function() {
		$("#media_simple_default").fadeOut(300);
		}, function() {
		$("#media_simple_default").fadeIn(300);
	});
	$(".media_hd").hover(function() {
		$("#media_hd_default").fadeOut(300);
		}, function() {
		$("#media_hd_default").fadeIn(300);
	});
	$(".media_flash").hover(function() {
		$("#media_flash_default").fadeOut(300);
		}, function() {
		$("#media_flash_default").fadeIn(300);
	});
	$(".accessories_laptop").hover(function() {
		$("#accessories_laptop_default").fadeOut(300);
		}, function() {
		$("#accessories_laptop_default").fadeIn(300);
	});
	$(".accessories_storage").hover(function() {
		$("#accessories_storage_default").fadeOut(300);
		}, function() {
		$("#accessories_storage_default").fadeIn(300);
	});
	$(".accessories_labeling").hover(function() {
		$("#accessories_labeling_default").fadeOut(300);
		}, function() {
		$("#accessories_labeling_default").fadeIn(300);
	});
	$(".accessories_cleaning").hover(function() {
		$("#accessories_cleaning_default").fadeOut(300);
		}, function() {
		$("#accessories_cleaning_default").fadeIn(300);
	});
		


});


$(document).ready(function(){

	$(".video_home_lcd2").hover(function () {
		$(".video_home_lcd2").attr("src","/images/video_home_lcd_high.jpg");
	}, function() {
		$(".video_home_lcd2").attr("src","/images/video_home_lcd.jpg");
	}); 

/*    $(".video_home_lcd2").mouseover(function () {
      $(".video_home_lcd2").css({ background:"url('/images/video_home_lcd_high.jpg')"});
});
    $(".video_home_lcd2").mouseout(function () {
      $(".video_home_lcd2").css({ background: "url('/images/video_home_lcd.jpg')"});
}); */
    $(".video_home_converters").mouseover(function () {
      $(".video_home_converters").css({ background:"url('/images/video_home_converters_high.jpg')"});
});
    $(".video_home_converters").mouseout(function () {
      $(".video_home_converters").css({ background: "url('/images/video_home_converters.jpg')"});
});
    $(".video_home_crt").mouseover(function () {
      $(".video_home_crt").css({ background:"url('/images/video_home_crt_high.jpg')"});
});
    $(".video_home_crt").mouseout(function () {
      $(".video_home_crt").css({ background: "url('/images/video_home_crt.jpg')"});
});
    $(".video_home_dvd").mouseover(function () {
      $(".video_home_dvd").css({ background:"url('/images/video_home_dvd_high.jpg')"});
});
    $(".video_home_dvd").mouseout(function () {
      $(".video_home_dvd").css({ background: "url('/images/video_home_dvd.jpg')"});
});   });

$(document).ready(function(){
    $(".media_media_dvdwrite").mouseover(function () {
      $(".media_media_dvdwrite").css({ background:"url('/images/media_media_dvdwrite_high.jpg')"});
});
    $(".media_media_dvdwrite").mouseout(function () {
      $(".media_media_dvdwrite").css({ background: "url('/images/media_media_dvdwrite.jpg')"});
});
    $(".media_media_dvdrewrite").mouseover(function () {
      $(".media_media_dvdrewrite").css({ background:"url('/images/media_media_dvdrewrite_high.jpg')"});
});
    $(".media_media_dvdrewrite").mouseout(function () {
      $(".media_media_dvdrewrite").css({ background: "url('/images/media_media_dvdrewrite.jpg')"});
});
    $(".media_media_cdwrite").mouseover(function () {
      $(".media_media_cdwrite").css({ background:"url('/images/media_media_cdwrite_high.jpg')"});
});
    $(".media_media_cdwrite").mouseout(function () {
      $(".media_media_cdwrite").css({ background: "url('/images/media_media_cdwrite.jpg')"});
});
    $(".media_media_cdrewrite").mouseover(function () {
      $(".media_media_cdrewrite").css({ background:"url('/images/media_media_cdrewrite_high.jpg')"});
});
    $(".media_media_cdrewrite").mouseout(function () {
      $(".media_media_cdrewrite").css({ background: "url('/images/media_media_cdrewrite.jpg')"});
});

});

$(document).ready(function(){
    $(".audio_portable_digital").mouseover(function () {
      $(".audio_portable_digital").css({ background:"url('/images/audio_portable_digital_high.jpg')"});
});
    $(".audio_portable_digital").mouseout(function () {
      $(".audio_portable_digital").css({ background: "url('/images/audio_portable_digital.jpg')"});
});
    $(".audio_portable_cd").mouseover(function () {
      $(".audio_portable_cd").css({ background:"url('/images/audio_portable_cd_high.jpg')"});
});
    $(".audio_portable_cd").mouseout(function () {
      $(".audio_portable_cd").css({ background: "url('/images/audio_portable_cd.jpg')"});
});
});
