/* initiate jquery functions that require dom ready */

/*########## Fancybox ##########*/

$(document).ready(function() {
			$('.popup').fancybox({
				'width'				: 855,
				'height'			: 450,
				'autoScale'			: true,
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'elastic',
				'type'				: 'iframe',
				'titlePosition'		: 'over'
			});
});



/*########## BG Fade ##########*/

$(document).ready(function(){
	$('.contactbtn').hover(function(){
		$(this).bgFade('fadeIn',
		{
			animate: true
		});
	}, function() {
		$(this).bgFade('fadeOut',
		{
			animate: true
		});
	});
});

/*######## NIVO SLIDER ########*/
$(document).ready(function(){
	$(window).load(function() {
		$('#slider').nivoSlider({
		effect:'fade',
		directionNav:false
		});
	});
});

/*######## CONTACT FORM ########*/
$(document).ready(function() { 
var options = { 
target:        '#alert'}; 
$('#contactForm').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;
  });
};

/*######## SCROLL FUNCTIE ########*/
$(document).ready(function(){
	$.localScroll({ speed:2000 });
});

