function moverOverImage(_imgEle){
	var src = _imgEle.attr("src").match(/[^\.]+/) + "_hover.gif";
	_imgEle.attr("src", src);
}

function mouseOutImage(_imgEle){
	var src = $(_imgEle).attr("src").replace("_hover", "");
	_imgEle.attr("src", src);
}

function showDropDownMenu(){
	$('#NavPL').show();
	$('#NavSL').show();
}

function hideDropDownMenu(){
	$('#NavPL').hide();
	$('#NavSL').hide();
}

function initHideDropDownMenu(){
	$('#NavPL').hide();
	$('#NavSL').hide();
}

function initHeightAccordingScreen(){
	var picRealHeight = $(".bg").height();
	var cssObj = {
		'height' : picRealHeight//$(window).height()
	}
	$("#frame").css('height',picRealHeight);
	$("#body").css('height',picRealHeight*0.93);
	$("#r2").css('height',picRealHeight*0.17);
	$("#r3").css('height',picRealHeight*0.37);
	
}

function initFontSize(){
	var picRealHeight = $(".bg").height();
	var fontSize = picRealHeight/82;
	var fontSize = fontSize + 'px'
	$("#frame").css('font-size',fontSize);
}

function jQueryEventResize(){
	initHeightAccordingScreen();
	initFontSize();
	initFB();
}

function initFB(){
	var fbLinkOrg ="http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fpages%2FPennyLane-The-Band%2F125709904174269&colorscheme=dark&show_faces=false&stream=true&header=false&";
	var picRealHeight = $(".bg").height();
	var picRealWidth = $(".bg").width();
	var fbWidth = Math.round(picRealWidth*0.47);
	var fbHeight = Math.round(picRealHeight*0.31);
	
	var fbLink = fbLinkOrg + "height=" + fbHeight + "&width=" + fbWidth;

	var cssObj = {
		'height' : fbHeight,
		'width' : fbWidth
	}
	$("#fb-frame").css(cssObj);
	$("#fb-frame").attr("src",fbLink);
}

function initBrowser(){
	initHeightAccordingScreen();
	initFontSize();
	jQuery.event.add(window, "resize", jQueryEventResize);
	moveEvent();	
	initFB();
	$("div").css("display","inherit");
	initHideDropDownMenu();
}

function moveEvent(){
	$("#NavPro").hover(
		function() {
			moverOverImage(jQuery("#ImgNavPro", this));
			showDropDownMenu();
		},
		function() {
			mouseOutImage(jQuery("#ImgNavPro", this));
			hideDropDownMenu();
	});
	
	$("#NavPL").hover(
		function() {
			moverOverImage(jQuery("img", this));
		},
		function() {
		mouseOutImage(jQuery("img", this));
	});
	
	$("#NavSL").hover(
		function() {
			moverOverImage(jQuery("img", this));
		},
		function() {
		mouseOutImage(jQuery("img", this));
	});
	
	$("#NavMedia").hover(
		function() {
			moverOverImage(jQuery("img", this));
		},
		function() {
		mouseOutImage(jQuery("img", this));
	});
	
	$("#NavLinks").hover(
		function() {
			moverOverImage(jQuery("img", this));
		},
		function() {
		mouseOutImage(jQuery("img", this));
	});
	
	$("#NavContact").hover(
		function() {
			moverOverImage(jQuery("img", this));
		},
		function() {
		mouseOutImage(jQuery("img", this));
	});
	
}

$(document).ready(function(){
	window.onload = initBrowser;  //chrome issue
})

