/*
	Free Credit Report Song scripts (utilizing jQuery 1.2.6)
	Developed by Saforian
*/

/* --- IE6 foreground PNG fix --- */
function iepngfix() {

	// IE 5.5 and 6.0 PNG filter support (derived from youngpup.net)
	$("img[src$=png]").each(function(){
		var src = this.src;
		var div = document.createElement("div");

		// Set replacement div properties
		div.id = this.id;
		div.className = this.className;
		div.title = this.title || this.alt;
		div.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizing='scale')";
		div.style.width = this.width + "px";
		div.style.height = this.height + "px";

		// Replace image with transparent div
		this.replaceNode(div);
	});
}


/* --- Initialize page --- */
$(document).ready(function(){

	/* --- Videos --- */
	if (document.getElementById("videoplayer")) {


		// Hide all videos
		$("#videoplayer>div").hide();
		//not showing the first vid onload...$("#btm_video_thumbs div:first>a").addClass("active");

		// Click thumbnails
		$(".vidthumb a").click(function(){
			// Stop if already showing
			//not showing the first vid onload...if ($(this).is(".active")) { return false; }

			// Switch video
			$("#videoplayer>div:visible").hide();
			$(this.hash).show();

			// Switch active link
			$("#btm_video_thumbs a.active").removeClass("active");
			$(this).addClass("active");

			return false;
		});
		
// the "close" buttons in the video boxes"
		$(".video_close img").click(function(){
			$("#videoplayer>div:visible").hide();
				return false;
		});
		
	}

// IE6 helper functions
	if ($.browser.msie && $.browser.version < 7) {

		// PNG fix
		iepngfix();
	}


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~rollover beethoven

if ($.browser.msie && $.browser.version < 7) {
//nothing
}
else {
$(".rollover").hover(
 function() {
  curr = $(this).find("img").attr("src");
  overlen = curr.length;
  over = curr.substr(0, overlen-4);
  over = over+'_over.png';
  $(this).find("img").attr({ src: over});
 },
 function() {
  $(this).find("img").attr({ src: curr});
 }
)

$(".rollover").find("img").each(function(i) {
  temp = this.src;
  prelen = temp.length;
  pre = temp.substr(0, prelen-4);
  pre = pre+'_over.png';
  preload_image_object = new Image();
  preload_image_object.src = pre;
});
}

	// hides the clouds as soon as the DOM is ready
	$("div.cloud").hide();
// For IE
if ($.browser.msie && $.browser.version < 7) {
	$("#videobar a").hover(function(){
		var cloudnumber = this.hash.substr(this.hash.length-1,1);
		$("#cloud" + cloudnumber).show();
	}, function(){
		var cloudnumber = this.hash.substr(this.hash.length-1,1);
		$("#cloud" + cloudnumber).hide();
	});
}
//for everyone else
else {
	$("#videobar a").hover(function(){
		var cloudnumber = this.hash.substr(this.hash.length-1,1);
		$("#cloud" + cloudnumber).fadeIn('fast');
	}, function(){
		var cloudnumber = this.hash.substr(this.hash.length-1,1);
		$("#cloud" + cloudnumber).fadeOut('fast');
	});
}


// for the white content box with rounded corners

$(".box").wrap('<div class="rounded_box"></div>');
$(".box").before('<div class="box_top"></div>').after('<div class="box_bottom"></div>');

// this throws a div.class"inner" inside the callouts on the right side

$(".callout").wrapInner('<div class="inside"></div>');

// set the nav items to their active state

$("#lyrics #nav-videos a").addClass("active");
$("#blog #nav-blog a").addClass("active");
$("#music #nav-music a").addClass("active");
$("#home #nav-home a").addClass("active");


//~~~~~~~~~~~~~~~
if (document.getElementById("music")) {
		$(".mp3").jmp3();
		// custom options
		$("#mysong").jmp3({
			backcolor: "000000",
			forecolor: "00ff00",
			width: 200,
			showdownload: "true"
		});
		}
		

//~~~~~~~~~~~~~~
});