/* * 3 MODULI * */
$(function(){
		$('#webdesign').imgslide({
			left: '-270px'
		});
	});
	$(function(){
		$('#xhtml').imgslide({
			left: '-270px'
		});
	});
	$(function(){
		$('#printdesign').imgslide({
			left: '-270px'
		});
	});

/* * NIVO SLIDER * */
$(window).load(function() {
	$('#slider').nivoSlider({
		effect:'random', //Specify sets like: 'fold,fade,sliceDown'
		slices:15,
		animSpeed:400,
		pauseTime:4000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:true, //Next and Prev
		directionNavHide:true, //Only show on hover
		controlNav:true, //1,2,3...
		controlNavThumbs:false, //Use thumbnails for Control Nav
      controlNavThumbsFromRel:false, //Use image rel for thumbs
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left and right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.4, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});
});

/* * CONTACT LINK * */
$(function() {
	$('#contactlink').bind('click',function(event){
		var $anchor = $(this);
		
		$('html, body').stop().animate({
			scrollTop: $($anchor.attr('href')).offset().top
		}, 1500,'easeOutQuad');
		/*
		if you don't want to use the easing effects:
		$('html, body').stop().animate({
			scrollTop: $($anchor.attr('href')).offset().top
		}, 1000);
		*/
		event.preventDefault();
	});
});

/* * SUBMIT FORM * */
$(document).ready(function() {
	$('#submitform').ajaxForm({
		target: '#error',
		success: function() {
		$('#error').fadeIn('slow');
		}
	});
});

/* =========================================================
// jQuery Image Slide Plugin
// Date: November, 2009
// Version: 1.0
// Copyright (c) 2009 Blaine Robison
// Website: http://spoonfedproject.com
// Author: Blaine Robison
/* ========================================================= */
(function($){
	$.fn.imgslide = function(options){
		// Declare default values
		var defaults = {
				top : '0px',
				right : '0px',
				bottom : '0px',
				left : '0px',
				duration : 200
			},
			// Override default values if options are passed in
			options = $.extend(defaults, options);
		// Loop through all images being called
		this.each(function(){
			var $this = $(this),
			// Grab original css property values
			defTop = '',
			defRight = '',
			defBottom = '',
			defLeft = '';
			// If original value is 'auto' change to 0px. Needed for browsers other than Firefox	
			(($this).css('top') == 'auto')? defTop = '0px' : defTop = ($this).css('top');
			(($this).css('right') == 'auto')? defRight = '0px' : defRight = ($this).css('right');
			(($this).css('bottom') == 'auto')? defBottom = '0px' : defBottom = ($this).css('bottom');
			(($this).css('left') == 'auto')? defLeft = '0px' : defLeft = ($this).css('left');
			// Run animation when hovered
			$this.hover(function(){
				$($this).stop().animate({top:options.top,right:options.right,bottom:options.bottom,left:options.left},{queue:false,duration:options.duration});					 
			}, function(){
				$($this).stop().animate({top:defTop,right:defRight,bottom:defBottom,left:defLeft},{queue:false,duration:options.duration});					 
			});
		});
	// Ensure chainability	
	return this;
	}
})(jQuery);
