$(document).ready(function() {
$("div.menu , #image , #bigimage").hide();
$('div.menu.tools').show();
//$('ul.list').each( function( intIndex ) { $('li:first a').addClass('thisone') });
 $('h3').click(function(event) {
   if ($(event.target).is('a, span')) {
   var valParents = $(this).parents("div");
   var valDiv = $(this).attr("id");
   var valShowFirst = $(this).attr("name");
	$(".selected").toggleClass("selected");
    $(this).not(".parent").addClass("selected");
    if ((valShowFirst) == "portfolio"){$("h3#portfolio").removeClass("selected").addClass("two");} else if ((valDiv) == "portfolio"){$("h3#portfolio").addClass("selected").removeClass("two");} else {$("h3#portfolio").removeClass("selected").removeClass("two");}
    return false;
   };
 });
 
 $('h3.parent').hover(
 	function () {$(this).addClass('vis');},
 	function () {$(this).removeClass('vis');}
 );
 
 $('h3.parent').click(
 	function () {
 		var valDiv = $(this).attr("id");
 		$('h3.parent').not(this).removeClass('test');
 		$(this).toggleClass('test');
 		$('.menu').not('.' + (valDiv)).not('.tools').hide();
 		$('.' + (valDiv)).toggle();
 		$('body').removeClass('content');
 		$('div.alr_words , h3#login').removeClass('next');
 		$('h3.parent').removeClass('tug');
 		if ($(this).hasClass('wtf')) {
if ($(this).hasClass('tug')) { $('body').removeClass('content'); $('div.alr_words , h3#login').removeClass('next'); $(this).removeClass('tug'); } else {
$('h3.parent').removeClass('tug');
 		    $(this).toggleClass('tug');
 			$('body').addClass('content');
 			$('div.alr_words , h3#login').addClass('next'); }
         } else {
 			$('body').removeClass('content');
 			$('div.alr_words , h3#login').removeClass('next');
         }
        $("#bigimage , #image").fadeOut("fast");
		$("#bigimage").empty();

}
 );
 
  $('div.menu h3').click(
 	function () {
 		var valDiv = $(this).attr("id");
 		var valParents = $(this).parents("div");
 		var valShowFirst = $(this).attr("name");
 		var valLink = $(this).children('a').attr('href');
 		if ((valDiv) == "followlink") {
		window.location = (valLink);
		$(this).removeClass('selected');
		$(".menu:visible").not(valParents).not('.tools').hide();
 		} else {
 		$(".menu:visible").not(valParents).not('.tools').hide();
 		$(".menu." + (valDiv)).show();
 		$(".menu." + (valShowFirst)).show();
 		$('body').addClass('content');
 		$('div.alr_words , h3#login').addClass('next');
 		}
 	}
 );
 
    $("h5 a").click(function(){
		var imagelinkval = $(this).attr("href");
		$("#image:hidden").fadeIn("fast");
			$("#bigimage:hidden").fadeIn("slow");
$.ajax({
  url: (imagelinkval + 'x'),
  cache: true,
  success: function(html){
    $("#bigimage").empty().append(html);
$.getScript("http://www.alrdesign.com/dev/index.php/js/nav");
  }
});
			return false;
	});
	
	
	
	
$('ul.list li a').click(
 	function () {
 		var linkval = $(this).attr('href');
 		var divval = $(this).attr('name');
 		var ulId = $(this).parents('ul').attr('id');
 		$('#' + divval).load(linkval + 'x');
 		$('ul#' + ulId + ' li a').removeClass('thisone');
 		$(this).addClass('thisone');
 		return false;
 	}
 );
	
	$("#close").click(function(){
		$("#bigimage , #image").fadeOut("fast");
		$("#bigimage").empty();
		return false;
	});
 
	
	});
	// newsletter js
	function openWin(URL) { 
aWindow=window.open(URL,"thewindow2","width=650,height=580, directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes"); 
}