﻿function reload() {
    window.location = "/Default.aspx";
}

function avatarEditar(tipo) {
	boxFechar();
	if(tipo == "criar") $("#divAvatarEditar h2 img").attr({
	"src": "/Util/novas-imagens/conteudo/titulos/monte-seu-avatar.gif",
		"alt" : "Monte seu avatar"
	});
	else $("#divAvatarEditar h2 img").attr({
	"src": rootPath + "/Util/novas-imagens/conteudo/titulos/edite-seu-avatar.gif",
		"alt" : "Edite seu avatar"
	});
	
	
	$("#divAvatarEditar:hidden").stop(true, true).slideDown(function() {
		$(".flash",this).flash({
			src: "/Util/Swf/Shell.swf",
			width: 980,
			height: 347,
			wmode: "transparent",
			bgcolor: "none",
			name:"montar",
		   	id:"montar",
			allowScriptAccess:"sameDomain",
			flashvars: { application:"MontarAvatar.swf" }
		});
		
		$("#divFooter").css("bottom",0);
		$.scrollTo('#divAvatarEditar', 800);
	});
}

function avatarInventario() {
	boxFechar();
	
	$("#divAvatarInventario:hidden").stop(true, true).slideDown(function() {
		$(".flash",this).flash({
			src: "/Util/Swf/Shell.swf",
			width: 980,
			height: 347,
			wmode: "transparent",
			bgcolor: "none",
			name:"inventario",
		   	id:"inventario",
			allowScriptAccess:"sameDomain",
			flashvars: { application:"Inventario.swf" }
		});
		
		$("#divFooter").css("bottom",0);

		$.scrollTo('#divAvatarInventario', 800);

	});
}

function avatarDownload() {
	boxFechar();
	
	$("#divAvatarDownload:hidden").stop(true, true).slideDown(function() {
		$(".flash",this).flash({
			src: "/Util/Swf/Shell.swf",
			width: 980,
			height: 347,
			wmode: "transparent",
			bgcolor: "none",
			flashvars: { application:"DownloadAvatar.swf" }
		});
		
		$("#divFooter").css("bottom",0);

		$.scrollTo('#divAvatarDownload', 800);


	});
}

function avatarFechar() {
	window.location = window.location.pathname;
}

function boxFechar() {
	$(".flash",$("div.overElement:visible")).html("");
	$("div.overElement:visible").stop(true, true).slideUp();
}

if(window.attachEvent)
{
	function removeObjects()
	{
		var array = document.all.tags("embed");
		if (array && array.length)
		{
			for (var i=array.length-1; 0<=i; i--) array[i].removeNode(true);
		}
	}
	window.attachEvent("onbeforeunload",removeObjects);
}
