(function(){
	if(!/*@cc_on!@*/0)return;
	var ele = "article,aside,footer,header,hgroup,menu,nav,output,section,time".split(',');
	for(var i=0; i<ele.length; i++){document.createElement(ele[i])}
})();

/*
window.addEvent('domready',function(){
	var request = new Request({
		data: 'ajax=true',
		evalScripts: true,
		onSuccess: function(html){
			$("centercol").set("html",html);
			$("centercol").fade('in');
			onPageUpdate();
		}
	});
	var loadPage = function(url){
		$("centercol").fade('out');
		request.send({ url: url });
	};
	var listener = function(evt){
		evt.preventDefault();
		var href = this.get('href');
		History.push(href);
	};
	var back = function(evt){
		evt.preventDefault();
		History.back();
	};	
	var onPageUpdate = function(){
		document.body.scrollTo('top')
	};
	
	document.body.addEvent("click:relay(a:not([href^=#],[href^=mailto:],[target^=_],[href^=http://],[href^=/admin],[data-noxhr]))",listener);
	History.addEvent('change',loadPage);
	if(!History.hasPushState()) {
		var hash = document.location.hash.substr(1);
		if (!hash) return;
		var path = document.location.pathname.split('/');
		path = path[path.length - 1];
		if (hash == path) return;
		loadPage(hash);
	}
	onPageUpdate();
});
*/
function elMenu(id){
	$$("#menu a").each(function(p, i){
		if(p.hasClass('sel')){p.removeClass('sel')}
		if(i==id){p.addClass('sel')}
	});
}
function off(id){
	$(id).tween('opacity', 0);
}
function puchIt(tx){
	var tex = tx.split(" - "),tep = tex[1];
	tx = tex[0] + " - " + tep.substr(1, tep.length-1) + tep.substr(0, 1); 
	document.title = tx;
	setTimeout("puchIt('" + tx + "');", 1000);
}
function popup(link){
	msg = open(link, "winpopup","toolbar=no,directories=no,menubar=no,width=430,height=500,resizable=no,scrollbars=yes,left=10,top=10")}
function imgOn(pos){
	if(pos<1 || pos>imas.length-1){
		$('show').tween('opacity', 0);
	}else{
		var sF = $('showfront'),
			pr = $('sf_prev'),
			ne = $('sf_next'),
			cl = $('sf_close'),
			ant = pos - 1,
			sig = pos + 1;
		pr.set('onclick', 'imgOn(' + ant + ')');
		ne.set('onclick', 'imgOn(' + sig + ')');
		$('sf_ima').set('src', '/public/photos/' + imas[pos]);
		$('sf_spa').set('html', desc[pos]);
		document.addEvents({'keypress':function(e){if(e.key=='esc'){imgOn(0)}}});
		sF.addEvents({
			'mouseout': function(){
				if(ant>0){pr.tween('opacity', 0)};
				if(sig<imas.length){ne.tween('opacity', 0)};
				cl.tween('opacity', 0)
			}
			,'mouseover': function(){
				if(Browser.name!='ie'){
					if(ant>0){pr.tween('opacity', .7)};
					if(sig<imas.length){ne.tween('opacity' ,.7)}
				}
				cl.tween('opacity', .7)
			}
		})
		var alC = $('centercol').getScrollHeight();
		var alS = sF.getScrollHeight();
		if(alC>alS){alS = alC - 8}else{alS = alS + 30}
		$('showback').setStyle('height', alS);
		$('show').tween('opacity', 1);
	}
}

function VideOn(pos){
	if(pos==0){
		$('show').tween('opacity', 0);
		$('video').set('html', '');
	}else{
		new Request({url:'/videoclick.asp', method:'get', data:'id='+pos}).send()
		var sF = $('videofront');			
		var so = new SWFObject('/videoplayer.swf', 'mpl', '600', '358', '9');
		so.addParam('allowscriptaccess', 'always');
		so.addParam('allowfullscreen', 'false');
		so.addParam('flashvars', '&file=' + pos + '&autostart=true&plugins=viral,link');
		//&viral.functions=embed
		so.write('video');	
		document.addEvents({'keypress':function(e){if(e.key=='esc'){VideOn(0)}}})
		var alC = $('centercol').getScrollHeight();
		var alS = sF.getScrollHeight();
		if(alC>alS){alS = alC - 8}else{alS = alS + 30}
		$('showback').setStyle('height', alS);
		$('show').tween('opacity', 1);
	}
}
function pleaseWait(tx){
	var sp = $('infoCom');
	if(tx==""){
		if ($("valida").value=="true"){
			sp.innerHTML = "Sending your comment, please wait <img src='/public/loading.gif' />";
			sp.setAttribute("style", "color:#666");
			return true;
		}else{
			reloadcap();
			return false;
		}
	}else{
		sp.innerHTML = tx;
		sp.setAttribute("style", "color:#F00");
		return false;
	}
}
function editComentario(id){
	new Request({
		url: '/admin/art_mod_edit.asp', method: 'post', data: 'id=' + id,
		onSuccess: function(responseText){
			$('comment'+id).set('html', responseText)
		},
		onFailure: function(){
			new Element('p', {'class':'alerta', 'html':'Error&#44;&nbsp;Try Again / Inténtelo de Nuevo'}).inject($('comment'+id));
		}
	}).send()
}
function delComentario(id){
	if(confirm('Eliminar Comentario?')){
		new Request({url: '/admin/art_mod_del.asp', method: 'post', data: 'id=' + id, evalResponse: true}).send()
	}
}
function blcap(){
	if ($("valida").value!="true"){
		var a = $("capcha").value;
		$("valida").value = "false";
		if ($("capcha").hasClass("green")){$("capcha").removeClass("green")}
		if (a.length==4){new Request({url: '/admin/sys.capcha.asp', method: 'get', data: 'cap='+a, evalResponse: true}).send()}
	}
}

function reloadcap(){
	$('capcha').addClass('red');
	$('capcha').value = "";	
	$("captcha").set('html',"<img alt='eduspain' src='/admin/captcha.asp?id=" + new Date().getSeconds() + "'/>")
}

function checkAltaNews(){
	var estado = true,
		campo = $('newsMail');
	$('newsAlert').set('html','');
	if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(campo.value)){
		$('newsAlert').set('html','Please enter a valid email address.');
		campo.removeClass('green').addClass('red');
		estado=false
	}else{
		campo.removeClass('red').addClass('green');
	}
	campo = $('newsName');
	if(campo.value==''){
		$('newsAlert').set('html','Name is a required field.');
		campo.removeClass('green').addClass('red');
		estado=false
	}else{
		campo.removeClass('red').addClass('green');
	}
	if(estado!=false){return true}else{return false}
}

function actIp(kk){
	kk--;
	new Request({url: '/admin/ajx', method: 'get', evalResponse: true, data: 'i='+kk}).send();
	axc = kk != 0 ? window.setTimeout('actIp(' + kk + ')', 60000) : '';
}

function pie(ip, fo, co){
	if(!$('ipsTrack')){
		var nav = document.body.getFirst('nav').getFirst('ul').getLast('li');
		new Element('li',{'id':'four','class':'stat'}).injectBefore(nav);
		new Element('li',{'id':'ipsTrack','class':'stat'}).injectBefore(nav)
		new Element('li',{'id':'newco','class':'stat'}).injectBefore(nav)
	}
	if (ip!=-1){
		$('ipsTrack').set('html',ip);
		$('four').set('html',fo);
		$('newco').set('html',co);
	}
	whot();
}
function whot(){
	var nav = document.body.getFirst('nav').getFirst('ul').getElements('li');
	nav.each(function(li,i){
		if(li.hasClass('stat')){
			li.addEvents({
				'mouseenter':function(e){li.getFirst('ol').fade('in')}
				,'mouseleave':function(e){li.getFirst('ol').fade('out')}
			});
		}
	});
}
function Validar(url){
	if($("surname").value==""){$("surname").focus();alert("Please, fill your Surname.");return(false)}
	else{if($("firstname").value.length==0){alert("Please, fill your Name.");$("firstname").focus();return(false)}
	else{if($("country").value=="0"){alert("Please, select your country.");$("country").focus();return(false)}
	else{var email=$("email").value;if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)==false){alert("Please, fill in your Email.");$("email").focus();return(false)}
	else{return(true)}}}}
}



Class.Binds = new Class({
	$bound: {},
	bound: function(name){
		return this.$bound[name] ? this.$bound[name] : this.$bound[name] = this[name].bind(this);
	}
});



(function(){

var events = Element.NativeEvents,
	location = window.location,
	base = location.pathname,
	history = window.history,
	hasPushState = ('pushState' in history),
	event = hasPushState ? 'popstate' : 'hashchange';

this.History = new new Class({
	Implements: [Class.Binds, Events],
	initialize: hasPushState ? function(){
		events[event] = 2;
		window.addEvent(event, this.bound('pop'));
	} : function(){
		events[event] = 1;
		window.addEvent(event, this.bound('pop'));

		this.hash = location.hash;
		var hashchange = ('onhashchange' in window);
		if (!(hashchange && (document.documentMode === undefined || document.documentMode > 7)))
			this.timer = this.check.periodical(200, this);
	},
	push: hasPushState ? function(url, title, state){
		if (base && base != url) base = null;
		
		history.pushState(state || null, title || null, url);
		this.onChange(url, state);
	} : function(url){
		location.hash = url;
	},
	replace: hasPushState ? function(url, title, state){
		history.replaceState(state || null, title || null, url);
	} : function(url){
		this.hash = '#' + url;
		this.push(url);
	},
	pop: hasPushState ? function(event){
		var url = location.pathname;
		if (url == base){
			base = null;
			return;
		}
		this.onChange(url, event.event.state);
	} : function(){
		var hash = location.hash;
		if (this.hash == hash) return;

		this.hash = hash;
		this.onChange(hash.substr(1));
	},
	onChange: function(url, state){
		this.fireEvent('change', [url, state || {}]);
	},
	back: function(){
		history.back();
	},

	forward: function(){
		history.forward();
	},	
	getPath: function(){
		return hasPushState ? location.pathname : location.hash.substr(1);
	},
	hasPushState: function(){
		return hasPushState;
	},
	check: function(){
		if (this.hash != location.hash) this.pop();
	}
});

}).call(this);

History.handleInitialState = function(base){
	if (!base) base = '';
	var location = window.location,
		pathname = location.pathname.substr(base.length),
		hash = location.hash,
		hasPushState = History.hasPushState();

	if (!hasPushState && pathname.length > 1){
		window.location = (base || '/') + '#' + pathname;
		return true;
	}

	if (!hash || hash.length <= 1) return false;
	if (hasPushState){
		(function(){
			History.push(hash.substr(1));
		}).delay(1);
		return false;
	}

	if (!pathname || pathname == '/') return false;
	window.location = (base || '/') + hash;
	return true;
};


Events.Pseudos = function(pseudos, addEvent, removeEvent){

	var storeKey = 'monitorEvents:';

	var storageOf = function(object){
		return {
			store: object.store ? function(key, value){
				object.store(storeKey + key, value);
			} : function(key, value){
				(object.$monitorEvents || (object.$monitorEvents = {}))[key] = value;
			},
			retrieve: object.retrieve ? function(key, dflt){
				return object.retrieve(storeKey + key, dflt);
			} : function(key, dflt){
				if (!object.$monitorEvents) return dflt;
				return object.$monitorEvents[key] || dflt;
			}
		};
	};

	var splitType = function(type){
		if (type.indexOf(':') == -1 || !pseudos) return null;

		var parsed = Slick.parse(type).expressions[0][0],
			parsedPseudos = parsed.pseudos,
			l = parsedPseudos.length,
			splits = [];

		while (l--) if (pseudos[parsedPseudos[l].key]){
			splits.push({
				event: parsed.tag,
				value: parsedPseudos[l].value,
				pseudo: parsedPseudos[l].key,
				original: type
			});
		}

		return splits.length ? splits : null;
	};

	var mergePseudoOptions = function(split){
		return Object.merge.apply(this, split.map(function(item){
			return pseudos[item.pseudo].options || {};
		}));
	};

	return {

		addEvent: function(type, fn, internal){
			var split = splitType(type);
			if (!split) return addEvent.call(this, type, fn, internal);

			var storage = storageOf(this),
				events = storage.retrieve(type, []),
				eventType = split[0].event,
				options = mergePseudoOptions(split),
				stack = fn,
				eventOptions = options[eventType] || {},
				args = Array.slice(arguments, 2),
				self = this,
				monitor;

			if (eventOptions.args) args.append(Array.from(eventOptions.args));
			if (eventOptions.base) eventType = eventOptions.base;
			if (eventOptions.onAdd) eventOptions.onAdd(this);

			split.each(function(item){
				var stackFn = stack;
				stack = function(){
					(eventOptions.listener || pseudos[item.pseudo].listener).call(self, item, stackFn, arguments, monitor, options);
				};
			});
			monitor = stack.bind(this);

			events.include({event: fn, monitor: monitor});
			storage.store(type, events);

			addEvent.apply(this, [type, fn].concat(args));
			return addEvent.apply(this, [eventType, monitor].concat(args));
		},

		removeEvent: function(type, fn){
			var split = splitType(type);
			if (!split) return removeEvent.call(this, type, fn);

			var storage = storageOf(this),
				events = storage.retrieve(type);
			if (!events) return this;

			var eventType = split[0].event,
				options = mergePseudoOptions(split),
				eventOptions = options[eventType] || {},
				args = Array.slice(arguments, 2);

			if (eventOptions.args) args.append(Array.from(eventOptions.args));
			if (eventOptions.base) eventType = eventOptions.base;
			if (eventOptions.onRemove) eventOptions.onRemove(this);

			removeEvent.apply(this, [type, fn].concat(args));
			events.each(function(monitor, i){
				if (!fn || monitor.event == fn) removeEvent.apply(this, [eventType, monitor.monitor].concat(args));
				delete events[i];
			}, this);

			storage.store(type, events);
			return this;
		}

	};

};

(function(){

var pseudos = {

	once: {
		listener: function(split, fn, args, monitor){
			fn.apply(this, args);
			this.removeEvent(split.event, monitor)
				.removeEvent(split.original, fn);
		}
	},

	throttle: {
		listener: function(split, fn, args){
			if (!fn._throttled){
				fn.apply(this, args);
				fn._throttled = setTimeout(function(){
					fn._throttled = false;
				}, split.value || 250);
			}
		}
	},

	pause: {
		listener: function(split, fn, args){
			clearTimeout(fn._pause);
			fn._pause = fn.delay(split.value || 250, this, args);
		}
	}

};

Events.definePseudo = function(key, listener){
	pseudos[key] = Type.isFunction(listener) ? {listener: listener} : listener;
	return this;
};

Events.lookupPseudo = function(key){
	return pseudos[key];
};

var proto = Events.prototype;
Events.implement(Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent));

['Request', 'Fx'].each(function(klass){
	if (this[klass]) this[klass].implement(Events.prototype);
});

})();


(function(){

var pseudos = {},
	copyFromEvents = ['once', 'throttle', 'pause'],
	count = copyFromEvents.length;

while (count--) pseudos[copyFromEvents[count]] = Events.lookupPseudo(copyFromEvents[count]);

Event.definePseudo = function(key, listener){
	pseudos[key] = Type.isFunction(listener) ? {listener: listener} : listener;
	return this;
};

var proto = Element.prototype;
[Element, Window, Document].invoke('implement', Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent));

})();




(function(){

var eventListenerSupport = !(window.attachEvent && !window.addEventListener),
	nativeEvents = Element.NativeEvents;

nativeEvents.focusin = 2;
nativeEvents.focusout = 2;

var check = function(split, target, event){
	var elementEvent = Element.Events[split.event], condition;
	if (elementEvent) condition = elementEvent.condition;
	return Slick.match(target, split.value) && (!condition || condition.call(target, event));
};

var bubbleUp = function(split, event, fn){
	for (var target = event.target; target && target != this; target = document.id(target.parentNode)){
		if (target && check(split, target, event)) return fn.call(target, event, target);
	}
};

var formObserver = function(eventName){

	var $delegationKey = '$delegation:';

	return {
		base: 'focusin',

		onRemove: function(element){
			element.retrieve($delegationKey + 'forms', []).each(function(el){
				el.retrieve($delegationKey + 'listeners', []).each(function(listener){
					el.removeEvent(eventName, listener);
				});
				el.eliminate($delegationKey + eventName + 'listeners')
					.eliminate($delegationKey + eventName + 'originalFn');
			});
		},

		listener: function(split, fn, args, monitor, options){
			var event = args[0],
				forms = this.retrieve($delegationKey + 'forms', []),
				target = event.target,
				form = (target.get('tag') == 'form') ? target : event.target.getParent('form');
				
			if (!form) return;
				
			var formEvents = form.retrieve($delegationKey + 'originalFn', []),
				formListeners = form.retrieve($delegationKey + 'listeners', []),
				self = this;

			forms.include(form);
			this.store($delegationKey + 'forms', forms);

			if (!formEvents.contains(fn)){
				var formListener = function(event){
					bubbleUp.call(self, split, event, fn);
				};
				form.addEvent(eventName, formListener);

				formEvents.push(fn);
				formListeners.push(formListener);

				form.store($delegationKey + eventName + 'originalFn', formEvents)
					.store($delegationKey + eventName + 'listeners', formListeners);
			}
		}
	};
};

var inputObserver = function(eventName){
	return {
		base: 'focusin',
		listener: function(split, fn, args){
			var events = {blur: function(){
				this.removeEvents(events);
			}}, self = this;
			events[eventName] = function(event){
				bubbleUp.call(self, split, event, fn);
			};
			args[0].target.addEvents(events);
		}
	};
};

var eventOptions = {
	mouseenter: {
		base: 'mouseover'
	},
	mouseleave: {
		base: 'mouseout'
	},
	focus: {
		base: 'focus' + (eventListenerSupport ? '' : 'in'),
		args: [true]
	},
	blur: {
		base: eventListenerSupport ? 'blur' : 'focusout',
		args: [true]
	}
};

if (!eventListenerSupport) Object.append(eventOptions, {
	submit: formObserver('submit'),
	reset: formObserver('reset'),
	change: inputObserver('change'),
	select: inputObserver('select')
});

Event.definePseudo('relay', {
	listener: function(split, fn, args){
		bubbleUp.call(this, split, args[0], fn);
	},
	options: eventOptions
});

})();
