$(document).ready(function(){				
	
	// Swap Input Values
	jQuery(function() {
	    swapValues = [];
	    jQuery(".swap_value").each(function(i){
	        swapValues[i] = jQuery(this).val();
	        jQuery(this).focus(function(){
	            if (jQuery(this).val() == swapValues[i]) {jQuery(this).val("");}
	        }).blur(function(){
	            if (jQuery.trim(jQuery(this).val()) == "") {jQuery(this).val(swapValues[i]);}
	        });
	    });
	});
	
	// View Full Image Button
	$('#view_full_image').toggle(
		function(){
			$(this).addClass('active');
			$('#main_layout,#footer,#copyright').animate({
				opacity: '0'
			},500);
		},	
		function(){
			$(this).removeClass('active');
			$('#main_layout,#footer,#copyright').animate({
				opacity: '1'
			},500);
		}	
	);
	
	// Drop Down Navigation System
	$(".drop_down").click(function(){
		var dropDown = $(this).attr('href');
		if ($('#drop_down_navigations').children('div:visible').length > 0){
			var tempDrop = $('#drop_down_navigations').children('div:visible').attr('id');
			var currentDrop = '#'+(tempDrop);
			if (dropDown == currentDrop){
				$(this).removeClass('active');
				$(currentDrop).slideUp(700,'easeOutQuad');
				return false;
			};
			$('#navigation a.active').removeClass('active');
			$('#drop_down_navigations').children('div:visible').slideUp(700,'easeOutQuad');
			$(this).addClass('active');
			$(dropDown).delay(700).slideDown(700,'easeOutQuad');
		} else {
			$(this).addClass('active');
			$(dropDown).slideDown(700,'easeOutQuad');
		};
		return false;
	});
	
	// Fancybox
	$("a.grouped_elements").fancybox({
			'transitionIn'	:	'elastic',
			'transitionOut'	:	'elastic',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	true
	});
	
	$("a.iframe").fancybox();
	
	// Tabs	
	$("#home_banner").tabs({event: 'mouseover'});
	$("#home_banner").tabs( "rotate" , 4000);
    
	var selected;
	$( "#home_banner" ).tabs({
	   show: function(event, ui) {
		selected = $('.ui-state-active a').attr('rel');
		$('#home_banner_images').children('div:visible').fadeOut();
		$(selected).fadeIn();
		}
	});
	
});
