
//------s3Slider.js

/* ------------------------------------------------------------------------
	s3Slider
	
	Developped By: Boban Karišik -> http://www.serie3.info/
        CSS Help: Mészáros Róbert -> http://www.perspectived.com/
	Version: 1.0
	
	Copyright: Feel free to redistribute the script/modify it, as
			   long as you leave my infos at the top.
------------------------------------------------------------------------- */


(function($){  

    $.fn.s3Slider = function(vars) {       
        
        var element     = this;
        var timeOut     = (vars.timeOut != undefined) ? vars.timeOut : 4000;
        var current     = null;
        var timeOutFn   = null;
        var faderStat   = true;
        var mOver       = false;
        var items       = $("#" + element[0].id + "Content ." + element[0].id + "Image");
        var itemsSpan   = $("#" + element[0].id + "Content ." + element[0].id + "Image span");
            
        items.each(function(i) {
    
            $(items[i]).mouseover(function() {
               mOver = true;
            });
            
            $(items[i]).mouseout(function() {
                mOver   = false;
                fadeElement(true);
            });
            
        });
        
        var fadeElement = function(isMouseOut) {
            var thisTimeOut = (isMouseOut) ? (timeOut/2) : timeOut;
            thisTimeOut = (faderStat) ? 10 : thisTimeOut;
            if(items.length > 0) {
                timeOutFn = setTimeout(makeSlider, thisTimeOut);
            } else {
                console.log("Poof..");
            }
        }
        
        var makeSlider = function() {
            current = (current != null) ? current : items[(items.length-1)];
            var currNo      = jQuery.inArray(current, items) + 1
            currNo = (currNo == items.length) ? 0 : (currNo - 1);
            var newMargin   = $(element).width() * currNo;
            if(faderStat == true) {
                if(!mOver) {
                    $(items[currNo]).fadeIn((timeOut/6), function() {
                        if($(itemsSpan[currNo]).css('bottom') == 0) {
                            $(itemsSpan[currNo]).slideUp((timeOut/6), function() {
                                faderStat = false;
                                current = items[currNo];
                                if(!mOver) {
                                    fadeElement(false);
                                }
                            });
                        } else {
                            $(itemsSpan[currNo]).slideDown((timeOut/6), function() {
                                faderStat = false;
                                current = items[currNo];
                                if(!mOver) {
                                    fadeElement(false);
                                }
                            });
                        }
                    });
                }
            } else {
                if(!mOver) {
                    if($(itemsSpan[currNo]).css('bottom') == 0) {
                        $(itemsSpan[currNo]).slideDown((timeOut/6), function() {
                            $(items[currNo]).fadeOut((timeOut/6), function() {
                                faderStat = true;
                                current = items[(currNo+1)];
                                if(!mOver) {
                                    fadeElement(false);
                                }
                            });
                        });
                    } else {
                        $(itemsSpan[currNo]).slideUp((timeOut/6), function() {
                        $(items[currNo]).fadeOut((timeOut/6), function() {
                                faderStat = true;
                                current = items[(currNo+1)];
                                if(!mOver) {
                                    fadeElement(false);
                                }
                            });
                        });
                    }
                }
            }
        }
        
        makeSlider();

    };  

})(jQuery);  

 //ENDFILE 



//------message.js

function messageDoCompose(r, c) {
	if(!r) {
		r = "";
	}
	
	var d = $(document.createElement("DIV"));
	
	d.html("Carregando...").ajaxError(function (e, xhr) {
		d.remove();
		
		jalert(xhr.responseText);
	}).load(__site + "message/compose/" + r, function () {
		$("#f-messages-compose-t-to").val(c);
	});
	
	d.dialog({
		modal: true,
		title: "Criar mensagem",
		close: function () {
			d.remove();
		},
		buttons: {
			"Enviar": function () {
				$.ajax({
					url: __site + "message/compose/" + $("#f-messages-compose-h-reply-id").val(),
					type: "post",
					data: $("#f-messages-compose").serialize(),
					success: function (e) {
						if(!e) {
							d.remove();
						} else {
							d.html(e);
						}
					}
				});
				
				d.html("Enviando...");
			},
			"Cancelar": function () {
				d.remove();
			}
		}
	});
}

function doMessageRead(i, g) {
	var d = $(document.createElement("DIV"));
	
	d.html("Carregando...").ajaxError(function (e, xhr) {
		d.remove();
		
		jalert(xhr.responseText);
	}).load(__site + "message/read/" + i + '/' + (g ? '1' : ''));	
	
	d.dialog({
		modal: true,
		title: "Ler mensagem",
		close: function () {
			d.remove();
		}
	})
	
	if(g) {
		d.dialog({
			buttons: {
				"Fechar": function () {
					d.remove();
				}
			}
		});	
	} else {
		d.dialog({
			buttons: {
				"Responder": function () {
					messageDoCompose($("#h-messages-current-meesage-id").val());
					d.remove();
				},
				"Fechar": function () {
					d.remove();
				}
			}
		});
	}
}

function messageDoRemoveAll() {
	var d = $(document.createElement("DIV"));

	d.html("Você realmente quer remover todas as suas mensagens?<br />" +
		   "Essa ação não pode ser desfeita.");

	d.dialog({
		modal: true,
		title: "Remover mensagens",
		close: function () {
			d.remove();
		},
		buttons: {
			"Continuar": function () {
				d.remove();
				
				$.ajax({
					url: __site + "message/removeall",
					success: function () {
						messageDoList();
					}
				});				
			},
			"Cancelar": function () {
				d.remove();
			}
		}
	});
}

function messageDoMarkAllRead() {
	var d = $(document.createElement("DIV"));

	d.html("Você realmente quer marcar todas as suas mensagens como lidas?<br />" +
		   "Essa ação não pode ser desfeita.");

	d.dialog({
		modal: true,
		title: "Marcar mensagens",
		close: function () {
			d.remove();
		},
		buttons: {
			"Continuar": function () {
				d.remove();
				
				$.ajax({
					url: __site + "message/readall",
					success: function () {
						messageDoList();					
					}
				});				
			},
			"Cancelar": function () {
				d.remove();
			}
		}
	});
}

function messageDoList(p) {
	if(!p) {
		p = 1;
	}
	
	$.ajax({
		url: __site + "message/get/" + p,
		success: function (e) {
			$("#d-messages-message").html(e);
		}
	});
}

function messageDoBlockList() {
	var d = $(document.createElement("DIV"));

	d.html("Carregando...").attr("id", "d-messages-blocklist").load(__site + "message/blocklist/");
	
	d.dialog({
		modal: true,
		width: 500,
		height: 300,
		title: "Jogadores bloqueados",
		close: function () {
			d.remove();
		},
		buttons: {
			"Fechar": function () {
				d.remove();
			}
		}
	});
}

function messageDoBlock() {
	$.ajax({
		url: __site + "message/blocklist/1",
		data: $("#f-messages-blocklist").serialize(),
		type: "post",
		success: function (e) {
			$("#d-messages-blocklist").html(e);
		}
	});
	
	$("#d-messages-blocklist").html("Carregando Informações...");
}

function messageDoUnblock(i) {
	$.ajax({
		url: __site + "message/blocklist/2",
		data: {player: i, __FORMKEY: $("#__FORMKEY").val()},
		type: "post",
		success: function (e) {
			$("#d-messages-blocklist").html(e);
		}
	});
	
	$("#d-messages-blocklist").html("Carregando Informações...");
}

 //ENDFILE 



//------training_waiting.js

function doTrainingWaitingFinish() {
	getAction("training/finish", $("#f-training-waiting").serialize())
}

function doTrainingWaitingCancel() {
	jconfirm('Todo tempo gasto até agora será pedido, quer mesmo continuar ?', null, function () {
		getAction("training/cancel", $("#f-training-waiting").serialize())	
	});
}

 //ENDFILE 



//------quest_status.js

function doQuestStatusFinish() {
	getAction("quest/finish", $("#f-quest-status").serialize());
}

function doQuestStatusCancel() {
	if(confirm("Você realmente quer cancelar essa missão? Todo seu tempo até agora será desperdiçado!")) {
		getAction("quest/cancel", $("#f-quest-status").serialize());
	}
}

 //ENDFILE 



//------graduation.js

function doGraduationLearn(i) {
	$("#f-graduatiion-h-graduation").val(i);
	
	getAction("graduation/learn", $("#f-graduation").serialize());
}

function doGraduationBattleStyleLearn(i) {
	$("#f-graduation-battle-style-h-graduation-battle-style").val(i);
	
	getAction("graduation/battle_style_learn", $("#f-graduation-battle-style").serialize());
}

function doGraduationBattleStyleTrain() {
	getAction("graduation/battle_style_begin", $("#f-graduation-battle-style-train").serialize());
}

function doBattleStyleTrainingCancel() {
	jconfirm("Todo seu tempo até agora será perdido. Deseja realmente cancelar ?", "", function () {
		getAction("graduation/battle_style_cancel", $("#f-battle-style-training-waiting").serialize());
	});
}

function doBattleStyleTrainingWaitingFinish() {
	getAction("graduation/battle_style_finish", $("#f-battle-style-training-waiting").serialize());
}

 //ENDFILE 



//------battlefield.js

function doBattlefieldCreate() {
	getAction("battlefield/waiting/1", $("#f-battlefield").serialize());
}

function doBattleWaitingCancel() {
	getAction("battlefield/waiting/2", $("#f-battlefield-waiting").serialize());
}

function doBattlefieldBattle(id, o) {
	if(o == 0) {
		$("#f-battlefield-h-battle-wait").val(id);
	} else if (o == 1) {
		$("#f-battlefield-h-npc").val(1);
	}
	
	getAction("battlefield/begin", $("#f-battlefield").serialize());
}

function doBattlefieldTab(o, v) {
	if(o) {
		$(".d-battlefield-tab").addClass("apagado");
		$(o).removeClass("apagado");
	}
	
	switch(v) {
		case 1:
			$("#d-battlefield-create-battle").show();
			$("#d-battlefield-list-container-pvp").hide();
			$("#d-battlefield-list-container-npc").hide();
			
			break;
		
		case 2:
			$("#d-battlefield-create-battle").hide();
			$("#d-battlefield-list-container-pvp").show();
			$("#d-battlefield-list-container-npc").hide();
					
			break;
		
		case 3:
			$("#d-battlefield-create-battle").hide();
			$("#d-battlefield-list-container-pvp").hide();
			$("#d-battlefield-list-container-npc").show();
					
			break;	
	}
}

 //ENDFILE 



//------jquery.tools.min.js

/*
 * jQuery Tools 1.2.5 - The missing UI library for the Web
 * 
 * [tabs, scrollable]
 * 
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 * 
 * http://flowplayer.org/tools/
 * 
 * File generated: Mon Nov 22 17:39:33 GMT 2010
 */
(function(c){function p(d,b,a){var e=this,l=d.add(this),h=d.find(a.tabs),i=b.jquery?b:d.children(b),j;h.length||(h=d.children());i.length||(i=d.parent().find(b));i.length||(i=c(b));c.extend(this,{click:function(f,g){var k=h.eq(f);if(typeof f=="string"&&f.replace("#","")){k=h.filter("[href*="+f.replace("#","")+"]");f=Math.max(h.index(k),0)}if(a.rotate){var n=h.length-1;if(f<0)return e.click(n,g);if(f>n)return e.click(0,g)}if(!k.length){if(j>=0)return e;f=a.initialIndex;k=h.eq(f)}if(f===j)return e;
g=g||c.Event();g.type="onBeforeClick";l.trigger(g,[f]);if(!g.isDefaultPrevented()){o[a.effect].call(e,f,function(){g.type="onClick";l.trigger(g,[f])});j=f;h.removeClass(a.current);k.addClass(a.current);return e}},getConf:function(){return a},getTabs:function(){return h},getPanes:function(){return i},getCurrentPane:function(){return i.eq(j)},getCurrentTab:function(){return h.eq(j)},getIndex:function(){return j},next:function(){return e.click(j+1)},prev:function(){return e.click(j-1)},destroy:function(){h.unbind(a.event).removeClass(a.current);
i.find("a[href^=#]").unbind("click.T");return e}});c.each("onBeforeClick,onClick".split(","),function(f,g){c.isFunction(a[g])&&c(e).bind(g,a[g]);e[g]=function(k){k&&c(e).bind(g,k);return e}});if(a.history&&c.fn.history){c.tools.history.init(h);a.event="history"}h.each(function(f){c(this).bind(a.event,function(g){e.click(f,g);return g.preventDefault()})});i.find("a[href^=#]").bind("click.T",function(f){e.click(c(this).attr("href"),f)});if(location.hash&&a.tabs=="a"&&d.find("[href="+location.hash+"]").length)e.click(location.hash);
else if(a.initialIndex===0||a.initialIndex>0)e.click(a.initialIndex)}c.tools=c.tools||{version:"1.2.5"};c.tools.tabs={conf:{tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",initialIndex:0,event:"click",rotate:false,history:false},addEffect:function(d,b){o[d]=b}};var o={"default":function(d,b){this.getPanes().hide().eq(d).show();b.call()},fade:function(d,b){var a=this.getConf(),e=a.fadeOutSpeed,l=this.getPanes();e?l.fadeOut(e):l.hide();l.eq(d).fadeIn(a.fadeInSpeed,b)},slide:function(d,
b){this.getPanes().slideUp(200);this.getPanes().eq(d).slideDown(400,b)},ajax:function(d,b){this.getPanes().eq(0).load(this.getTabs().eq(d).attr("href"),b)}},m;c.tools.tabs.addEffect("horizontal",function(d,b){m||(m=this.getPanes().eq(0).width());this.getCurrentPane().animate({width:0},function(){c(this).hide()});this.getPanes().eq(d).animate({width:m},function(){c(this).show();b.call()})});c.fn.tabs=function(d,b){var a=this.data("tabs");if(a){a.destroy();this.removeData("tabs")}if(c.isFunction(b))b=
{onBeforeClick:b};b=c.extend({},c.tools.tabs.conf,b);this.each(function(){a=new p(c(this),d,b);c(this).data("tabs",a)});return b.api?a:this}})(jQuery);
(function(e){function p(f,c){var b=e(c);return b.length<2?b:f.parent().find(c)}function u(f,c){var b=this,n=f.add(b),g=f.children(),l=0,j=c.vertical;k||(k=b);if(g.length>1)g=e(c.items,f);e.extend(b,{getConf:function(){return c},getIndex:function(){return l},getSize:function(){return b.getItems().size()},getNaviButtons:function(){return o.add(q)},getRoot:function(){return f},getItemWrap:function(){return g},getItems:function(){return g.children(c.item).not("."+c.clonedClass)},move:function(a,d){return b.seekTo(l+
a,d)},next:function(a){return b.move(1,a)},prev:function(a){return b.move(-1,a)},begin:function(a){return b.seekTo(0,a)},end:function(a){return b.seekTo(b.getSize()-1,a)},focus:function(){return k=b},addItem:function(a){a=e(a);if(c.circular){g.children("."+c.clonedClass+":last").before(a);g.children("."+c.clonedClass+":first").replaceWith(a.clone().addClass(c.clonedClass))}else g.append(a);n.trigger("onAddItem",[a]);return b},seekTo:function(a,d,h){a.jquery||(a*=1);if(c.circular&&a===0&&l==-1&&d!==
0)return b;if(!c.circular&&a<0||a>b.getSize()||a<-1)return b;var i=a;if(a.jquery)a=b.getItems().index(a);else i=b.getItems().eq(a);var r=e.Event("onBeforeSeek");if(!h){n.trigger(r,[a,d]);if(r.isDefaultPrevented()||!i.length)return b}i=j?{top:-i.position().top}:{left:-i.position().left};l=a;k=b;if(d===undefined)d=c.speed;g.animate(i,d,c.easing,h||function(){n.trigger("onSeek",[a])});return b}});e.each(["onBeforeSeek","onSeek","onAddItem"],function(a,d){e.isFunction(c[d])&&e(b).bind(d,c[d]);b[d]=function(h){h&&
e(b).bind(d,h);return b}});if(c.circular){var s=b.getItems().slice(-1).clone().prependTo(g),t=b.getItems().eq(1).clone().appendTo(g);s.add(t).addClass(c.clonedClass);b.onBeforeSeek(function(a,d,h){if(!a.isDefaultPrevented())if(d==-1){b.seekTo(s,h,function(){b.end(0)});return a.preventDefault()}else d==b.getSize()&&b.seekTo(t,h,function(){b.begin(0)})});b.seekTo(0,0,function(){})}var o=p(f,c.prev).click(function(){b.prev()}),q=p(f,c.next).click(function(){b.next()});if(!c.circular&&b.getSize()>1){b.onBeforeSeek(function(a,
d){setTimeout(function(){if(!a.isDefaultPrevented()){o.toggleClass(c.disabledClass,d<=0);q.toggleClass(c.disabledClass,d>=b.getSize()-1)}},1)});c.initialIndex||o.addClass(c.disabledClass)}c.mousewheel&&e.fn.mousewheel&&f.mousewheel(function(a,d){if(c.mousewheel){b.move(d<0?1:-1,c.wheelSpeed||50);return false}});if(c.touch){var m={};g[0].ontouchstart=function(a){a=a.touches[0];m.x=a.clientX;m.y=a.clientY};g[0].ontouchmove=function(a){if(a.touches.length==1&&!g.is(":animated")){var d=a.touches[0],h=
m.x-d.clientX;d=m.y-d.clientY;b[j&&d>0||!j&&h>0?"next":"prev"]();a.preventDefault()}}}c.keyboard&&e(document).bind("keydown.scrollable",function(a){if(!(!c.keyboard||a.altKey||a.ctrlKey||e(a.target).is(":input")))if(!(c.keyboard!="static"&&k!=b)){var d=a.keyCode;if(j&&(d==38||d==40)){b.move(d==38?-1:1);return a.preventDefault()}if(!j&&(d==37||d==39)){b.move(d==37?-1:1);return a.preventDefault()}}});c.initialIndex&&b.seekTo(c.initialIndex,0,function(){})}e.tools=e.tools||{version:"1.2.5"};e.tools.scrollable=
{conf:{activeClass:"active",circular:false,clonedClass:"cloned",disabledClass:"disabled",easing:"swing",initialIndex:0,item:null,items:".items",keyboard:true,mousewheel:false,next:".next",prev:".prev",speed:400,vertical:false,touch:true,wheelSpeed:0}};var k;e.fn.scrollable=function(f){var c=this.data("scrollable");if(c)return c;f=e.extend({},e.tools.scrollable.conf,f);this.each(function(){c=new u(e(this),f);e(this).data("scrollable",c)});return f.api?c:this}})(jQuery);


 //ENDFILE 



//------recuperar.js

function recuperarSenha(o) {
	if(!o) {
		getAction("user/recover", $("#f-user-recover").serialize());
	} else {
		getAction("user/recover/" + $("#f-user-recover-h-key").val(), $("#f-user-recover").serialize());		
	}
}

 //ENDFILE 



//------user_password.js

function doUserPasswordChange() {
	getAction("user/password", $("#f-user-password").serialize()); 
}

 //ENDFILE 



//------quest.js

function doQuestAccept(i) {
	$("#f-quest-h-quest").val(i);
	$("#f-quest-h-duration").val($("#s-quest-duration-" + i).val());
	
	getAction("quest/accept", $("#f-quest").serialize());
}

function doQuestUpdateRewards(o, v, e) {
	$("#d-quest-currency-" + o).html(v * $("#s-quest-duration-" + o).val());
	$("#d-quest-exp-" + o).html(e * $("#s-quest-duration-" + o).val());
}

function doQuestTab(v) {
	$(".tr_quest").hide();
	$(".tr_quest" + v).show();
	
	$(".questPager").hide();
	$("#questPager_" + v).show();
	
	doQuestPage(v, 1);
}

 function doQuestPage(v, p) {
	 $(".tr_quest" + v).hide();
	 $(".tr_quest" + v + "_page_" + p).show();
 }

 //ENDFILE 



//------AC_RunActiveContent.js

//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated.  All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '';
  if (isIE && isWin && !isOpera)
  {
    str += '<object ';
    for (var i in objAttrs)
    {
      str += i + '="' + objAttrs[i] + '" ';
    }
    str += '>';
    for (var i in params)
    {
      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
    }
    str += '</object>';
  }
  else
  {
    str += '<embed ';
    for (var i in embedAttrs)
    {
      str += i + '="' + embedAttrs[i] + '" ';
    }
    str += '> </embed>';
  }

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
      case "id":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}


 //ENDFILE 



//------user_registration.js

function doUserRegistration() {
	getAction("user/registration", $("#f-user-registration").serialize()); 
}

 //ENDFILE 



//------training.js

function doTrainingLearn(i, l) {
	$("#f-training-h-item").val(i);
	
	if(l) {
		getAction("training/level", $("#f-training").serialize());
	} else {
		getAction("training/learn", $("#f-training").serialize());	
	}
}

function doTrainingItemLevel(i) {
	getAction("training/begin", $("#f-training-item-level-" + i).serialize());	
}

function doTrainingAttributeManual() {
	getAction("training/attribute/1", $("#f-training-attribute-manual").serialize());
}

function doTrainingAttributeDistrib(at, dist) {
	$("#f-training-attribute-distrib-h-at").val(at);
	
	if(dist) {
		$("#f-training-attribute-distrib-h-dist").val(1);
	}
	
	getAction("training/attribute/2", $("#f-training-attribute-distrib").serialize());
}

function doTrainingAttributeAuto() {
	getAction("training/attribute_begin", $("#f-training-attribute-auto").serialize());
}

function doCharacterTrainAttributeEnd() {
	getAction("training/attribute_finish", $("#f-training-attribute-waiting").serialize());
}

function doTrainingUpdateReiatsuConsume(v) {
	$("#d-training-attribute-rei-consume").html(__training_attribute_rei_c * v)
}

 //ENDFILE 



//------character_talent_tree.js

function doCharacterTalentTreeLearn(i) {
	getAction("character/talent_tree/1",{
		__FORMKEY: $("#__FORMKEY").val(),
		item: i
	});
}

function doCharacterTalentTreeLearnLevel(i) {
	getAction("character/talent_tree/2",{
		__FORMKEY: $("#__FORMKEY").val(),
		item: i
	});
}

function doCharacterTaleTreeTrainingTime() {
	getAction("character/train_skill/1", $("#f-character-talent-tree-skill-training-time").serialize());
}

function doCharacterTaleTreeTrainingQuick() {
	getAction("character/train_skill/3", $("#f-character-talent-tree-skill-training").serialize());
}

function doCharacterTaleTreeTrainingLevel() {
	getAction("character/train_skill_level/1", $("#f-character-talent-tree-skill-training-level").serialize());
}



 //ENDFILE 



//------character_create.js

function doCharacterCreateClassSelect(i) {
	getAction("character/create/2", {category: i, __FORMKEY: $("#__FORMKEY").val()}); 	
}

function doCharacterCreatePlayerSelect(i) {
	getAction("character/create/3", $("#f-character-create").serialize()); 	
}

function doCharacterCreateDesctiption(i) {
	var c = _arPlayerDescriptions[i];

	$("#f-user-character-create-h-player").val(i);

	$("#d-character-create-characters img").animate({opacity: .4}, "fast");
	$("#f-character-create-i-character-" + i).animate({opacity: 1});

	var mx = Math.max(c.vit, c.rei, c.agi, c.forc, c.inte, c.def_magic, c.atk_magic, c.def_physic, c.atk_physic, c.res, c.pe);

	expBarValue("#barDefMagic", c.def_magic, mx, c.def_magic, true);
	expBarValue("#barAtkMagic", c.atk_magic, mx, c.atk_magic, true);
	expBarValue("#barDefPhysic", c.def_physic, mx, c.def_physic, true);
	expBarValue("#barAtkPhysic", c.atk_physic, mx, c.atk_physic, true);

	expBarValue("#barForc", c.forc, mx, c.forc, true);
	expBarValue("#barInte", c.inte, mx, c.inte, true);
	expBarValue("#barAgi", c.agi, mx, c.agi, true);
	expBarValue("#barPee", c.pee, mx, c.pee, true);
	expBarValue("#barPe", c.pe, mx, c.pe, true);
	expBarValue("#barRei", c.rei, mx, c.rei, true);
	expBarValue("#barVit", c.vit, mx, c.vit, true);
	expBarValue("#barRes", c.res, mx, c.res, true);

	$('#i-character-create-img').attr('src', __site_absolute + 'images/characters/selection/' + i + '.jpg');

	$("#cnName").html(c.name);
	$("#cnCategory").html(c.category);
	$("#cnLife").html(c.life);
	$("#cnReiatsu").html(c.reiatsu);
	$("#cnPee").html(c.pee);
}

 //ENDFILE 



//------ativacao.js

function doAtivacaoManual() {
	getAction("user/activate", $("#f-user-activate").serialize());
}

 //ENDFILE 



//------character_train_skill_level.js

function doCharacterTrainSkillLevelEnd() {
	getAction("character/train_skill_level/2", $("#f-character-train-skill-level").serialize())	
}

 //ENDFILE 



//------quest_waiting.js

function doQuestWaitingFinish() {
	getAction("quest/finish", $("#f-quest-waiting").serialize());
}

function doQuestWaitingCancel() {
	if(confirm("Vcê realmente quer cancelar essa missão? Todo seu tempo até agora será desperdiçado!")) {
		getAction("quest/cancel", $("#f-quest-waiting").serialize());
	}
}

 //ENDFILE 



//------shop.js

function doShopSelectTab(i) {
	$(".tr-shop").hide();
	$(".tr-shop-" + i).show();	
}

 //ENDFILE 



//------swfobject_modified.js

/*!	SWFObject v2.0 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/

var swfobject = function() {
	
	var UNDEF = "undefined",
		OBJECT = "object",
		SHOCKWAVE_FLASH = "Shockwave Flash",
		SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
		FLASH_MIME_TYPE = "application/x-shockwave-flash",
		EXPRESS_INSTALL_ID = "SWFObjectExprInst",
		
		win = window,
		doc = document,
		nav = navigator,
		
		domLoadFnArr = [],
		regObjArr = [],
		timer = null,
		storedAltContent = null,
		storedAltContentId = null,
		isDomLoaded = false,
		isExpressInstallActive = false;
	
	/* Centralized function for browser feature detection
		- Proprietary feature detection (conditional compiling) is used to detect Internet Explorer's features
		- User agent string detection is only used when no alternative is possible
		- Is executed directly for optimal performance
	*/	
	var ua = function() {
		var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF && typeof doc.appendChild != UNDEF && typeof doc.replaceChild != UNDEF && typeof doc.removeChild != UNDEF && typeof doc.cloneNode != UNDEF,
			playerVersion = [0,0,0],
			d = null;
		if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
			d = nav.plugins[SHOCKWAVE_FLASH].description;
			if (d) {
				d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
				playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
				playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
				playerVersion[2] = /r/.test(d) ? parseInt(d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
			}
		}
		else if (typeof win.ActiveXObject != UNDEF) {
			var a = null, fp6Crash = false;
			try {
				a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".7");
			}
			catch(e) {
				try { 
					a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".6");
					playerVersion = [6,0,21];
					a.AllowScriptAccess = "always";  // Introduced in fp6.0.47
				}
				catch(e) {
					if (playerVersion[0] == 6) {
						fp6Crash = true;
					}
				}
				if (!fp6Crash) {
					try {
						a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
					}
					catch(e) {}
				}
			}
			if (!fp6Crash && a) { // a will return null when ActiveX is disabled
				try {
					d = a.GetVariable("$version");  // Will crash fp6.0.21/23/29
					if (d) {
						d = d.split(" ")[1].split(",");
						playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
					}
				}
				catch(e) {}
			}
		}
		var u = nav.userAgent.toLowerCase(),
			p = nav.platform.toLowerCase(),
			webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
			ie = false,
			windows = p ? /win/.test(p) : /win/.test(u),
			mac = p ? /mac/.test(p) : /mac/.test(u);
		/*@cc_on
			ie = true;
			@if (@_win32)
				windows = true;
			@elif (@_mac)
				mac = true;
			@end
		@*/
		return { w3cdom:w3cdom, pv:playerVersion, webkit:webkit, ie:ie, win:windows, mac:mac };
	}();

	/* Cross-browser onDomLoad
		- Based on Dean Edwards' solution: http://dean.edwards.name/weblog/2006/06/again/
		- Will fire an event as soon as the DOM of a page is loaded (supported by Gecko based browsers - like Firefox -, IE, Opera9+, Safari)
	*/ 
	var onDomLoad = function() {
		if (!ua.w3cdom) {
			return;
		}
		addDomLoadEvent(main);
		if (ua.ie && ua.win) {
			try {  // Avoid a possible Operation Aborted error
				doc.write("<scr" + "ipt id=__ie_ondomload defer=true src=//:></scr" + "ipt>"); // String is split into pieces to avoid Norton AV to add code that can cause errors 
				var s = getElementById("__ie_ondomload");
				if (s) {
					s.onreadystatechange = function() {
						if (this.readyState == "complete") {
							this.parentNode.removeChild(this);
							callDomLoadFunctions();
						}
					};
				}
			}
			catch(e) {}
		}
		if (ua.webkit && typeof doc.readyState != UNDEF) {
			timer = setInterval(function() { if (/loaded|complete/.test(doc.readyState)) { callDomLoadFunctions(); }}, 10);
		}
		if (typeof doc.addEventListener != UNDEF) {
			doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, null);
		}
		addLoadEvent(callDomLoadFunctions);
	}();
	
	function callDomLoadFunctions() {
		if (isDomLoaded) {
			return;
		}
		if (ua.ie && ua.win) { // Test if we can really add elements to the DOM; we don't want to fire it too early
			var s = createElement("span");
			try { // Avoid a possible Operation Aborted error
				var t = doc.getElementsByTagName("body")[0].appendChild(s);
				t.parentNode.removeChild(t);
			}
			catch (e) {
				return;
			}
		}
		isDomLoaded = true;
		if (timer) {
			clearInterval(timer);
			timer = null;
		}
		var dl = domLoadFnArr.length;
		for (var i = 0; i < dl; i++) {
			domLoadFnArr[i]();
		}
	}
	
	function addDomLoadEvent(fn) {
		if (isDomLoaded) {
			fn();
		}
		else { 
			domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
		}
	}
	
	/* Cross-browser onload
		- Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
		- Will fire an event as soon as a web page including all of its assets are loaded 
	 */
	function addLoadEvent(fn) {
		if (typeof win.addEventListener != UNDEF) {
			win.addEventListener("load", fn, false);
		}
		else if (typeof doc.addEventListener != UNDEF) {
			doc.addEventListener("load", fn, false);
		}
		else if (typeof win.attachEvent != UNDEF) {
			win.attachEvent("onload", fn);
		}
		else if (typeof win.onload == "function") {
			var fnOld = win.onload;
			win.onload = function() {
				fnOld();
				fn();
			};
		}
		else {
			win.onload = fn;
		}
	}
	
	/* Main function
		- Will preferably execute onDomLoad, otherwise onload (as a fallback)
	*/
	function main() { // Static publishing only
		var rl = regObjArr.length;
		for (var i = 0; i < rl; i++) { // For each registered object element
			var id = regObjArr[i].id;
			if (ua.pv[0] > 0) {
				var obj = getElementById(id);
				if (obj) {
					regObjArr[i].width = obj.getAttribute("width") ? obj.getAttribute("width") : "0";
					regObjArr[i].height = obj.getAttribute("height") ? obj.getAttribute("height") : "0";
					if (hasPlayerVersion(regObjArr[i].swfVersion)) { // Flash plug-in version >= Flash content version: Houston, we have a match!
						if (ua.webkit && ua.webkit < 312) { // Older webkit engines ignore the object element's nested param elements
							fixParams(obj);
						}
						setVisibility(id, true);
					}
					else if (regObjArr[i].expressInstall && !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) { // Show the Adobe Express Install dialog if set by the web page author and if supported (fp6.0.65+ on Win/Mac OS only)
						showExpressInstall(regObjArr[i]);
					}
					else { // Flash plug-in and Flash content version mismatch: display alternative content instead of Flash content
						displayAltContent(obj);
					}
				}
			}
			else {  // If no fp is installed, we let the object element do its job (show alternative content)
				setVisibility(id, true);
			}
		}
	}
	
	/* Fix nested param elements, which are ignored by older webkit engines
		- This includes Safari up to and including version 1.2.2 on Mac OS 10.3
		- Fall back to the proprietary embed element
	*/
	function fixParams(obj) {
		var nestedObj = obj.getElementsByTagName(OBJECT)[0];
		if (nestedObj) {
			var e = createElement("embed"), a = nestedObj.attributes;
			if (a) {
				var al = a.length;
				for (var i = 0; i < al; i++) {
					if (a[i].nodeName.toLowerCase() == "data") {
						e.setAttribute("src", a[i].nodeValue);
					}
					else {
						e.setAttribute(a[i].nodeName, a[i].nodeValue);
					}
				}
			}
			var c = nestedObj.childNodes;
			if (c) {
				var cl = c.length;
				for (var j = 0; j < cl; j++) {
					if (c[j].nodeType == 1 && c[j].nodeName.toLowerCase() == "param") {
						e.setAttribute(c[j].getAttribute("name"), c[j].getAttribute("value"));
					}
				}
			}
			obj.parentNode.replaceChild(e, obj);
		}
	}
	
	/* Fix hanging audio/video threads and force open sockets and NetConnections to disconnect
		- Occurs when unloading a web page in IE using fp8+ and innerHTML/outerHTML
		- Dynamic publishing only
	*/
	function fixObjectLeaks(id) {
		if (ua.ie && ua.win && hasPlayerVersion("8.0.0")) {
			win.attachEvent("onunload", function () {
				var obj = getElementById(id);
				if (obj) {
					for (var i in obj) {
						if (typeof obj[i] == "function") {
							obj[i] = function() {};
						}
					}
					obj.parentNode.removeChild(obj);
				}
			});
		}
	}
	
	/* Show the Adobe Express Install dialog
		- Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
	*/
	function showExpressInstall(regObj) {
		isExpressInstallActive = true;
		var obj = getElementById(regObj.id);
		if (obj) {
			if (regObj.altContentId) {
				var ac = getElementById(regObj.altContentId);
				if (ac) {
					storedAltContent = ac;
					storedAltContentId = regObj.altContentId;
				}
			}
			else {
				storedAltContent = abstractAltContent(obj);
			}
			if (!(/%$/.test(regObj.width)) && parseInt(regObj.width, 10) < 310) {
				regObj.width = "310";
			}
			if (!(/%$/.test(regObj.height)) && parseInt(regObj.height, 10) < 137) {
				regObj.height = "137";
			}
			doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
			var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
				dt = doc.title,
				fv = "MMredirectURL=" + win.location + "&MMplayerType=" + pt + "&MMdoctitle=" + dt,
				replaceId = regObj.id;
			// For IE when a SWF is loading (AND: not available in cache) wait for the onload event to fire to remove the original object element
			// In IE you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
			if (ua.ie && ua.win && obj.readyState != 4) {
				var newObj = createElement("div");
				replaceId += "SWFObjectNew";
				newObj.setAttribute("id", replaceId);
				obj.parentNode.insertBefore(newObj, obj); // Insert placeholder div that will be replaced by the object element that loads expressinstall.swf
				obj.style.display = "none";
				win.attachEvent("onload", function() { obj.parentNode.removeChild(obj); });
			}
			createSWF({ data:regObj.expressInstall, id:EXPRESS_INSTALL_ID, width:regObj.width, height:regObj.height }, { flashvars:fv }, replaceId);
		}
	}
	
	/* Functions to abstract and display alternative content
	*/
	function displayAltContent(obj) {
		if (ua.ie && ua.win && obj.readyState != 4) {
			// For IE when a SWF is loading (AND: not available in cache) wait for the onload event to fire to remove the original object element
			// In IE you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
			var el = createElement("div");
			obj.parentNode.insertBefore(el, obj); // Insert placeholder div that will be replaced by the alternative content
			el.parentNode.replaceChild(abstractAltContent(obj), el);
			obj.style.display = "none";
			win.attachEvent("onload", function() { obj.parentNode.removeChild(obj); });
		}
		else {
			obj.parentNode.replaceChild(abstractAltContent(obj), obj);
		}
	}	

	function abstractAltContent(obj) {
		var ac = createElement("div");
		if (ua.win && ua.ie) {
			ac.innerHTML = obj.innerHTML;
		}
		else {
			var nestedObj = obj.getElementsByTagName(OBJECT)[0];
			if (nestedObj) {
				var c = nestedObj.childNodes;
				if (c) {
					var cl = c.length;
					for (var i = 0; i < cl; i++) {
						if (!(c[i].nodeType == 1 && c[i].nodeName.toLowerCase() == "param") && !(c[i].nodeType == 8)) {
							ac.appendChild(c[i].cloneNode(true));
						}
					}
				}
			}
		}
		return ac;
	}
	
	/* Cross-browser dynamic SWF creation
	*/
	function createSWF(attObj, parObj, id) {
		var r, el = getElementById(id);
		if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
			attObj.id = id;
		}
		if (ua.ie && ua.win) { // IE, the object element and W3C DOM methods do not combine: fall back to outerHTML
			var att = "";
			for (var i in attObj) {
				if (attObj[i] != Object.prototype[i]) { // Filter out prototype additions from other potential libraries, like Object.prototype.toJSONString = function() {}
					if (i == "data") {
						parObj.movie = attObj[i];
					}
					else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
						att += ' class="' + attObj[i] + '"';
					}
					else if (i != "classid") {
						att += ' ' + i + '="' + attObj[i] + '"';
					}
				}
			}
			var par = "";
			for (var j in parObj) {
				if (parObj[j] != Object.prototype[j]) { // Filter out prototype additions from other potential libraries
					par += '<param name="' + j + '" value="' + parObj[j] + '" />';
				}
			}
			el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
			fixObjectLeaks(attObj.id); // This bug affects dynamic publishing only
			r = getElementById(attObj.id);	
		}
		else if (ua.webkit && ua.webkit < 312) { // Older webkit engines ignore the object element's nested param elements: fall back to the proprietary embed element
			var e = createElement("embed");
			e.setAttribute("type", FLASH_MIME_TYPE);
			for (var k in attObj) {
				if (attObj[k] != Object.prototype[k]) { // Filter out prototype additions from other potential libraries
					if (k == "data") {
						e.setAttribute("src", attObj[k]);
					}
					else if (k.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
						e.setAttribute("class", attObj[k]);
					}
					else if (k != "classid") { // Filter out IE specific attribute
						e.setAttribute(k, attObj[k]);
					}
				}
			}
			for (var l in parObj) {
				if (parObj[l] != Object.prototype[l]) { // Filter out prototype additions from other potential libraries
					if (l != "movie") { // Filter out IE specific param element
						e.setAttribute(l, parObj[l]);
					}
				}
			}
			el.parentNode.replaceChild(e, el);
			r = e;
		}
		else { // Well-behaving browsers
			var o = createElement(OBJECT);
			o.setAttribute("type", FLASH_MIME_TYPE);
			for (var m in attObj) {
				if (attObj[m] != Object.prototype[m]) { // Filter out prototype additions from other potential libraries
					if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
						o.setAttribute("class", attObj[m]);
					}
					else if (m != "classid") { // Filter out IE specific attribute
						o.setAttribute(m, attObj[m]);
					}
				}
			}
			for (var n in parObj) {
				if (parObj[n] != Object.prototype[n] && n != "movie") { // Filter out prototype additions from other potential libraries and IE specific param element
					createObjParam(o, n, parObj[n]);
				}
			}
			el.parentNode.replaceChild(o, el);
			r = o;
		}
		return r;
	}
	
	function createObjParam(el, pName, pValue) {
		var p = createElement("param");
		p.setAttribute("name", pName);	
		p.setAttribute("value", pValue);
		el.appendChild(p);
	}
	
	function getElementById(id) {
		return doc.getElementById(id);
	}
	
	function createElement(el) {
		return doc.createElement(el);
	}
	
	function hasPlayerVersion(rv) {
		var pv = ua.pv, v = rv.split(".");
		v[0] = parseInt(v[0], 10);
		v[1] = parseInt(v[1], 10);
		v[2] = parseInt(v[2], 10);
		return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
	}
	
	/* Cross-browser dynamic CSS creation
		- Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
	*/	
	function createCSS(sel, decl) {
		if (ua.ie && ua.mac) {
			return;
		}
		var h = doc.getElementsByTagName("head")[0], s = createElement("style");
		s.setAttribute("type", "text/css");
		s.setAttribute("media", "screen");
		if (!(ua.ie && ua.win) && typeof doc.createTextNode != UNDEF) {
			s.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
		}
		h.appendChild(s);
		if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
			var ls = doc.styleSheets[doc.styleSheets.length - 1];
			if (typeof ls.addRule == OBJECT) {
				ls.addRule(sel, decl);
			}
		}
	}
	
	function setVisibility(id, isVisible) {
		var v = isVisible ? "inherit" : "hidden";
		if (isDomLoaded) {
			getElementById(id).style.visibility = v;
		}
		else {
			createCSS("#" + id, "visibility:" + v);
		}
	}
	
	function getTargetVersion(obj) {
	    if (!obj)
	        return 0;
		var c = obj.childNodes;
		var cl = c.length;
		for (var i = 0; i < cl; i++) {
			if (c[i].nodeType == 1 && c[i].nodeName.toLowerCase() == "object") {
			    c = c[i].childNodes;
			    cl = c.length;
			    i = 0;
			}     
			if (c[i].nodeType == 1 && c[i].nodeName.toLowerCase() == "param" && c[i].getAttribute("name") == "swfversion") {
			   return c[i].getAttribute("value"); 
			}
		}
		return 0;
	}
    
	function getExpressInstall(obj) {
	    if (!obj)
	        return "";
		var c = obj.childNodes;
		var cl = c.length;
		for (var i = 0; i < cl; i++) {
			if (c[i].nodeType == 1 && c[i].nodeName.toLowerCase() == "object") {
			    c = c[i].childNodes;
			    cl = c.length;
			    i = 0;
			}     
			if (c[i].nodeType == 1 && c[i].nodeName.toLowerCase() == "param" && c[i].getAttribute("name") == "expressinstall") { 
			    return c[i].getAttribute("value"); 
			}	       
		}
		return "";
	}
    
	return {
		/* Public API
			- Reference: http://code.google.com/p/swfobject/wiki/SWFObject_2_0_documentation
		*/ 
		registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr) {
			if (!ua.w3cdom || !objectIdStr) {
				return;
			}
			var obj = document.getElementById(objectIdStr);
			var xi = getExpressInstall(obj);
			var regObj = {};
			regObj.id = objectIdStr;
			regObj.swfVersion = swfVersionStr ? swfVersionStr : getTargetVersion(obj);
			regObj.expressInstall = xiSwfUrlStr ? xiSwfUrlStr : ((xi != "") ? xi : false);
			regObjArr[regObjArr.length] = regObj;
			setVisibility(objectIdStr, false);
		},
		
		getObjectById: function(objectIdStr) {
			var r = null;
			if (ua.w3cdom && isDomLoaded) {
				var o = getElementById(objectIdStr);
				if (o) {
					var n = o.getElementsByTagName(OBJECT)[0];
					if (!n || (n && typeof o.SetVariable != UNDEF)) {
				    	r = o;
					}
					else if (typeof n.SetVariable != UNDEF) {
						r = n;
					}
				}
			}
			return r;
		},
		
		embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj) {
			if (!ua.w3cdom || !swfUrlStr || !replaceElemIdStr || !widthStr || !heightStr || !swfVersionStr) {
				return;
			}
			widthStr += ""; // Auto-convert to string to make it idiot proof
			heightStr += "";
			if (hasPlayerVersion(swfVersionStr)) {
				setVisibility(replaceElemIdStr, false);
				var att = (typeof attObj == OBJECT) ? attObj : {};
				att.data = swfUrlStr;
				att.width = widthStr;
				att.height = heightStr;
				var par = (typeof parObj == OBJECT) ? parObj : {};
				if (typeof flashvarsObj == OBJECT) {
					for (var i in flashvarsObj) {
						if (flashvarsObj[i] != Object.prototype[i]) { // Filter out prototype additions from other potential libraries
							if (typeof par.flashvars != UNDEF) {
								par.flashvars += "&" + i + "=" + flashvarsObj[i];
							}
							else {
								par.flashvars = i + "=" + flashvarsObj[i];
							}
						}
					}
				}
				addDomLoadEvent(function() {
					createSWF(att, par, replaceElemIdStr);
					if (att.id == replaceElemIdStr) {
						setVisibility(replaceElemIdStr, true);
					}
				});
			}
			else if (xiSwfUrlStr && !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) {
				setVisibility(replaceElemIdStr, false);
				addDomLoadEvent(function() {
					var regObj = {};
					regObj.id = regObj.altContentId = replaceElemIdStr;
					regObj.width = widthStr;
					regObj.height = heightStr;
					regObj.expressInstall = xiSwfUrlStr;
					showExpressInstall(regObj);
				});
			}
		},
		
		getFlashPlayerVersion: function() {
			return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
		},
		
		hasFlashPlayerVersion:hasPlayerVersion,
		
		createSWF: function(attObj, parObj, replaceElemIdStr) {
			if (ua.w3cdom && isDomLoaded) {
				return createSWF(attObj, parObj, replaceElemIdStr);
			}
			else {
				return undefined;
			}
		},
		
		createCSS: function(sel, decl) {
			if (ua.w3cdom) {
				createCSS(sel, decl);
			}
		},
		
		addDomLoadEvent:addDomLoadEvent,
		
		addLoadEvent:addLoadEvent,
		
		getQueryParamValue: function(param) {
			var q = doc.location.search || doc.location.hash;
			if (param == null) {
				return q;
			}
		 	if(q) {
				var pairs = q.substring(1).split("&");
				for (var i = 0; i < pairs.length; i++) {
					if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
						return pairs[i].substring((pairs[i].indexOf("=") + 1));
					}
				}
			}
			return "";
		},
		
		// For internal usage only
		expressInstallCallback: function() {
			if (isExpressInstallActive && storedAltContent) {
				var obj = getElementById(EXPRESS_INSTALL_ID);
				if (obj) {
					obj.parentNode.replaceChild(storedAltContent, obj);
					if (storedAltContentId) {
						setVisibility(storedAltContentId, true);
						if (ua.ie && ua.win) {
							storedAltContent.style.display = "block";
						}
					}
					storedAltContent = null;
					storedAltContentId = null;
					isExpressInstallActive = false;
				}
			} 
		}
		
	};

}();


 //ENDFILE 



//------character_show.js

function doCharacterShowSelect(i) {
	var c = _arPlayerDescriptions[i];

	$("#f-character-show-h-player").val(i);

	$("#cnName").html(c.name);
	$("#cnCategory").html(c.category);
	$("#cnLevel").html(c.level);
	$("#cnCurrency").html(c.currency);
	
	$("#i-character-show-current-character").attr("src", __site_absolute + "images/characters/selection/" + c.id + ".jpg");

	expBarValue("#barVit", c.vit, c.vit_max, c.vit, true);
	expBarValue("#barRei", c.rei, c.rei_max, c.rei, true);
}

function doCharacterShowPlay() {
	if(!$("#f-character-show-h-player").val()) {
		alert("Nenhum personagem selecionado!");
		return;
	}
	
	getAction("character/select", $("#f-character-show").serialize()); 	
}

function doCharacterShowdelete() {
	if(!$("#f-character-show-h-player").val()) {
		alert("Nenhum personagem selecionado!");
		return;
	}
	
	if(confirm("Deseja realmente excluir esse personagem?")) {
		getAction("character/remove", $("#f-character-show").serialize());		
	}
}


 //ENDFILE 



//------global.js

function _(url) {
	if($.browser.msie && parseInt($.browser.version) < 8) {
		var date = new Date();
		
		if(url.indexOf("?") != -1) {
			url += "&";
		} else {
			url += "?";
		}
		
		url += "_cache=" + date.toGMTString().replace(/[^\d]/g, "");
	}
	
	return url;
}

function getAction(url, params) {
	$("#direita").html("Aguarde...");
	
	if(!params) {
		params = {};
	}
	
	$.ajax({
		url: __site + _(url),
		type: "post",
		data: params,
		success: function (e) {
			$("#direita").html(e);
		},
		
		error: function (xhr, e) {
			$("#direita").html("OPS! Ocorreu um erro! <pre>" + xhr.responseText + "</pre>");
		}
	});
}

function createTimer(h, m, s, t) {
	var _t = setInterval(function () {
		s--;
		
		if(s <= 0 && m <= 0 && h <= 0) {
			clearInterval(_t);
			
			location.reload();
			return;
		}
		
		if(s <= 0) {
			s = 59;
			m--;
			
			if(m <= 0 && h > 0) {
				h--;
				m = 59;
			}
		}
		
		$("#" + t).html(
			(h < 10 ? "0" + h : h) + ":" + (m < 10 ? "0" + m : m) + ":" + (s < 10 ? "0" + s : s)
		);
	}, 1000);
}

function expBarValue(obj, val, mx, text, effect) {
	obj = $(obj);
	
	mx = parseInt(mx);
	
	var _nw = ($(obj).width() / mx) * val;
	var _ow = $(obj).width();
	
	if(_nw > _ow) {
		_nw = _ow;
	}
	
	if(effect) {
		if(val >= (mx / 2)) {
			color = "#0066CC";
		} else if(val >= (mx / 3)) {
			color = "#FF9900";
		} else if(val < (mx / 3)) {
			color = "#FF0000";
		}
		
		//obj.css("background-color", color);
		obj.animate({backgroundColor: color});
	}
	
	$("#b", obj).animate({width: _nw});
	$("#t", obj).html(text);
}

$(document).ready(function () {
	$("#f-login-email").focus(function () {
		if($(this).val() == "digite seu email") {
			$(this).val("");
		}
	}).blur(function () {
		if(!$(this).val()) {
			$(this).val("digite seu email");
		}
	});

	$("#f-login-password-fake").focus(function () {
		$(this).hide();
		$("#f-login-password").show().focus();
	})
	
	$("#f-login-password").blur(function () {
		if(!$(this).val()) {
			$(this).hide();
			$("#f-login-password-fake").show();
		}
	});
});

function updateTooltips() {
	$("div.tooltip").each(function () {
		var t = $(this);
		
		if(t.attr("is_tooltip")) {
			return;
		} else {
			t.attr("is_tooltip", 1);
		}
		
		$("#" + t.attr("title"))
			.mouseover(function () {
				t.show("fast");
			})
			.mouseout(function () {
				t.hide("fast");
			});
	});
}

var __isInventoryShown = false;
var __inventoryContainer = null;
var __inventoryBlockContainer = null;
var __blockInventory = false;

function doInventory() {
	if(__blockInventory) {
		jalert('Inventário não disponível no momento');
		
		return;
	}
	
	if(!__inventoryContainer) {
		__inventoryContainer = $(document.createElement("DIV"));
		__inventoryBlockContainer = $(document.createElement("DIV"));
	}
	
	if(__isInventoryShown) {
		$(__inventoryContainer).remove();
		$(__inventoryBlockContainer).remove();

		$(document.body).css("overflow", "auto");	
		
		__isInventoryShown = false;
	} else {
		$.ajax({
			url: __site + "inventory/index",
			type: "post",
			success: function (e) {
				__inventoryContainer.html(e);			
			}
		});
		
		__inventoryContainer
			.html("Aguarde...")
			.addClass("d-inventory-container");
		
		$(window).resize(function () {
			inventoryUpdatePos();
		});
		
		$(document.body).css("overflow", "hidden");
		
		$(document.body).append(__inventoryContainer);
		$(document.body).append(__inventoryBlockContainer);
		
		__isInventoryShown = true;

		__inventoryBlockContainer
			.addClass("d-inventory-block-container")
			.animate({opacity: .7});
		
		inventoryUpdatePos();
	}
}

function inventoryUpdatePos() {
	if(__isInventoryShown) {
		__inventoryContainer.css("left", $(document.body).width() / 2 - __inventoryContainer.width() / 2).css("z-index", 100);
	}
}

function inventoryBuy(i, t, f) {
	$("#h-item", $("#" + f)).val(i);
	$("#h-total", $("#" + f)).val($('#' + t).val());
	
	getAction("inventory/buy", $("#" + f).serialize());
}

function inventorySell() {
	
}

function jalert(m, t, f) {
	if(!t) {
		t = "Aviso!";
	}
	
	var d = $(document.createElement("DIV"));
	
	d.html(m);
	
	$(document.body).append(d);
	
	d.dialog({
		modal: true,
		width: 300,
		title: t,
		close: function () {
			d.remove();
			
			if(f) {
				f.apply();
			}
		},
		buttons: {
			"Fechar": function () {
				d.remove();
			
				if(f) {
					f.apply();
				}
			}
		}
	});
}

function jconfirm(m, t, k, c) {
	if(!t) {
		t = "Aviso";
	}

	var d = $(document.createElement("DIV"));
	
	d.html(m);
	
	$(document.body).append(d);
	
	d.dialog({
		modal: true,
		width: 300,
		title: t,
		close: function () {
			try {
				c.apply([]);
			} catch(ee) {}
			
			d.remove();
		},
		buttons: {
			"Cancelar": function () {
				try {
					c.apply([]);
				} catch(ee) {}
				
				d.remove();
			},
			"Ok": function () {
				try {
					k.apply([]);
				} catch(ee) {}
				
				d.remove();				
			}
		}
	});	
}

$("button.ui-button, .toolbar a").live('mousemove', function () {
	$(this).addClass("ui-state-hover");
}).live('mouseout', function () {
	$(this).removeClass("ui-state-hover");
}); 

$(window).scroll(function (event) {
						   
	if($(window).scrollTop() > 340) {
		$("#pIcones").stop().animate({top: $(window).scrollTop() - 200 }, 500);
		
		//$("#pIcones").css("top", $(window).scrollTop() - 200);
	} else {
		$("#pIcones").stop().animate({top: 120 }, 500);
	}
});

$(document).ready(function () {
	$("#pIcones .i, #pIcones .i2").css("opacity", .2);
});

$("#pIcones .i").live('mouseover', function (event) {
	$(this).css("opacity", 1);
	
	$(".t", $(this)).show().css("opacity", .8); //.bg(10);
})
			.live('mouseout', function (event) {
	$(this).css("opacity", .2);

	$(".t", $(this)).hide();
	$(".invetoryDetailPopup").remove();
});


//social

function sendOrkut( title, url ) {
	window.open('http://promote.orkut.com/preview?nt=orkut.com&tt='+ encodeURIComponent(title) +'&du='+ encodeURIComponent(url),'windowOrkut', "width=650,height=500");
}

function sendTwitter( title, url ) {
	var targetUrl = 'http://twitter.com/share?url=' + encodeURIComponent(url) +'&text='+ encodeURIComponent(title + ' em ') +'&via=narutogame';
	window.open(targetUrl, 'ptm', 'height=450,width=650').focus();
}

function sendFacebook( title, url ) {
	var targetUrl = 'http://www.facebook.com/share.php?t='+ encodeURIComponent(title) +'&u='+ encodeURIComponent(url);
	window.open(targetUrl, 'ptm', 'height=450,width=600').focus();
}

 //ENDFILE 



//------ranking.js

function doRankingFillLinks() {
	$('.ats').click(function () {
		window.open(__site + 'ranking/popup_profile/' + $(this).attr('rel'), '', 'width=800,height=600,toolbar=no,menubar=no,scrollbars=yes');
	});
	
	$('.arv').click(function () {
		window.open(__site + 'ranking/popup_tree/' + $(this).attr('rel'), '', 'width=800,height=600,toolbar=no,menubar=no,scrollbars=yes');
	});
}

 //ENDFILE 



//------character_train_skill.js

function doCharacterTrainSkillEnd() {
	getAction("character/train_skill/2", $("#f-character-train-skill").serialize())	
}

 //ENDFILE 



//------cadastro.js

function validarCadastro() {
	getAction("user/signup/2", $("#f-user-signup").serialize());
}

 //ENDFILE 


