var ajax_load = "<img src='img/loadingAnimation.gif' alt='loading...' />"; 
$(document).ready(function(){					   
   $("#menu a").each(function(){
      if($(this).attr('rel') == 'loader'){
          var href = $(this).attr("href");     
          $(this).attr({ href: "#"});
          $(this).click(function(){
          $("#incontent").hide();  	 
          $("#incontent").html(ajax_load).load(href); 
          $("#incontent").fadeIn(); 
		  for (i=0;i<=8;i++){
			  $('#menu'+i).removeClass("current");
		  }
		  $(this).addClass("current");
		  
          });
      };	  
   });   
   viewHome();
});
//
var param;
function viewDiv(id) {
    //
    param = id;
    //
    var tmpId = id.slice(0,5);
   
    //
    for (i=1;i<=4;i++){
        //                   
        var tmp = tmpId+i;
        //
        if (tmp != id){       
                $('#'+tmp).hide();
                //document.getElementById(tmp).style.display='none';
        }else{
            if (document.getElementById(id).style.display=='block'){
                $('#'+tmp).hide();
                //document.getElementById(tmp).style.display='none';                                   
            }else{
                $('#'+tmp).fadeIn();
                //document.getElementById(tmp).style.display='block';
            }           
        }
    }   
}
function viewAdvice(id) {
    $('#'+id).fadeIn();
}
function hideAdvice(id) {
    $('#'+id).hide();
}
function viewHome() {
   $("#incontent").hide(); 
   $("#incontent").load('content/home.htm'); 
   viewDiv('link_0');
   $("#incontent").fadeIn();
   $("#menu0").addClass("current");

}
