/**
 * jq_menu Jul 2010 Version 1.0
 * Maritta Sturt
 * Copyright (c) M. Sturt 
 */

var site = function() {
	this.menuA = $('#menu li a');
	this.init();
};

site.prototype = {
 	
 	init: function() {
		// Reset the screen to (0,0), many browsers don't reset scroll on refreshes
		$.scrollTo(0); 	
		
		$('.load').click(function(){ 

			$.scrollTo(0,800);
			
			if (!$(this).hasClass('on')) {
				$("#wrap_content").append('<img src="images/loading.gif" id="loadingPg" />');
				url = $(this).attr('href');
				url = url +' #content';
				$('#wrap_content').load(url, function() {
					//$('#loadingPg').remove();
					$('#menu a.on').css('width','120px');
					$('.load').removeClass('on');
					clss = $('#content').attr('class');
					$('.load').each(function(i) {
						if ($(this).hasClass(clss)) $(this).addClass('on');
					 });
					$('#menu a.on').css('width','160px');
						$.getScript('js/jquery.form.js', function() {});
						$.getScript('js/jq_form_cn.js', function() {});
				});
			} 
			return false;	
		}); 
	
		$('#menu li a').not('.on').css('width','120px');
		
 		this.setMenu();
 	},
 	
	setMenu: function() {
 		this.menuA.hover(function() {
			if (!$(this).hasClass('on'))
				$(this).stop(true,true).animate({"width":"160px"},400);
 		}, function() {
			if (!$(this).hasClass('on'))
				$(this).stop(true,true).animate({"width":"120px"},200);
		});
		
 	}
 
}

new site(); 
