/**

 * @author Mauricio Dulce (www.studiocom.com)

 * @date Octuber 11th 2010 

 * All Functionality 

 */
/** related with the Hero Slideshow
 * Home Page Hero
 */
function slideSwitch(){
    var $heroShow = $('#hero div.current');
    
    if ($heroShow.length == 0) 
        $active = $('#hero div:last');
    
    // use this to pull the divs in the order they appear in the markup
    var $next = $heroShow.next().length ? $heroShow.next() : $('#hero div:first');
    
    $heroShow.addClass('last-current');
    
    $next.css({
        opacity: 0.0
    }).addClass('current').animate({
        opacity: 1.0
    }, 1000, function(){
        $heroShow.removeClass('current last-current');
    });
}

$(document).ready(function() {	
	$('a[name=modal]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		
		var id = $(this).attr('href');
	
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",0.8);	
	
		var winH = $(window).height();
		var winW = $(window).width();
              
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		$(id).fadeIn(1000); 
	
	});
	
	$('.window .btn_close').click(function (e) {

		e.preventDefault();
		
		
			
		$('#mask').fadeOut(1000);
		
		$('.window').fadeOut(1000);
		
	});		
			
	
});


