var td = 78;
var table = 100;
var div = 100;
var margin = 360;

// SLIDES
var padding = 0;
//

function modulePng(name)
{
	$('#'+name+'_bck').css("background-image", "url()");
	$('#'+name+'_bck').css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/bck.png', sizingMethod='scale'");
	$('#'+name+'_border_top').css("background-image", "url()");
	$('#'+name+'_border_top').css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/border_top.png', sizingMethod='scale'");
	$('#'+name+'_border_bottom').css("background-image", "url()");
	$('#'+name+'_border_bottom').css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/border_bottom.png', sizingMethod='scale'");
	$('#'+name+'_border_left').css("background-image", "url()");
	$('#'+name+'_border_left').css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/border_left.png', sizingMethod='scale'");
	$('#'+name+'_border_right').css("background-image", "url()");
	$('#'+name+'_border_right').css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/border_right.png', sizingMethod='scale'");
	$('#'+name+'_corner_top_left').css("background-image", "url()");
	$('#'+name+'_corner_top_left').css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/corner_top_left.png', sizingMethod='scale'");
	$('#'+name+'_corner_bottom_left').css("background-image", "url()");
	$('#'+name+'_corner_bottom_left').css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/corner_bottom_left.png', sizingMethod='scale'");
	$('#'+name+'_corner_top_right').css("background-image", "url()");
	$('#'+name+'_corner_top_right').css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/corner_top_right.png', sizingMethod='scale'");
	$('#'+name+'_corner_bottom_right').css("background-image", "url()");
	$('#'+name+'_corner_bottom_right').css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/corner_bottom_right.png', sizingMethod='scale'");

}

function logoToCliquezici()
{
	$('#logo').fadeOut(1000);
	$(this).oneTime(1000, function () {
		$('#cliquezici').fadeIn(1000);
		$(this).oneTime(1000, function () {
			$('#cliquezici').fadeOut(1000);
			$(this).oneTime(1000, function () {
				$('#logo').fadeIn(1000);
			});
		});
	});
}

function init()
{
	$(this).oneTime(3000, function () {
		logoToCliquezici();
	});
	$(this).everyTime(3000, "slides", function () {
		padding++;
		$('#wrapper').scrollTo((padding * 210) + 'px', 500, {axis : 'x'});
		$(this).oneTime(500, function () {
			$('#slide_' + ((padding - 1) % 9)).css('left', ((padding + 8) * 210)+'px');
		});
	});
	$('.menu_a').attr('href', '#');
	$('.slide_a').attr('href', '#');
}

function rollOut(page)
{
	$("#content_text").fadeOut(200);
	$(this).oneTime(200, function () {
	$(this).everyTime(20, "timer", function() {
		if (margin >= 635)
		{
			$(this).stopTime("timer");
			$('#content_text').load('includes/' + page + '.php', {}, function () {
				$('#content_text').fadeIn(200);
			});
		}
		else
		{
			table += 10;
			td += 10;
			margin += 10;
			div += 10;
			$('#content_table').css('height', parseInt(table)+'px');
			$('#content_bck').css('height', parseInt(td)+'px');
			$('#content_text').css('height', parseInt(td)+'px');
			//$('#content_module').css('margin-top', '-'+parseInt(margin)+'px');
			$('#content_module').css('height', parseInt(div)+'px');
		}
	});
	});
}

function rollIn(page)
{
	$("#content_text").fadeOut(750);
	$(this).oneTime(750, function () {
	$(this).everyTime(20, "timer", function() {
		if (margin <= 360)
		{
			$(this).oneTime(3000, function () {
				logoToCliquezici();
			});
			$(this).stopTime("timer");
			$('#bg').css("background-image", "url(images/"+page+".jpg)");
			$('#content_text').load('includes/' + page + '_resume.php', {}, function () {
				$('#content_text').fadeIn(750);
			});
		}
		else
		{
			table -= 10;
			td -= 10;
			margin -= 10;
			div -= 10;
			$('#content_table').css('height', parseInt(table)+'px');
			$('#content_bck').css('height', parseInt(td)+'px');
			$('#content_text').css('height', parseInt(td)+'px');
			//$('#content_module').css('margin-top', '-'+parseInt(margin)+'px');
			$('#content_module').css('height', parseInt(div)+'px');
		}
	});
	});
}
