$(document).ready(function() {
	$("#body-background").ezBgResize();
});

$(document).ready(function() {
	$('input[type="text"]').addClass("idleField");
	$('input[type="text"]').focus(function() {
		$(this).removeClass("idleField").addClass("focusField");
	    if (this.value == this.defaultValue){ 
	    	this.value = '';
		}
		if(this.value != this.defaultValue){
			this.select();
		}
	});
	$('input[type="text"]').blur(function() {
		$(this).removeClass("focusField").addClass("idleField");
	    if ($.trim(this.value) == ''){
	    	this.value = (this.defaultValue ? this.defaultValue : '');
		}
	});
});
		
$(document).ready(function() {
	$('textarea').addClass("idleField");
	$('textarea').focus(function() {
		$(this).removeClass("idleField").addClass("focusField");
	    if (this.value == this.defaultValue){ 
	    	this.value = '';
		}
		if(this.value != this.defaultValue){
			this.select();
		}
	});
	$('textarea').blur(function() {
		$(this).removeClass("focusField").addClass("idleField");
	    if ($.trim(this.value) == ''){
	    	this.value = (this.defaultValue ? this.defaultValue : '');
		}
	});
});
		
$(document).ready(function() {
	$('#contact-panel').hide();
	$('#nav-contact a').click(function() {
		$(this).toggleClass("active");
		$('#contact-panel').toggle(200);
			return false;
		});
});
		
/*$(document).ready(function() {
	$('#credit-carousel').jcarousel({	
		scroll: 1,
		wrap: "circular"
	});
});*/
			
$(document).ready(function() {
	
	$('.footer-popup-box').hide();
	$('.footer-popup a.footer-box-toggle').click(function() {
		
		// if already visible then close it
		if($(this).next('.footer-popup-box:visible').length > 0) {
			$(this).next('.footer-popup-box').toggle(200);
			$(this).toggleClass("active");
			return false;
		}
		
		var selectedItem = $(this);
		var activePopups = $('.footer-popup-box:visible');
		
		// if other popups are open, close them first before opening new one
		if(activePopups.length > 0) {
			activePopups.toggle(200, function() {
				$(this).toggleClass("active");
				selectedItem.next('.footer-popup-box').toggle(200);
			});
		}

		else {
			$(this).next('.footer-popup-box').toggle(200);
		}

		return false;
	});
	
});
			
$(function() {
	$('.accordion-container h2').hover( function(){
		$(this).css('cursor', 'pointer');
	});
});

$(document).ready(function(){
	$(".accordion").hide();
	$('.accordion-container h2').click(function() {
		$(this).next(".accordion").slideToggle(300);
		$(this).toggleClass("active");
	})
});
				
/*$(document).ready(function() {
	$('#map-carousel').scrollable({circular: true});
});*/
			
//updated what we do page 

$(document).ready(function() {

	//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;
	});
});

/*$(document).ready(function() {
	$("#contact-form").validate({
		rules: {
			name: "required",
			email: {
				required: true,
				email: true
			},
			feedback: "required"
		}
	});
});*/
