$(document).ready(
    function() {
	    mySq = new Squalt();
    }
);

var Squalt = function ( )  
{

    $("ul#ticker01").liScroll({travelocity: 0.04}); 	
	$("#about_part").hide();
	$("#contact_part").hide();
	$("#gallery_part").hide();	
	$("#squalt_part").hide();
	$("#press_part").hide();
	$('#gallery a').lightBox({fixedNavigation:true});
	$('#press a').lightBox({fixedNavigation:true});
	this.initMenu();
	
	var so = new SWFObject("swf/monoslideshow.swf", "home", 960, 420, "7", "#121212");
	so.addVariable("dataFile", "xml/monoslideshow.xml"); 
	so.write("home");
	
}

var o = Squalt;

o.prototype.initMenu = function( )
{
	
	var _self = this;

    $("#menu li").each(function(){
		$(this).find(".sp").hide();
		$(this).click(function(){
			if ($(this).attr("class") != "") {
				_self.showPart($(this));				
			}

			return false;
		});
	});
	this.skip = true;
		this.showPart($(".squalt"));
	$(".imgHome").click(function(){
		_self.showPart($(".squalt"));
		return false;		
	})

	$(".infos").click(function(){
		_self.showPart($(".about"));
		return false;		
	})
}

o.prototype.showPart = function( li )
{
    $("#menu li").find(".sp").hide();
	li.find(".sp").show();
	this[li.attr("class")]();
}

o.prototype.about = function()
{
	if (this.current) this.current.slideUp(1600);
	$("#about_part").slideDown(1600, function(){
		$.scrollTo(0, 1600);
	});
	this.current = $('#about_part');
}

o.prototype.gallery = function()
{
	if (this.current) this.current.slideUp(1600);
	$("#gallery_part").slideDown(1600, function(){
		$.scrollTo($('#gallery_part').position().top - 100, 1600);
	});
	this.current = $('#gallery_part');
}

o.prototype.contact = function()
{
	if (this.current) this.current.slideUp(1600);
	$("#contact_part").slideDown(1600, function(){
		$.scrollTo(0, 1600);		
	});
	this.current = $('#contact_part');
}

o.prototype.squalt = function()
{
	var _self = this;
	if (this.current) this.current.slideUp(1600);
	$("#squalt_part").slideDown(1600, function(){
		if (!_self.skip) $.scrollTo($('#squalt_part').position().top - 80, 1600);
		_self.skip = false;
	});
	this.current = $('#squalt_part');
	
}

o.prototype.press = function()
{
	if (this.current) this.current.slideUp(1600);
	$("#press_part").slideDown(1600, function(){
		$.scrollTo($('#press_part').position().top - 90, 1600);
	});
	this.current = $('#press_part');
}
