function oc(a) {
	var o = {};
	for(var i=0;i<a.length;i++){o[a[i]]='';
	}
	return o;
}
$(function() {
	$('a').click(function() {
		try {
			domain = $(this).attr("href").match(/:\/\/(.[^/]+)/)[1];
			exceptions = new Array('nicolelafave.com','www.nicolelafave.com', 'designwomb.com', 'www.designwomb.com');
			if(domain in oc(exceptions)){}
			else{ window.open($(this).attr("href"));
			return false;
		}
	}
	catch(e){}
	});
});

$(function(){

	// CUFON
	//Cufon.replace("#mainContent h2", {hover: true, hoverables: { a: true }})("#clients #mainContent ul li", {hover: true, hoverables: { span: true }})("p.caption-large", {hover: true})("#nav h3", {hover: true});

	// LEFT NAV MENUS
	$('#nav h3').click(function() {
		$(this).next('ul').slideToggle('normal');
		$(this).parent('li').siblings('li').find('ul').slideUp('normal');
		return false;
	});
	
	// TESTIMONIALS
	$(".testimonial").hover(
	function(){
		$(this).children('span').show();
	},
	function(){
		$(this).children('span').hide();		
	});
	
	// CYCLE
	$(".next").bind("click",function(){
		var rel = $(this).attr("rel");
		
		var item = $(".wrapper_"+rel+" a:visible");

		$(item).fadeOut("slow");
	
		if ($(item).next().length > 0){		
			$(item).next().fadeIn("slow");
		}else{
			$(".wrapper_"+rel+" a:first-child").fadeIn("slow");
		}
		
		return false;
	});

	$(".prev").bind("click",function(){
		var rel = $(this).attr("rel");
		
		var item = $(".wrapper_"+rel+" a:visible");

		$(item).fadeOut("slow");
	
		if ($(item).prev().length > 0){		
			$(item).prev().fadeIn("slow");
		}else{
			$(".wrapper_"+rel+" a:last-child").fadeIn("slow");		
		}
		
		return false;
	});
	
	$(".image-wrapper a[class!='imagelink']").bind("click", function(){
		
		$(this).fadeOut("slow");
		if ($(this).next().length > 0){		
			$(this).next().fadeIn("slow");
		}else{
			$(this).parent().find("a:first-child").fadeIn("slow");
		}	
		
		return false;
	});

		
/*	$(".image-wrapper").cycle({ 
		fx:     'fade', 
		speed:  'fast', 
		timeout: 0, 
		next:   '#next, .imagenext', 
		prev:   '#prev' 
	});*/
		
});
