$(document).ready(function() {  
   /* $("#main-nav ul li a").each(function() {
    //    if($(this).parent().hasClass("active"))
    //      $(this).parent().removeClass("active");
        var id = "";
        $(this).mouseover(function() {
            $("#main-nav ul li").each(function() {
                if($(this).hasClass("active")) 
                {
                    id = $(this).attr("id");
                    $(this).removeClass("active");
                }    
            });
            $(this).mouseout(function() {
               if(id != "")
                   $("#"+id).addClass("active"); 
            });
        });
    });*/

    $("li.sliding-element").mouseover(function(){
        $(".sub_menu").hide();
        $("#sliding-navigation li a.active").parent().parent().show();
        $(this).find("ul").show("slow");
    }).mouseout(function() {   
        if(!$(this).find("ul li a").hasClass("active"))
            $(this).find("ul").hide();     
    });

});


$(document).ready(function()
{
	//slides the element with class "menu_body" when paragraph with class "menu_head" is clicked 
	$("#firstpane p.menu_head").click(function()
    {
		$(this).next("div.menu_body").slideToggle(900).siblings("div.menu_body").slideUp("slow");
       	$(this).siblings();
	});
	//slides the element with class "menu_body" when mouse is over the paragraph
	$("#secondpane p.menu_head").mouseover(function()
    {
	     $(this).next("div.menu_body").slideDown(900).siblings("div.menu_body").slideUp("slow");
         $(this).siblings();
    });

    

});


$(document).ready(function() {
       
    //$("#sliding-navigation ul").css({display: "none"}); // Opera Fix
    /*$("#sliding-navigation li").hover(function(){
        var rel = $(this).attr('rel');
        $("#sliding-navigation li ul:not('#"+rel+"')").css({display: "none"});
        if(!$("#sliding-navigation li ul#"+rel).is(":visible")){
            //console.log(rel);
            $(this).find('ul:first').css({display: "none"}).show(400);
        }
    },function(){
        //$(".sub_menu").hide();
        $("#sliding-navigation li a.active").parent().parent().show();
    });*/




	//When page loads...
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabs li").click(function() {

		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" 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;
	});



    $("a.fancy").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over"> ' + (title.length ? ' ' + title : '')  +  '</span>';
				}
            });

});

$(document).ready(function() {
    var size = getPageSize();
    var h = size[1];
    var w = size[0];
    var wh = size[3];
    var ww = size[2];

    var wrh = $(".home_content").height();
    var wrw = $(".home_content").width();
    

    var top = (h/2)-(wrh/2);    
    var left = (w/2)-(wrw/2);
    $("#home_page").css("width",w-2);
    $(".home_content").css("top",top).css("left",left);


});

function getPageSize(){
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {
	xScroll = window.innerWidth + window.scrollMaxX;
	yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
	xScroll = document.body.scrollWidth;
	yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
	xScroll = document.body.offsetWidth;
	yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	// console.log(self.innerWidth);
	// console.log(document.documentElement.clientWidth);
	
	if (self.innerHeight) { // all except Explorer
	if(document.documentElement.clientWidth){
	windowWidth = document.documentElement.clientWidth; 
	} else {
	windowWidth = self.innerWidth;
	}
	windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
	windowWidth = document.documentElement.clientWidth;
	windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
	windowWidth = document.body.clientWidth;
	windowHeight = document.body.clientHeight;
	}
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
	pageHeight = windowHeight;
	} else { 
	pageHeight = yScroll;
	}
	
	// console.log("xScroll " + xScroll)
	// console.log("windowWidth " + windowWidth)
	
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){
	pageWidth = xScroll;
	} else {
	pageWidth = windowWidth;
	}
	// console.log("pageWidth " + pageWidth)
	
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

