$(document).ready(function() {
	if(navigator.userAgent.match(/iPhone/i)){
		window.location = "http://windhamdesigns.com/m/";
	}

	$("body").addClass("showandtell");
	
	var titles = {
		"about"            : "Targeting the Outdoor Enthusiast",
		"portfolio"        : "Our Work",
		"contact"          : "Contact Us",
		"client"           : "Client Login",
		"default"          : "Better Your Brand by Design"
	};

	// internal navigation for #hashlinks		
	
	$("a[href^=#]").each(function(){
		$(this).click(function(ev) {
			if ( $(this).hasClass("disabled") ) {
				 ev.preventDefault();
				return;
			}
			showPage($(this).attr("href"));
		});
	});


	var showPage = function(url) {
		var className = "portfolio";
		var match = /#([^#]+)$/.exec(url);
		if ( match ) {
			className = match[1];
		}
		document.title = "Windham Design Group - " + (titles[className] || titles["default"]);
		$("#wrapper").removeClass().addClass(className);
		window.setTimeout(
			function() {
				$("#"+className+" :input:first").focus();
			},
			100
		);
	}

});


// CUSTOM JS for sliding panel
    $(document).ready(function()
    {
        $('#nav-client').click(function() {
			$('#client.node').toggle();
			
        
        /*
            $(this).next('div#client').slideToggle(500).siblings.slideUp("slow");
        	*/
        	
        	});
    });


// This filters the categories
    $(document).ready(function() {
    	$('ul#filter a').click(function() {
    		$(this).css('outline','none');
    		$('ul#filter .current').removeClass('current');
    		$(this).parent().addClass('current');
		
    		var filterVal = $(this).text().toLowerCase().replace(' ','-');
				
    		if(filterVal == 'all') {
    			$('ul#portfolio li').animate({opacity: "1"}, 300);
    		} else {
			
    			$('ul#portfolio li').each(function() {
    				if(!$(this).hasClass(filterVal)) {
    					$(this).animate({opacity: "0.2"}, 300);
    				} else {
    					$(this).animate({opacity: "1"}, 300);
    				}
    			});
    		}
		
    		return false;
    	});
    });


/*
// This is for the sliding login panel
$(document).ready(function(){
	
	// Expand Panel
	$("#open").click(function(){
		$("div#panel").slideDown("slow");
	});	
	
	// Collapse Panel
	$("#close").click(function(){
		$("div#panel").slideUp("fast");	
	});		

	// Collapse Panel from bottom
	$("#closeAlt").click(function(){
		$("div#panel").slideUp("fast");	
	});			
	
	// Switch buttons from "Log In | Register" to "Close Panel" on click
	$("#toggle a").click(function () {
		$("#toggle a").toggle();
	});		
		
}); 

*/

