
$(document).ready( function( ){

	//for the deprecated attribute 'target'
	$("a[@rel=external]").attr( 'target', '_blank' );
	
	$(".regular").focus(function(){
		$(this).addClass( "active" );
	});

	$(".regular").blur(function(){
		$(this).removeClass( "active" );
	});
	
	$(".on").parents( 'li' ).addClass( 'on' );

	$("#menu ul li").hover(function(){
		$(this).children( "ul" ).show( );
	}, function(){
		$(this).children( "ul" ).hide( );
	});

	startup( );
});

function startup( )
{
//	ajaxInfection( );
}

  function ajaxInfection( )
  {
  	 $("a").each( function(){
  	 	curLocation = window.location.href.substring( 0, window.location.href.lastIndexOf( '/' )+1 );
  	 	curHref = $(this).attr('href');
//  	 	alert( curHref.indexOf( curLocation ) );
  	 	if( typeof curHref != 'undefined' )// && ( curHref.indexOf( curLocation ) ) )
  	 	{
  	 		this.onclick = function(){
			//	ajax call
				//var url = $(this).attr('href') + '&output=html';
				$.ajax({
					type: "GET",
					url: curHref,
					success: function( response ){
						alert( response );
//						$("#main").html( escape( response ) );
						$("#main").fadeIn("slow");
						startup( );
					}
				});
	
				return false;
			//---------------------
  	 		}// );
  	 	}
  	} );
  }
