// Superfish Menu
$(document).ready(function() { 
	$('ul.menu-header').superfish({
     animation:   {opacity:'show',height:'show'}
  })
}); 

// Switch view option portfolio
$(document).ready(function(){

    $("a.switch_thumb").toggle(function(){
        $(this).addClass("swap");
        $("ul.display").fadeOut("fast", function() {
            $(this).fadeIn("fast").addClass("thumb_view");
        });
    }, function () {
        $(this).removeClass("swap");
        $("ul.display").fadeOut("fast", function() {
            $(this).fadeIn("fast").removeClass("thumb_view");
        });
    });

});

// Hover fade rollover for images and video
$(document).ready(function(){
$(".portfolio-item a.hover-zoom-video, .hover-zoom, .hover-zoom-video-home, #video a.hover-zoom-video-single, .gallery1 a.hover-zoom-video").append("<span></span>"); 
    $(".portfolio-item a.hover-zoom-video, .hover-zoom, .hover-zoom-video-home, #video a.hover-zoom-video-single, .gallery1 a.hover-zoom-video").hover(function(){
	 $(this).children("span").hide();										   
        $(this).children("span").stop().fadeTo(800, 0.45);
    },function(){
        $(this).children("span").stop().fadeTo(400, 0);
    });
});

// Hover fade for buttons
$(document).ready(function() {
		$('.intouch-button, .more-link').append('<span class="buttonhover"></span>').each(function () {
	  		var $span = $('> span.buttonhover', this).css('opacity', 0);
	  		$(this).hover(function () {
	    		$span.stop().fadeTo(500, 1);
	 		}, function () {
	   	$span.stop().fadeTo(500, 0);
	  		});
		});
	})
	
// Hover fade for buttons
$(document).ready(function() {
	$('a.signup-button span').show();
	})
	
// Change the solution-box divs to solution-box-highlight on mouseover
$(document).ready(function() {
	$("div.solution-boxes").mouseover(function(){
		$(this).removeClass().addClass("solution-boxes-highlight");
	}).mouseout(function(){
		$(this).removeClass().addClass("solution-boxes");		
	})
})

// popups for the services pages
$(document).ready(function() {  
 
    //select all the a tag with name equal to modal
    $('div#solution-1, div#solution-2, div#solution-3, div#solution-4').click(function() {
        //Cancel the link behavior
        //e.preventDefault();
        //Get the title tag
        var id = $(this).attr('title');
     
        //Get the screen height and width
        var maskHeight = $(document).height();
        //var maskWidth = '1000px';
        var maskWidth = $(document).width();
     
        //Set height and width to mask to fill up the whole screen
        $('#mask').css({'width':maskWidth,'height':maskHeight});

        //transition effect     
        $('#mask').fadeIn(1000);
        //$('#mask').fadeTo("slow",0.8);  

        //Get the window height and width
        var winH = $(window).height();
        var winW = $(window).width();

        //Set the popup window to center
        //$(id).css('top',  winH/2-$(id).height()/2);
        $(id).css('top', 300);
        $(id).css('left', (winW - 1000)/2);
        //$(id).css('left', winW/2-$(id).width()/2);
     
        //transition effect
        $(id).fadeIn(2000); 

        //Scroll to the top of the page        
        $('html,body').animate({
           scrollTop: $('#mask').offset().top + 100
        }, 500);
        
        //$('html, body').animate({scrollTop:0}, 'slow');
    });
     
    //if close button is clicked
    $('.window .close').click(function () {
        //Cancel the link behavior
        //e.preventDefault();
        $('#mask, .window').hide();
        
        //Scroll back to the boxes
        $('html,body').animate({
           scrollTop: $('div#solution-1').offset().top - 100
        }, 500);
    });     
     
    //if mask is clicked
    $('#mask').click(function () {
        $(this).hide();
        $('.window').hide();
        
        //Scroll back to the boxes
        $('html,body').animate({
           scrollTop: $('div#solution-1').offset().top - 100
        }, 500);
    });
     
});

//The Team page
$(document).ready(function() {  
 
    //hide all sections except for the President's profile
	
    $('div.member-name').click(function() {
        //Get the title tag
        var id = $(this).attr('title');

        //Hide all team members
        $('div.team-entry').hide();
        
        //Show the sepcific team member
        $(id).fadeIn(1000);

    });
     
});

//Printing
$(document).ready(function() {
	$('div#popup1 a.print').click(function() {
		$("div#popup1").jqprint();
	});
	
	$('div#popup2 a.print').click(function() {
		$('div#popup2').jqprint();
	});
	
	$('div#popup3 a.print').click(function() {
		$('div#popup3').jqprint();
	});
	
	$('div#popup4 a.print').click(function() {
		$('div#popup4').jqprint();
	});
});

