$(document).ready(function() {   

	$(".fancy").livequery('',function(){
		
		$(".fancy").fancybox();
	})
		
		$('form :not(image)').livequery('',function(){
			
			$('form :not(image)').each(function(){
		
				var value = $(this).val();
				
				if( value.charAt(0)==' ' ){
					$(this).focus(function(){
			
						if( $(this).val()==value )
							$(this).val('');
					});
						
					$(this).blur(function(){
						
						if( $(this).val()=='' )
							$(this).val(value);				
					});
				}
			});
		});
	
	

	

	var hash = window.location.hash.substr(1);

	var href = $('.a').each(function(){

		var href = $(this).attr('href');

		if( hash == href.substring( href.indexOf(',')+1, href.indexOf('.html') ) ){

			var toLoad = href+' #con_r';

			$('#con_r').load(toLoad)
		}											
	});
		
	$('a.a').not("a[href*='http:']").click(function(){						  

		var toLoad = $(this).attr('href')+' #con_r';
		
		$('.a').each(function(){
			
			$(this).removeClass('selected');
		});
		
		$(this).attr('class','a selected')

		$('#con_r').hide('normal',loadContent);
		
		window.location.hash = $(this).attr('href').substring( $(this).attr('href').lastIndexOf(',')+1 ,$(this).attr('href').indexOf('.html') );

		function loadContent() {

			document.getElementById('con_r').innerHTML='';

			$('#con_r').load(toLoad,showNewContent());
		}

		function showNewContent() {
			
			$('#con_r').show('normal');
		}

		return false;

	});

});