// Funcao para carregar flash com parametro
function carregaFlash(caminho,largura,altura, variavel) {
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+largura+'" height="'+altura+'">');
    document.write('<param name="movie" value="'+caminho+'">');
    document.write('<param name="quality" value="high">');
    document.write('<param name="wmode" value="transparent">');
    document.write('<param name="menu" value="false">');
    document.write('<param name="flashVars" value="CAMINHO_SITE='+variavel+'">');
    document.write('<embed wmode="transparent" src="'+caminho+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+largura+'" height="'+altura+'" flashVars="CAMINHO_SITE='+variavel+'"></embed>');
    document.write('</object>');
}

function setContentSize() {
	if ($.browser.msie && parseInt($.browser.version) <= 7) {
		$("div.content").css("min-height", ( $("body").height() - $("div.header").height() - ( $("div.footer").height()) ) + "px" );
	} else if ($.browser.msie) {
		$("div.content").css("min-height", ( $("body").height() - $("div.header").height() - ( $("div.footer").height() + 80) ) + "px" );
	} else {
		$("div.content").css("min-height", ( $("body").height() - $("div.header").height() - ( $("div.footer").height() + 20) ) + "px" );
	}
}

$(document).ready(function() {
	if ($('#frmContato').length > 0)
	{
		Contato();
	}
	if ($('#frmRecuperar').length > 0)
	{
		Recuperar();
	}

	if ($('#frmUsuario').length > 0)
	{
		Usuario();
	    $("#forgotPassword").createModal({
		    urlRequest: 'RecuperarSenha.php'	} );

	}
	
	setContentSize();
	
	$("ul").each(function() {
		$("li:first", $(this)).addClass("first");
		$("li:last", $(this)).addClass("last");
	});

	$("#userArea").click(function() {
		if( !$("#tooltipUser").hasClass("tooltip-active") ) {
			var offset = $(this).offset();
			$("#tooltipUser").css("left",offset.left - $(this).width() - 55).css("top",offset.top + $(this).height() + 20).show().addClass("tooltip-active");
			$("#tooltipUser input:first").focus();
		} else {
			$("#tooltipUser").hide().removeClass("tooltip-active");
		}
	});


	$("#infoOSTooltip").click(function() {
		if(!$("#tooltipInfoOS").get(0)) {
			$("body").prepend("<div class=\"tooltip tooltip-os-info\" id=\"tooltipInfoOS\"><div class=\"tooltip-body\"><span class=\"arrow\"></span><a onclick=\"$('#infoOSTooltip').click();\" class=\"tooltip-close-min\"></a><p></p></div></div>"); 
		}

		$("#tooltipInfoOS p").html( $(this).attr("title") );

		if( !$("#tooltipInfoOS").hasClass("tooltip-active") ) {
			var offset = $(this).offset();
			$("#tooltipInfoOS").css("left",offset.left - $(this).width() + 5).css("top",offset.top + $(this).height() + 20).show().addClass("tooltip-active");
			$("#tooltipInfoOS input:first").focus();
		} else {
			$("#tooltipInfoOS").hide().removeClass("tooltip-active");
		}
	});

	$('a[rel=lightbox]').lightBox();
	
});

$(window).bind('resize', function() {
	setContentSize();
});

