$(window).load(function(){
			var totalNum = 7;
			var rndNum = Math.floor(Math.random() * totalNum);
			var $bg_mask = $("#logo");
			$bg_mask.css({backgroundImage: "url(img/1_" + rndNum  + ".png)"});
			$('#main_content').load('partials/home.html')
});

$(function () {
	$('a.en').click(function (){
		$('#mainmenu').customFadeOut( 'slow', function () {
			$('#mainmenu_en').customFadeIn();
		});
		$('#latest').customFadeOut( 'slow', function () {
			$('#latest_en').customFadeIn();
		});
		$('#main_content').load('partials/en/home.html')
	});
	
	$('a.it').click(function (){
		$('#mainmenu_en').customFadeOut( 'slow', function () {
			$('#mainmenu').customFadeIn();
		});
		$('#latest_en').customFadeOut( 'slow', function () {
			$('#latest').customFadeIn();
		});
		$('#main_content').load('partials/home.html')
	});
});



(function($) {
    $.fn.customFadeIn = function(speed, callback) {
        $(this).fadeIn(speed, function() {
                if(jQuery.browser.msie)
                        $(this).get(0).style.removeAttribute('filter');
                if(callback != undefined)
                        callback();
        });
    };
    $.fn.customFadeOut = function(speed, callback) {
        $(this).fadeOut(speed, function() {
                if(jQuery.browser.msie)
                        $(this).get(0).style.removeAttribute('filter');
                if(callback != undefined)
                        callback();
        });
    };
})(jQuery);

$(window).load(function () {
	$('#super_wrapper').customFadeIn(1000, function () {
		$('#main_content').customFadeIn(1000);
	});
});	

$(document).ready(function (){
	$('.disabled').css({opacity:'0.3'}, function (){
		this.style.removeAttribute('filter');

	});
});

$('a.load_module').click(function (){
	$('#phpmodule').show();
});

$(function(){
	var LoadMsg = '';
	var AjaxPath = 'partials/';
	$('#mainmenu ul li a.navi, #mainmenu_en ul li a.navi').click(function(){
		if(!$(this).hasClass("current")) {
			var _Href = $(this).attr('href');			
			var totalNum = 7;
			var rndNum = Math.floor(Math.random() * totalNum);
			var $bg_cycle = $("#logocycle");
			$bg_cycle.css({backgroundImage: "url(img/300/1_" + rndNum  + ".gif)"});
			$('#mainmenu ul li a, #mainmenu_en ul li a').removeClass("current");
			$(this).addClass("current");
			$('<div id="loading" class="grid_4 alpha">'+LoadMsg+'</div>').prependTo('#main_content').fadeIn('fast',function(){
				$.ajax({
					type:	'GET',
					url:	AjaxPath+_Href,
					dataType:	'html',
					timeout:	5000,
					success: function(d,s){
							$('#loading').fadeOut('fast',function(){
								$(this).remove();
								$('ul.act').slideUp();
								$('ul.docs').slideUp();
								$('#main_content').fadeOut('fast',function(){
										$(this).html(d).customFadeIn('fast');
									});
								});
							},
					error: function(o,s,e){
								window.location=_Href;
							}
				});
			});
		}
		return false;
	});
});

$(function(){
	var LoadMsg = '';
	var AjaxPath = 'partials/';
$('#submenu li a').click(function(){
		if(!$(this).hasClass("current")) {
			var _Href = $(this).attr('href');
			$('#submenu li a').removeClass("current");
			$(this).addClass("current");
			$('<div id="loading">'+LoadMsg+'</div>').prependTo('#main_content').fadeIn('fast',function(){
				$.ajax({
					type:	'GET',
					url:	AjaxPath+_Href,
					dataType:	'html',
					timeout:	5000,
					success: function(d,s){
							$('#loading').fadeOut('fast',function(){
								$(this).remove();
								$('#main_content').fadeOut('fast',function(){
										$(this).html(d).customFadeIn('fast');
									});
								});
							},
					error: function(o,s,e){
								window.location=_Href;
							}
				});
			});
		}
		return false;
	});
});

$(function () {
	$('a.node_1').click(function () {
	$('#mainmenu ul li a, #mainmenu_en ul li a').removeClass("current");
	$(this).addClass("current");
		$("ul.act").slideUp(function (){
			$("ul.docs").slideDown();
	});
});
	
	$('a.node_2').click(function () {
	$('#mainmenu ul li a, #mainmenu_en ul li a').removeClass("current");
	$(this).addClass("current");
		$("ul.docs").slideUp(function () {
			$("ul.act").slideDown();
		});
		
	});
});

