// JavaScript Document
$(document).ready(function() { 
var options = { 
target:        '#alert',
}; 
$('#contactForm').ajaxForm(options); 
}); 
$(document).ready(function() { 
var options = { 
target:        '#alert_r',
}; 
$('#checkbox_serv').ajaxForm(options); 
});
$(document).ready(function() { 
var options = { 
target:        '#alert_f',
}; 
$('#feedForm').ajaxForm(options); 
});

$.fn.clearForm = function() {
  return this.each(function() {
	var type = this.type, tag = this.tagName.toLowerCase();
	if (tag == 'form')
	  return $(':input',this).clearForm();
	if (type == 'text' || type == 'password' || tag == 'textarea')
	  this.value = '';
	else if (type == 'checkbox' || type == 'radio')
	  this.checked = false;
	else if (tag == 'select')
	  this.selectedIndex = -1;
  });
};

function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
	
});

$(document).ready(function(){
	$.smoothAnchors(3000, "swing", false);
});

$(document).ready(function(){

	//Diagnal Sliding
	$('.boxgrid.thecombo').hover(function(){
		$(".cover", this).stop().animate({top:'260px', left:'-325px', opacity:0},{queue:false,duration:800});
	}, function() {
		$(".cover", this).stop().animate({top:'0px', left:'0px', opacity:1},{queue:false,duration:1500});
	});
	
		$('#container_image, #container_image_a').hover(function(){
		$(".cover_new", this).stop().animate({top:'263px', left:'-325px', opacity:0},{queue:false,duration:800});
	}, function() {
		$(".cover_new", this).stop().animate({top:'0px', left:'0px', opacity:1},{queue:false,duration:800});
	});
		$('#container_image, #container_image_b').hover(function(){
		$(".cover_new", this).stop().animate({top:'263px', left:'-325px', opacity:0},{queue:false,duration:800});
	}, function() {
		$(".cover_new", this).stop().animate({top:'0px', left:'0px', opacity:1},{queue:false,duration:800});
	});
	
});

$(document).ready(function(){

    $("#menu li").hover(function() {
        $(this).find("div").stop()
        .animate({left: "40", opacity:1}, "fast")
        .css("display","block")

    }, function() {
        $(this).find("div").stop()
        .animate({left: "0", opacity: 0}, "fast")
    });
	
	
	$("#t_b_read li").hover(function() {
        $(this).find("div").stop()
        .animate({left: "115", opacity:1}, "slow")
        .css("display","block")

    }, function() {
        $(this).find("div").stop()
        .animate({left: "90", opacity: 0}, "slow")
		.css("display","none")
    });
	
	
	$("#litle dl").hover(function() {
        $(this).find("span").stop()
        .animate({top: "-100", left: "15", opacity:1}, "slow")
        .css("display","block")

    }, function() {
        $(this).find("span").stop()
        .animate({top: "-15", left: "0", opacity: 0}, "fast")

    });

});


$(function() {
    $('.nav').droppy();
  });
		
		$(function(){
  //Get our elements for faster access and set overlay width
  var div = $('div.sc_menu'),
               ul = $('ul.sc_menu'),
               // unordered list's left margin
               ulPadding = 15;

  //Get menu width
  var divWidth = div.width();

  //Remove scrollbars
  div.css({overflow: 'hidden'});

  //Find last image container
  var lastLi = ul.find('li:last-child');

  //When user move mouse over menu
  div.mousemove(function(e){

    //As images are loaded ul width increases,
    //so we recalculate it each time
    var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;

    var left = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth;
    div.scrollLeft(left);
  });
});
		
		
$(document).ready(function(){
 
 $(".actv_feed").click(function(){
  $("#board").slideToggle("slow");
  $(this).toggleClass("active"); return false;

 });
  
});

$(document).ready(function(){
	$('#checkbox_serv input[type=checkbox]').prettyCheckboxes();
});

$(document).ready(function() {

	/* This is basic - uses default settings */
	
	$("a#single_image").fancybox();
	
	/* Using custom settings */
	
	$("a#inline").fancybox({
		'hideOnContentClick': true
	});

$("a.group").fancybox({
		'autoScale'	: false,
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayColor'			:	'#000',
		'overlayShow'			: true,
		'centerOnScroll'    	: false,
		'overlayShow'	:	true
	});

});

<!--
	var query = new Object();
	window.location.search.replace(
	new RegExp( "([^?=&]+)(=([^&]*))?", 'g' ),
		function( $0, $1, $2, $3 ){
			query[ $1 ] = $3;
		}
	);
	easing = query['e'] || 'Expo';
	
	function loadEasing(e) {
		location.href = location.pathname+'?e='+e;
	}
	
	function setEasing(e) {
		loadLamps(e);
	}

// for dynamic easing changes		
	function loadLamps(easing) {
		$('#lavaLampBasicImage').lavaLamp({
			fx: 'easeIn'+easing,
			speed: 800,
			homeTop:-1,
			homeLeft:-1
		});
	}
	
// jquery initialize:
	$(function() {
		$('.mn_01').lavaLamp({startItem:0, fx: 'swing',  speed: 333 });
		$('.mn_02').lavaLamp({fx: 'swing', speed: 333, startItem:1});		
		$('.mn_03').lavaLamp({fx: 'swing', speed: 333, startItem:2});		
		$('.mn_04').lavaLamp({fx: 'swing', speed: 333, startItem:3});		
		loadLamps(easing);
		
		$('select#easing option[value='+easing+']').attr('selected','selected');
		$('.easingLabel').text(easing);
	});


var hoverColour = "#fff";

$(function(){
	$("a.hoverBtn").show("fast", function() {
		$(this).wrap("<div class=\"hoverBtn\">");
		$(this).attr("class", "");
	});
	
	//display the hover div
	$("div.hoverBtn").show("fast", function() {
		//append the background div
		$(this).append("<div></div>");
		
		//get link's size
		var wid = $(this).children("a").width();
		var hei = $(this).children("a").height();
		
		//set div's size
		$(this).width(wid);
		$(this).height(hei);
		$(this).children("div").width(wid);
		$(this).children("div").height(hei);
		
		//on link hover
		$(this).children("a").hover(function(){
			//store initial link colour
			if ($(this).attr("rel") == "") {
				$(this).attr("rel", $(this).css("color"));
			}
			//fade in the background
			$(this).parent().children("div")
				.stop()
				.css({"display": "none", "opacity": "1"})
				.fadeIn("slow");
			//fade the colour
			$(this)	.stop()
				.css({"color": $(this).attr("rel")})
				.animate({"color": hoverColour}, 350);
		},function(){
			//fade out the background
			$(this).parent().children("div")
				.stop()
				.fadeOut("slow");
			//fade the colour
			$(this)	.stop()
				.animate({"color": $(this).attr("rel")}, 250);
		});
	});
});

function animateTopLink(){
	var right = $("#top_link").css("right");
	if(right == "0px"){
		$("#top_link").animate({right: "-72px"},500);
	}else{
		$("#top_link").animate({right: "0px"},500);
	}
}

$(document).ready(function() {
//  $("#front #header #menu li a:hover").letterCycle({speed: 90});
  
    $(".boxgrid img").mouseover(function() {
//    $(this).parent().siblings("a, span").letterCycle({speed: 80});
    $(this).siblings("h3").letterCycle({speed: 80}); 
  });
	
	$(".boxgrid_lb img").mouseover(function() {

    $("this").siblings("div h3").letterCycle({speed: 100}); 
  });
    
});

			jQuery(document).ready(function($) {
				// We only want these styles applied when javascript is enabled
				$('div.navigation').css({'width' : '300px', 'float' : 'left'});
				$('div.content').css('display', 'block');

				// Initially set opacity on thumbs and add
				// additional styling for hover effect on thumbs
				var onMouseOutOpacity = 0.67;
				$('#thumbs ul.thumbs li').opacityrollover({
					mouseOutOpacity:   onMouseOutOpacity,
					mouseOverOpacity:  1.0,
					fadeSpeed:         'fast',
					exemptionSelector: '.selected'
				});
				
				// Initialize Advanced Galleriffic Gallery
				var gallery = $('#thumbs').galleriffic({
					delay:                     2500,
					numThumbs:                 18,
					preloadAhead:              10,
					enableTopPager:            true,
					enableBottomPager:         true,
					maxPagesToShow:            7,
					imageContainerSel:         '#slideshow_b',
					controlsContainerSel:      '#controls',
					captionContainerSel:       '#caption',
					loadingContainerSel:       '#loading',
					renderSSControls:          true,
					renderNavControls:         true,
					playLinkText:              'Play Slideshow',
					pauseLinkText:             'Pause Slideshow',
					prevLinkText:              '&lsaquo; Previous',
					nextLinkText:              'Next &rsaquo;',
					nextPageLinkText:          'Next &rsaquo;',
					prevPageLinkText:          '&lsaquo; Prev',
					enableHistory:             false,
					autoStart:                 false,
					syncTransitions:           true,
					defaultTransitionDuration: 900,
					onSlideChange:             function(prevIndex, nextIndex) {
						// 'this' refers to the gallery, which is an extension of $('#thumbs')
						this.find('ul.thumbs').children()
							.eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
							.eq(nextIndex).fadeTo('fast', 1.0);
					},
					onPageTransitionOut:       function(callback) {
						this.fadeTo('fast', 0.0, callback);
					},
					onPageTransitionIn:        function() {
						this.fadeTo('fast', 1.0);
					}
				});
			});


$(window).load(function(){
	if($('#image').width()>$('#container_image').width() || $('#image').height()>$('#container_image').height() ){
		
		// POSIÇÃO ABSOLUTA DO CONTEUDO NA TELA
		var pos_x = $('#container_image').offset().left;
		var pos_y = $('#container_image').offset().top;
		
		// LARGURA E ALTURA DO CONTAINER
		var container_x = $('#container_image').width();
		var container_y = $('#container_image').height();
		
		// LARGURA E ALTURA DO CONTEUDO
		var conteudo_x = $('#image').width();
		var conteudo_y = $('#image').height();
		
		// QUANTOS PX DO CONTEÚDO FICAM PRA FORA DO CONTAINER
		var diferenca_x = conteudo_x - container_x;
		var diferenca_y = conteudo_y - container_y;
		
		// POSICAO INICIAL ( na metade da tela)
		var metade_x = - parseInt(diferenca_x / 2);
		var metade_y = - parseInt(diferenca_y / 2);
		
		// POSICIONANDO CONTEUDO
		$('#container_image').mousemove(function(e){
			porcentagem_x = parseInt( (e.pageX - pos_x) / container_x * 100);
			porcentagem_y = parseInt( (e.pageY - pos_y) / container_y * 100);
			leftPosition = parseInt(0 - (diferenca_x  / 100 * porcentagem_x ));
			topPosition = parseInt(0 - (diferenca_y  / 100 * porcentagem_y ));
			$('#image').css({
				'left':leftPosition,
				'top':topPosition
			});
		});					
				
		
		// MOSTRANDO A IMAGEM
		$('#image').css('visibility','visible');
	}
	
});
$(window).load(function(){
	if($('#image_01').width()>$('#container_image_a').width() || $('#image_01').height()>$('#container_image_a').height() ){
		
		// POSIÇÃO ABSOLUTA DO CONTEUDO NA TELA
		var pos_x = $('#container_image_a').offset().left;
		var pos_y = $('#container_image_a').offset().top;
		
		// LARGURA E ALTURA DO CONTAINER
		var container_x = $('#container_image_a').width();
		var container_y = $('#container_image_a').height();
		
		// LARGURA E ALTURA DO CONTEUDO
		var conteudo_x = $('#image_01').width();
		var conteudo_y = $('#image_01').height();
		
		// QUANTOS PX DO CONTEÚDO FICAM PRA FORA DO CONTAINER
		var diferenca_x = conteudo_x - container_x;
		var diferenca_y = conteudo_y - container_y;
		
		// POSICAO INICIAL ( na metade da tela)
		var metade_x = - parseInt(diferenca_x / 2);
		var metade_y = - parseInt(diferenca_y / 2);
		
		// POSICIONANDO CONTEUDO
		$('#container_image_a').mousemove(function(e){
			porcentagem_x = parseInt( (e.pageX - pos_x) / container_x * 100);
			porcentagem_y = parseInt( (e.pageY - pos_y) / container_y * 100);
			leftPosition = parseInt(0 - (diferenca_x  / 100 * porcentagem_x ));
			topPosition = parseInt(0 - (diferenca_y  / 100 * porcentagem_y ));
			$('#image_01').css({
				'left':leftPosition,
				'top':topPosition
			});
		});					
				//$('#container_image_a').mouseout(function(e){
//				leftPosition = parseInt(0);
//				topPosition = parseInt(0);
//				$('#image_01').css({
//				'left':leftPosition,
//				'top':topPosition
//			});
//		});
		
		
		// MOSTRANDO A IMAGEM
		$('#image_01').css('visibility','visible');
	}
	
});
$(window).load(function(){
	if($('#image_02').width()>$('#container_image_b').width() || $('#image_02').height()>$('#container_image_b').height() ){
		
		// POSIÇÃO ABSOLUTA DO CONTEUDO NA TELA
		var pos_x = $('#container_image_b').offset().left;
		var pos_y = $('#container_image_b').offset().top;
		
		// LARGURA E ALTURA DO CONTAINER
		var container_x = $('#container_image_b').width();
		var container_y = $('#container_image_b').height();
		
		// LARGURA E ALTURA DO CONTEUDO
		var conteudo_x = $('#image_02').width();
		var conteudo_y = $('#image_02').height();
		
		// QUANTOS PX DO CONTEÚDO FICAM PRA FORA DO CONTAINER
		var diferenca_x = conteudo_x - container_x;
		var diferenca_y = conteudo_y - container_y;
		
		// POSICAO INICIAL ( na metade da tela)
		var metade_x = - parseInt(diferenca_x / 2);
		var metade_y = - parseInt(diferenca_y / 2);
		
		// POSICIONANDO CONTEUDO
		$('#container_image_b').mousemove(function(e){
			porcentagem_x = parseInt( (e.pageX - pos_x) / container_x * 100);
			porcentagem_y = parseInt( (e.pageY - pos_y) / container_y * 100);
			leftPosition = parseInt(0 - (diferenca_x  / 100 * porcentagem_x ));
			topPosition = parseInt(0 - (diferenca_y  / 100 * porcentagem_y ));
			$('#image_02').css({
				'left':leftPosition,
				'top':topPosition
			});
		});					
				//$('#container_image_a').mouseout(function(e){
//				leftPosition = parseInt(0);
//				topPosition = parseInt(0);
//				$('#image_01').css({
//				'left':leftPosition,
//				'top':topPosition
//			});
//		});
		
		
		// MOSTRANDO A IMAGEM
		$('#image_02').css('visibility','visible');
	}
	
});


if(typeof sIFR == "function"){
	sIFR.replaceElement(named({sSelector:"#launch .ct_h2 h2", sFlashSrc:"sifr.swf", sColor:"#3e3d3d", sLinkColor:"#444444", sBgColor:"#FFFFFF", nPaddingTop:0, nPaddingBottom:0, sWmode:"transparent", sFlashVars:""}));
	sIFR.replaceElement(named({sSelector:"#launch h3", sFlashSrc:"sifr.swf", sColor:"#3e3d3d", sLinkColor:"#444444", sBgColor:"#FFFFFF", nPaddingTop:0, nPaddingBottom:0, sWmode:"transparent", sFlashVars:""}));
	sIFR.replaceElement(named({sSelector:".spot h4", sFlashSrc:"sifr.swf", sColor:"#3e3d3d", sLinkColor:"#444444", sBgColor:"#FFFFFF", nPaddingTop:0, nPaddingBottom:0, sWmode:"transparent", sFlashVars:""}));
	sIFR.replaceElement(named({sSelector:"#about_m h2", sFlashSrc:"sifr.swf", sColor:"#3e3d3d", sLinkColor:"#444444", sBgColor:"#FFFFFF", nPaddingTop:0, nPaddingBottom:0, sWmode:"transparent", sFlashVars:""}));
	sIFR.replaceElement(named({sSelector:"#work_web h2", sFlashSrc:"sifr.swf", sColor:"#3e3d3d", sLinkColor:"#444444", sBgColor:"#FFFFFF", nPaddingTop:0, nPaddingBottom:0, sWmode:"transparent", sFlashVars:""}));
	sIFR.replaceElement(named({sSelector:"#work_brand h2", sFlashSrc:"sifr.swf", sColor:"#3e3d3d", sLinkColor:"#444444", sBgColor:"#FFFFFF", nPaddingTop:0, nPaddingBottom:0, sWmode:"transparent", sFlashVars:""}));
	sIFR.replaceElement(named({sSelector:"#foto h2", sFlashSrc:"sifr.swf", sColor:"#3e3d3d", sLinkColor:"#444444", sBgColor:"#FFFFFF", nPaddingTop:0, nPaddingBottom:0, sWmode:"transparent", sFlashVars:""}));
	sIFR.replaceElement(named({sSelector:"#litle h2", sFlashSrc:"sifr.swf", sColor:"#3e3d3d", sLinkColor:"#444444", sBgColor:"#FFFFFF", nPaddingTop:0, nPaddingBottom:0, sWmode:"transparent", sFlashVars:""}));
	sIFR.replaceElement(named({sSelector:"#quote h2", sFlashSrc:"sifr.swf", sColor:"#3e3d3d", sLinkColor:"#444444", sBgColor:"#FFFFFF", nPaddingTop:0, nPaddingBottom:0, sWmode:"transparent", sFlashVars:""}));
	sIFR.replaceElement(named({sSelector:"#contato h2", sFlashSrc:"sifr.swf", sColor:"#3e3d3d", sLinkColor:"#444444", sBgColor:"#FFFFFF", nPaddingTop:0, nPaddingBottom:0, sWmode:"transparent", sFlashVars:""}));
	sIFR.replaceElement(named({sSelector:".cont_abt_md h3", sFlashSrc:"sifr.swf", sColor:"#3e3d3d", sLinkColor:"#444444", sBgColor:"#FFFFFF", nPaddingTop:0, nPaddingBottom:0, sWmode:"transparent", sFlashVars:""}));
	sIFR.replaceElement(named({sSelector:".cont_abt h3", sFlashSrc:"sifr.swf", sColor:"#3e3d3d", sLinkColor:"#444444", sBgColor:"#FFFFFF", nPaddingTop:0, nPaddingBottom:0, sWmode:"transparent", sFlashVars:""}));
	
};

