$(document).ready(function() {

	//Ads Clickable Blocks
	$("#ad-one, #ad-two, #ad-three").addClass("clickable");
	$("#ad-one, #ad-two, #ad-three").click(function(){
		window.location=$(this).find("a").attr("href");
		//return false;
	});
	
	//ABOUT PAGE
	$('#press-pics img, #design-portfolio img').animate({
			opacity: 0.4
		}, 010);
	$('#press-pics img, #design-portfolio img').hover(function() {
		$(this).animate({
			opacity: 1.0
		}, 0500);					 
	}, function() {
		$(this).animate({
			opacity: 0.4
		}, 010);	
	});
	
	$('.portfolio-sidebar-image').animate({opacity: 0.4}, 200);
 	$('.portfolio-sidebar-image').hover(function() {
		$(this).animate({
			opacity: 1.0
		}, 0500);					 
	}, function() {
		$(this).animate({
			opacity: 0.4
		}, 0500);	
	});
	
	//Style Portfolio
	var navWidth = 961;
	var totalPics = $('#design-portfolio ul li').size();
	var stripWidth = -1*navWidth*totalPics/6 + navWidth;
	$('#prev-btn').css({'color' : '#333'});
	
	$('#prev-btn').click(function() {
		var currentPos = $('#design-portfolio ul').css("left").replace("px", "");
		if(currentPos < 0) {
			$('#design-portfolio ul').animate({"left": "+="+navWidth+"px"}, 800);
			$('#prev-btn, #next-btn').css({'color' : '#fff'});
		} else if(currentPos > -2400){
			$(this).css({'color' : '#333'});
		}
		return false;
	});
	$('#next-btn').click(function() {
		var currentPos = $('#design-portfolio ul').css("left").replace("px", "");
		if (currentPos == "auto") {
			currentPos = 0;	
		}
		
		if(currentPos > stripWidth) {
			$('#design-portfolio ul').animate({"left": "-="+navWidth+"px"}, 800);
			$('#prev-btn, #next-btn').css({'color' : '#fff'});
		} else {
			$(this).css({'color' : '#333'});
		}
		return false;
	});
	
	$(".cycle").cycle({fx: 'fade', next: '#nav-right', prev: '#nav-left' });
	/*jQuery(function() {
		// show a simple loading indicator
		var loader = jQuery('<div id="loader">loading...</div>')
			.appendTo("#form-results")
			.hide();
		jQuery().ajaxStart(function() {
			loader.show();
		}).ajaxStop(function() {
			loader.hide();
		}).ajaxError(function(a, b, e) {
			throw e;
		});
		
		var w = jQuery("#newsletter-form2").validate({
			submitHandler: function(form) {
				jQuery(form).ajaxSubmit({
					target: "#form-results"
				});
			}
		});
	});
	jQuery(function() {
		// show a simple loading indicator
		var loader = jQuery('<div id="loader">loading...</div>')
			.appendTo("#form-results")
			.hide();
		jQuery().ajaxStart(function() {
			loader.show();
		}).ajaxStop(function() {
			loader.hide();
		}).ajaxError(function(a, b, e) {
			throw e;
		});
		
		var y = jQuery("#upload-testimonial").validate({
			submitHandler: function(form) {
				jQuery(form).ajaxSubmit({
					target: "#form-results"
				});
			}
		});
	});*/
});	
