$(function() {

	$('#slideshow1').cycle({ 
		timeout:       3000,  // milliseconds between slide transitions (0 to disable auto advance) 
		speed:         500,  // speed of the transition (any valid fx speed value) 
		height:       'auto', // container height 
		sync:          1,     // true if in/out transitions should occur simultaneously 
		fit:           0,     // force slides to fit container 
		pause:         0,     // true to enable "pause on hover" 
		delay:         2000,     // additional delay (in ms) for first transition (hint: can be negative) 
		slideExpr:     null   // expression for selecting slides (if something other than all children is required) 
	});
});

$(document).ready(function() {

	//navigation menu
	function nudge(obj){
		obj.mouseover(function(){
			if(obj.hasClass('selected')){
				obj.stop().animate({'padding-left':55});
			}
			else{
			obj.stop().animate({'padding-left':25}, 75);}
		});
		obj.mouseout(function(){
			if(obj.hasClass('selected')){
				obj.stop().animate({'padding-left':50});
			}
			else{
			obj.stop().animate({'padding-left':0}, 400);}
		});
		
	}; //end nudge()
	nudge($('#home'));
	nudge($('#profile'));
	nudge($('#services'));
	nudge($('#projects'));
	nudge($('#gallery'));
	nudge($('#contact'));
	
	//designer / footer
	/*function showhide(obj){
		
		obj.mouseover(function(){
			($('#sdwp')).css({'display':'block'});
			($('#sdwp')).stop().animate({opacity:1}, 500);
		});
		obj.mouseout(function(){
			($('#sdwp')).stop().animate({opacity:0}, 1000, function(){($('#sdwp')).css({'display':'none'});});
			
		});
	};
	showhide($('#dhover'));*/
	
	//service images
	$pic = $('#morph_pic');
	function service_click(obj){
		obj.click(function(){
			switch(obj.attr("id")){
				case "s1":
					$testnum = '012.jpg';
					break;
				case "s2":
					$testnum = '036.jpg';
					break;
				case "s3":
					$testnum = '018.jpg';
					break;
				case "s4":
					$testnum = '001.png';
					break;
				case "s5":
					$testnum = '042.jpg';
					break;
				case "s6":
					$testnum = '021.jpg';
					break;
				case "s7":
					$testnum = '3d.jpg';
					break;
				case "s8":
					$testnum = '017.jpg';
					break;
				default:
					$testnum = '036.jpg';
					break;
			};//switch
			$string1 = 'url("./images/services/';
			$string1 += $testnum;
			$string1 += '")';
			$pic.css({'background': $string1});
		});//click
	};
	
	service_click($('#s1'));
	service_click($('#s2'));
	service_click($('#s3'));
	service_click($('#s4'));
	service_click($('#s5'));
	service_click($('#s6'));
	service_click($('#s7'));
	service_click($('#s8'));
	
	//accordion http://www.learningjquery.com/2007/03/accordion-madness
	$('div.accord> div').hide();
	$('#first_ele').show();
	$('#first_tog').css({'color':'#41464D'});
	$('div.accord> h3').click(function () {
		$('div.accord> h3').css({'color':'#528CE0'});
		$(this).css({'color':'#41464D'});
    	$(this).next('div').slideToggle('slow').siblings('div:visible').slideUp('slow');
    });
	
	//gallery http://fancybox.net/howto
	$("a.smoothbox").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'overlayOpacity':	0.5,
		'overlayColor'	:	'#666',
		'hideOnOverlayClick':true,
		'hideOnContentClick':true
	});
	
});

