//Scripts for sceneBlog coded and modified by MilliR
//contact me at hellome@milliriba.in
$(document).ready(function() {
		//This is for the Nav Bar Drop Down
		$('.nav li').hover(
			function () {
				//show its submenu
				$('ul', this).slideDown(100);
			}, 
			function () {
				//hide its submenu
				$('ul', this).slideUp(100);         
			}
		);
		
		//On Load, Hide the cat_container
		$(".cat_container").hide(); 
		//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
		$("h5.boxcat").click(function(){
			$(this).toggleClass("active").next().slideToggle("fast");
			return false; //Prevent the browser jump to the link anchor
		});
		
		//On Load, Hide the login_container
		$(".login_container").hide(); 
		//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
		$("h5.loginbox").click(function(){
			$(this).toggleClass("active").next().slideToggle("fast");
		//	return false; //Prevent the browser jump to the link anchor
		});
		$(".login_container").click(function() {
		  $(".login_container").hide();
		//  return false;
		});
		$(".login_container").click(function() {
		  $(".login_container").show();
		 // return false;
		});
		
		//When page loads...
		$(".tab_content").hide(); //Hide all content
		$("ul.pagetabs li:first").addClass("tabactive").show(); //Activate first tab
		$(".tab_content:first").show(); //Show first tab content
		//On Click Event
		$("ul.pagetabs li").click(function() {
			$("ul.pagetabs li").removeClass("tabactive"); //Remove any "tabactive" class
			$(this).addClass("tabactive"); //Add "tabactive" class to selected tab
			$(".tab_content").hide(); //Hide all tab content
			var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
			$(activeTab).fadeIn(); //Fade in the active ID content
			return false;
		});
});

function resizeImage()
{
        var imgWidth=    $("#bhinfo").css("width");
        var imgHeight =  $("#bhinfo").css("height");
        var divWidth = $("#mydiv").css("width") ;
        var divHeight = $("#mydiv").css("height") ;
        originalHeight = imgHeight;
        originalWidth=imgWidth;

        if (imgWidth > divWidth && imgHeight > divHeight)
        {
            var heightDiff = imgHeight  - divHeight;
            var widthDiff = imgWidth  - divWidth;
            //First find out which of the two dimensions is MORE boundry stretching, then we only change that dimension, to keep the image's original proportions.
            if(heightDiff>widthDiff)
            {
                $("#bhinfo").css("height", divHeight); //Set the
            }
            else
            {
                $("#bhinfo").css("width", divWidth); //Set the width to the div's width
            }
        }
        else if(imgWidth > divWidth)
        {
            $("#bhinfo").css("width", divWidth); //Set the width to the div's width
        }
        else if (imgHeight > divHeight)
        {
            $("#bhinfo").css("height", divHeight); //Set the height to the div's height
        }
}

