window.onload=function(){
	 if (!document.getElementsByTagName) return;
	 var anchors = document.getElementsByTagName("a");
	 for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") anchor.target = "_blank";
	}
	if (document.getElementById('artist-work')) {
		enableTooltips("artist-work");
	}
	if (document.getElementById('twoColumns')) {
		Nifty("div#columnA,div#columnB","same-height big");
	}
	if (document.getElementById('twoColumnsB')) {
		Nifty("div#columnC,div#columnD","same-height big");
	}
	if (document.getElementById('columnE')) {
		Nifty("div#columnC,div#columnD,div#columnE,div#columnF","same-height big");
	}		
	if (document.getElementById('destacado')) {
		Nifty("div#destacado","big");
	}
	if (document.getElementById('lastNews')) {
		Nifty("div#lastNews","big");
	}
	if (document.getElementById('lastNewsB')) {
		Nifty("div#lastNewsB","big");
	}	
	if (document.getElementById('lastCreation')) {
		Nifty("div#lastCreation","big");
	}
	if (document.getElementById('randomCreation')) {
		Nifty("div#randomCreation","big");
	}	
	if (document.getElementById('previousNews')) {
		if (document.getElementById('scriptspaginate')) {
			document.getElementById('scriptspaginate').innerHTML='<ul><li class="previous"><a href="#" rel="previous" title="Anterior">« Anterior</a></li><li class="current"><span class="paginateinfo"></span></li><li class="next"><a href="#" rel="next" title="Siguiente">Siguiente »</a></li></ul>';
			var newscripts=new virtualpaginate("news", 10, "li")
			newscripts.buildpagination("scriptspaginate")			
		}
	}
	if (document.getElementById('artist-list')) {
		if (document.getElementById('scriptspaginate')) {
			document.getElementById('scriptspaginate').innerHTML='<ul><li class="previous"><a href="#" rel="previous" title="Anterior">« Anterior</a></li><li class="current"><span class="paginateinfo"></span></li><li class="next"><a href="#" rel="next" title="Siguiente">Siguiente »</a></li></ul>';
			var newscripts=new virtualpaginate("artist", 25, "li")
			newscripts.buildpagination("scriptspaginate")			
		}
	}
	if (document.getElementById('creations-list')) {
		if (document.getElementById('scriptspaginate')) {
			document.getElementById('scriptspaginate').innerHTML='<ul><li class="previous"><a href="#" rel="previous" title="Anterior">« Anterior</a></li><li class="current"><span class="paginateinfo"></span></li><li class="next"><a href="#" rel="next" title="Siguiente">Siguiente »</a></li></ul>';
			var newscripts=new virtualpaginate("creation", 6, "li")
			newscripts.buildpagination("scriptspaginate")			
		}
	}	
	if (document.getElementById('action-links')) {
		oldHTML = document.getElementById('action-links').innerHTML;
		newHTML = '<li class="print"><a href="#" title="Imprimir esta p&aacute;gina" id="print-button">Imprimir página</a></li>';
		document.getElementById('action-links').innerHTML = newHTML + oldHTML;
	}
	if (document.getElementById('formErrors')) {
		oldHTML = document.getElementById('formErrors').innerHTML;
		newHTML = '<p class="back"><a href="javascript:history.back();" title="Volver al formulario">Volver al formulario</a></p>';
		document.getElementById('formErrors').innerHTML = oldHTML + newHTML;
	}	
	if (document.getElementById("print-button")){
		var oLink = document.getElementById("print-button");
		oLink.href = "#";
		oLink.onclick = function(){window.print();};
	}
	if (document.getElementById('contactForm')) {
		startList();
		pageinit();
		i = document.getElementById('interests');
		if (i) {
			x = document.getElementById('interests-explanation');
			i.onchange=function() {
				if (this.value=="") {
					this.className="error";
					x.className="hidden";
				} else {
					this.className="required";
					if (this.value=="Otros") x.className="visible";
					else x.className="hidden";			
				}
			}
		}		
	}
	if(document.getElementById('contactData')) {
		
		/*<![CDATA[*/
		/***********************************************
		* Encrypt Email script- Please keep notice intact
		* Tool URL: http://www.dynamicdrive.com/emailriddler/
		* **********************************************/
		<!-- Encrypted version of: conchi [at] ***.***.****.** //-->
		var emailriddlerarray=[105,110,102,111,64,102,111,109,101,110,116,97,114,116,101,46,101,115]
		var encryptedemail_id54='' //variable to contain encrypted email 
		for (var i=0; i<emailriddlerarray.length; i++)
		encryptedemail_id54+=String.fromCharCode(emailriddlerarray[i])
		/*]]>*/			
		
		var oldHTML = document.getElementById('contactData').innerHTML;
		var newHTML = '<li>e-mail: <span class="email"><a href="mailto:'+encryptedemail_id54+'" title="Contacta con FomentARTE">'+encryptedemail_id54+'</a></span></li>' + oldHTML;
		document.getElementById('contactData').innerHTML = newHTML;	
	}
	if(document.getElementById('artistJumpMenu')) {
		jumpmenu = document.getElementById('artistJumpMenu');
		jumpmenu.onchange = function() {
			location.href=this.options[this.selectedIndex].value;	
		}
	}
}
