	/*
	functions:
		function sf(nomform, nominput)
		function changeImage()
		function lastMod()
		function y2kYear( theDate )
		function pad(number,length)
		function NovaFinestra(URLStr)
		function NovaFinestra2(URLStr, nom, left, top, width, height)
		function afegir_favorits()
		function isNumber(as)
		function textCounter(txtField,txtCount,maxlimit)
	*/

	conector = "@";
	assumpte = "?subject=";

	function correu( usuario, dominio ) {
		return usuario + conector + dominio;
	}

	function correu_assumpte( usuario, dominio, asunto ) {
		return usuario + conector + dominio + assumpte + asunto;
	}

	function writeMail( usuario, dominio, asunto ) {
		if (asunto=='') {
			document.write("<a href='mailto:" + correu( usuario, dominio ) + "'>" + correu( usuario, dominio ) + "</a>");
		} else {
			document.write("<a href='mailto:" + correu_assumpte( usuario, dominio, asunto ) + "'>" + correu( usuario, dominio ) + "</a>");
		}
	}

	function sf(nomform, nominput) {
		eval('document.'+nomform+'.'+nominput+'.focus()');
	}

	function treu( textoOriginal ) {
		//Quitar el texto del buscador.
		var texto = document.getElementById( 'textAvisador' );
		texto.className = "oscuro";
		if (texto.value == textoOriginal) {
			texto.value = "";
		}
	}
	
	function posa( textoOriginal ) {
		//Poner el texto del buscador.
		var texto = document.getElementById( 'textAvisador' );
		texto.className = "grisaceo";
		if (texto.value == "") {
			texto.value = textoOriginal;
		}
	}

	function treufb( textoOriginal ) {
		//Quitar el texto del buscador.
		var texto = document.getElementById( 'casellaFB' );
		texto.className = "oscuro";
		if (texto.value == textoOriginal) {
			texto.value = "";
		}
	}
	
	function posafb( textoOriginal ) {
		//Poner el texto del buscador.
		var texto = document.getElementById( 'casellaFB' );
		texto.className = "grisaceo";
		if (texto.value == "") {
			texto.value = textoOriginal;
		}
	}

	function changeImage() {
		if (arguments[0] =="") return;
		var image = document.getElementById(arguments[0]);
		currentImage++;
		if (currentImage == images.length) currentImage =0; 
		image.src=images[currentImage];
	}

	function lastMod() {
		var monthNames = new Array( 'Ene','Feb','Mar','Abr','May','Jun','Jul','Ago','Sep','Oct','Nov','Dic' );

		var lastDate = new Date( document.lastModified);

		year = y2kYear( lastDate );
		month = lastDate.getUTCMonth();
		day = lastDate.getUTCDate();
		hour = lastDate.getUTCHours();
		minute = lastDate.getUTCMinutes();
		second = lastDate.getUTCSeconds();

		//printDate = zeroPad(day) + " " + monthNames[ month ] + " " + year + "&nbsp;" + zeroPad(hour) + ":" + zeroPad(minute) + ":" + zeroPad(second) + " UTC";
		printDate = zeroPad(day) + " " + monthNames[ month ] + " " + year + "&nbsp;" + zeroPad(hour) + ":" + zeroPad(minute) + ":" + zeroPad(second) + " UTC";
		return printDate;
	}

	function y2kYear( theDate ) {
		wrongYear = theDate.getUTCFullYear();
		rightYear = wrongYear % 100;
		rightYear += (rightYear < 38) ? 2000 : 1900;
		return rightYear;
	}
	
	function pad(number,length) {
		var str = '' + number;
		while (str.length < length)
			str = '0' + str;
		return str;
	}

	function NovaFinestra(URLStr) {
		window.open(URLStr,'','menubar=no,scrollbars=yes,status=no,dependent=yes,toolbar=yes,left=100,top=100,height=500,width=700');
	}

	function NovaFinestra2(URLStr, nom, left, top, width, height) {
		window.open(URLStr,nom,'menubar=no,scrollbars=no,status=yes,dependent=yes,toolbar=no,height='+height+',width='+width+',left='+left+',top='+top);
	}

	function afegir_favorits() {
		window.external.AddFavorite("http://www.calsots.com","Calsots.com");
	}

	function isNumber(as) {
		return as.isnumber();
	}


///////////////////////////////////
// function to control number of input charactes in textarea fields

	function textCounter(txtField,txtCount,maxlimit) {
		field = document.getElementById(txtField);
		cntfield = document.getElementById(txtCount);
		if (field.value.length > maxlimit) field.value = field.value.substring(0, maxlimit);
		else cntfield.value = maxlimit - field.value.length;
	}
