// tt.js v0.0.2, 12. 10. 2008, 16:15
// Description: Torrex Chiesi Territory.

// Copyright (c) 2008 Ivanek Alexander
// Webaholix, http://www.webaholix.com

// Last update: 12. 10. 2008, 23:24

/* 
	Scriptaculous check
***/
var wx_TT_check = {
	REQUIRED_SCRIPTACULOUS: '1.8.0',
	load: function() {
		function convertVersionString(versionString){
			var r = versionString.split('.');
			return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
		}

		try {
			if( (typeof Scriptaculous=='undefined') || (convertVersionString(Scriptaculous.Version) < convertVersionString(this.REQUIRED_SCRIPTACULOUS)))
				throw "err1";
		}
		catch(error) {
			if (error == 'err1')
				alert("wx_TT requires the Scriptaculous >= " + this.REQUIRED_SCRIPTACULOUS);
		}
	}
}

/*
	wx_TT script 
***/
if (!wx_TT) var wx_TT = { };
wx_TT = Class.create({
	initialize: function() {
	},
	show: function(uid) {
		if (this.start !== true) {
			//$$('.tx-wxterritory-pi1-territory-info').setStyle({visibility:'visible'});
			$$('.tx-wxterritory-pi1-territory-info')[0].writeAttribute('style', 'visibility:visible;');
			this.start = true;
		}
		var opt = {
				method:'get',
				asynchronous: false,
				parameters: {'eID': 'tx_wxterritory_pi1', no_cache: 1, 'uid': uid},
				onSuccess: function(transport) {
					new Effect.Opacity('territory', {to:0.0, duration: .5, queue: {position:'front', scope: 'theId'}, afterFinish: function(){
						Element.update('territory', transport.responseText );
						new Effect.Opacity('territory', {to:1.0, duration: .5, queue:{position:'end', scope: 'theId'} });
						}
					});
				},
				onFailure: function() {
					alert('Something went wrong...')
				}
			};
		new Ajax.Request('index.php', opt);
	}
});