	$(document).ready(function(){
	
	// Form Validation
	$('form:has(.required)').submit(function(){
       var ok = true;
       $('.required',this).each(function(){
           if (!$(this).val()) {
               $(this).addClass('warn');
           } else {
               $(this).removeClass('warn');
           }
           ok=ok&&!!$(this).val();
       });
       
       if(!ok) {
           var buttons = $('.buttons',this);
           buttons.children('.form_notify').remove();
           buttons.append('<label for="submit"class="form_notify" >Please fill in all required fields.</label>');
       }
       
       return ok;
   });
   
   $('.required').focus(function(){
		$(this).removeClass('warn');
		
	});

   // End Validation
	
		$('.tile').click(function(){
			document.location = $(this).find('a').attr('href');
		})
	
		$("ul.mainmenu h3")
			.css('cursor', 'pointer')
			.hover(function(){
				$(this).addClass('hover');
			}, function(){
				$(this).removeClass('hover');
			})
			.click(function(){
				var $li = $(this).parent('li');
				$li.toggleClass('open')
					.children('ul')
					.slideToggle("fast");
				
				$.cookie($li.attr('id'), $li.hasClass('open') ? 1 : 0);
			})
			.parent('li')
			.each(function(){
				if( $.cookie($(this).attr('id')) == 1 ) {
					$(this).addClass('open').children('ul').show();
				} else {
					$(this).children('ul').hide();
				}
			});
			
			if ( !$("ul.mainmenu>li.open").length ) {
				$('ul.mainmenu>li').eq(0).addClass('open').children('ul').show();
			}
		
		$("img[@src$=png], #brand_new_site").pngfix();
		
		$(".networkbutton").attr('href', '#');
		
		$(".networkbutton").click(function(){
			$("#dropdown").slideToggle("fast");
		});
	
			
	});
