/**
 * JS
 * @author Darío Ruellan <druellan@ecimtech.com>
 * @copyright ecimTech 2008
 */

function start()
{
	$("#background").show();
	$("#footer").fadeIn("fast");
	
	// Armamos las sombras
	$(".shadow").shadow();
	
	//Buscamos accordions
	$(".accordion").accordion();
	
	//Pasamos el FIX para el PNG
	$("#widget").pngFix();

	//Iconito de ecimTech :)
	$("#footer").ecimtechSays();

	$("#photoarea div.background").hide();
	if ( !$.browser.msie )
	{
		$("#photoarea div.layer").reveal();
	}
	$("#photoarea div.background").reveal();
}

/**
 * Nice reveal effect
 */
$.fn.reveal = function()
{
	this.css("marginTop", -20).css("opacity", 0).show();
	this.animate(
	{
		marginTop: 0,
		opacity: 1
	}, 800, "swing" );
	return this;
};

/**
 * Shadow Maker
 */
$.fn.shadow = function()
{
	this.each(function()
	{
		var e		= $(this);
		var parent	= e.parent();

		e.css("zIndex", 10);
		e.clone()
		 .css("marginTop", "1px")
		 .css("color", "#333")
		 .css("zIndex", 9)
		 .appendTo(parent);
	});
	return this;
}

/**
 * Accordion effect
 */

$.fn.accordion = function()
{
	$("div", this).hide();
	$("h2 a", this).click(function()
	{
		$(".accordion").find("div").slideUp("normal");
		$(".accordion").find("h2 a").css("backgroundImage", "url(images/icon_expand.gif)");
		$(this).parent().next("div").slideDown("normal");
		$(this).css("backgroundImage", "url(images/icon_contract.gif)");
		return false;
	});
}

/* ECIMTECH SPEAKS! --------------------------------------*/

$.fn.ecimtechSays = function ()
{
	var code = '<a href="http://www.ecimtech.com" id="ecimtechspeaks" style="position: relative; float: right; margin: 0px 20px 0 0;"><img src="images/lgo_ecimtech.png" alt="ecimTech" class="logo" /><img src="images/lgo_ecimtech.say.png" alt="know us!" class="dialog" style="position: absolute; left: 0; top: 5px; display: none;" /></a>';
	$(this).append(code);
	
	$("#ecimtechspeaks").hover(
		function ()	{
			$("img.dialog").show().css("opacity",0).css("left",5).animate({
				opacity: 1,
				left: 0
			});
		}, 
		function ()	{
			$("img.dialog").fadeOut("slow");

		}
	);
}











