// JavaScript Document


$(document).ready(function(){

	
	
    $('.quickFlip3').quickFlip({
        vertical : true
    });
						   

	//  -----------------------  SLIDER  ---------------------
	$(function(){
		$('#js_port').loopedSlider();
	});

	//  -----------------------  MODAL  ---------------------
			$("a#vid_modal").fancybox({
			'hideOnContentClick': false,
			'overlayOpacity':0.9
			});
			$("a#vid_one").fancybox({
			'hideOnContentClick': false,
			'overlayOpacity':0.7
			});
			$("a#vid_2").fancybox({
			'hideOnContentClick': false,
			'overlayOpacity':0.7
			});			
			$("a#vid_3").fancybox({
			'hideOnContentClick': false,
			'overlayOpacity':0.7
			});			
			$("a#vid_4").fancybox({
			'hideOnContentClick': false,
			'overlayOpacity':0.7
			});
			
			// e-store
			// consult
			$("a#getconsult").fancybox({
			'hideOnContentClick': false,
			'overlayOpacity':0.7
			});
			// pic1
			$("a#getpic1").fancybox({
			'hideOnContentClick': false,
			'overlayOpacity':0.7
			});
			// pic2
			$("a#getpic2").fancybox({
			'hideOnContentClick': false,
			'overlayOpacity':0.7
			});
			// pic3
			$("a#getpic3").fancybox({
			'hideOnContentClick': false,
			'overlayOpacity':0.7
			});						
						
			// pic4
			$("a#getpic4").fancybox({
			'hideOnContentClick': false,
			'overlayOpacity':0.7
			});						
			$("a[rel=img_group1]").fancybox({
					'overlayOpacity':0.7,
					'transitionIn'		: 'none',
					'transitionOut'		: 'none',
					'titlePosition' 	: 'over',
					'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
						return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
					
					}
			});	





//  -----------------------  ABOUT : TAB SYSTEM  ---------------------

	//Default Action
	$(".about_tab_content").hide(); //Hide all content
	$("ul.about_tabs li:first").addClass("active").show(); //Activate first tab
	$(".about_tab_content:first").show(); //Show first tab content
	
	//On Click Event
	$("ul.about_tabs li").click(function() {
		$("ul.about_tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".about_tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});
//  -----------------------  TAB SYSTEM  ---------------------

	//Default Action
	$(".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 rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});



//  -----------------------  NAV  ---------------------

  $("#nav li a, #footer_nav li a").each(function() {
  	var href = $(this).attr("href");
  	$(this).click(function() {
  	  $.scrollTo(href, 500, {easing: 'easeOutCubic'});
  	  return false;
  	});
  });


//  -----------------------  HOVERS  ---------------------
/* from Tim Van Damme */
/* http://jqueryfordesigners.com/jquery-look-tim-van-damme/ */
  $('#hovers a').each(function () {
    $('<div class="fader" />').css('opacity', 0).prependTo(this);
  }).hover(function () {
    $('img', this).stop().animate({
      marginLeft : 5
    }, 250);
    
    $('.fader', this).stop().animate({
      opacity : 0.15
    });
    
  }, function () {
    $('img', this).stop().animate({
      marginLeft : 10
    }, 250);
    
    $('.fader', this).stop().animate({
      opacity : 0
    });
  }).find('img').css('marginLeft', 10);





//  -----------------------  TOGGLER  ---------------------
	$(".main_image .desc").show(); //Show Banner
	$(".main_image .block").animate({ opacity: 0.85 }, 1 ); //Set Opacity	
	$(".image_thumb ul li:first").addClass('active'); //Add the active class (highlights the very first list item by default)
	$(".image_thumb ul li").click(function(){
	    //Set Variables
	    var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image
	    var imgTitle = $(this).find('a').attr("href"); //Get Main Image URL
	    var imgDesc = $(this).find('.block').html();  //Get HTML of the "block" container
	    var imgDescHeight = $(".main_image").find('.block').height(); //Find the height of the "block"

	    if ($(this).is(".active")) {  //If the list item is active/selected, then...
	        return false; // Don't click through - Prevents repetitive animations on active/selected list-item
	    } else { //If not active then...
	        //Animate the Description
	        $(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() { //Pull the block down (negative bottom margin of its own height)
	            $(".main_image .block").html(imgDesc).animate({ opacity: 0.85,  marginBottom: "0" }, 250 ); //swap the html of the block, then pull the block container back up and set opacity
	            $(".main_image img").attr({ src: imgTitle , alt: imgAlt}); //Switch the main image (URL + alt tag)
	        });
	    }
	    //Show active list-item
	    $(".image_thumb ul li").removeClass('active'); //Remove class of 'active' on all list-items
	    $(this).addClass('active');  //Add class of 'active' on the selected list
	    return false;

	}) .hover(function(){ //Hover effects on list-item
	    $(this).addClass('hover'); //Add class "hover" on hover
	    }, function() {
	    $(this).removeClass('hover'); //Remove class "hover" on hover out
	});
	$("a.collapse").click(function(){
	    $(".main_banner .block").slideToggle(); //Toggle the description (slide up and down)
	    $("a.collapse").toggleClass("show"); //Toggle the class name of "show" (the hide/show tab)
	});


/*$("#social img[title]").tooltip();*/


	
//  -----------------------  TOOL TIPS ---------------------

$("#social #fb").tooltip({ 
		effect: 'slide'
	});

$("#social #tw").tooltip({ 
		effect: 'slide'
	});
$("#social #yt").tooltip({ 
		effect: 'slide'
	});
//  -----------------------  SOCIAL DIV  ---------------------
$(".trigger").click(function(){
	$(".panel").toggle("fast");
	$(this).toggleClass("active");
	return false;
});



});//DOCUMENT READY
