/****************************************************************************
* js/scripts.js
*
* Funciones de javascript
*
* I Have Photos versión 1.0.0
*/
function submitonce () {
	var accion = submitonce.arguments;
	accion = accion[0]?false:true;

	for (i=0; i<document.forms.length; i++) {
		for (b=0; b<document.forms[i].length; b++) {
			var tempobx = document.forms[i].elements[b];

			if(tempobx.type && (tempobx.type.toLowerCase()=="submit" || tempobx.type.toLowerCase()=="reset"))
				tempobx.disabled = accion;
		}
	}

	return true;
}

function amosa () {
	var obx = amosa.arguments;

	for (var i=0; i<obx.length; i++) {
		var escolle = document.getElementById(obx[i]);

		if (escolle) {
			escolle.style.display = '';
		}
	}
}

function oculta () {
	var obx = oculta.arguments;

	for (var i=0; i<obx.length; i++) {
		var escolle = document.getElementById(obx[i]);

		if (escolle) {
			escolle.style.display = 'none';
		}
	}
}

function amosa_oculta () {
	var obx = amosa_oculta.arguments;

	for (var i=1; i<obx.length; i++) {
		document.getElementById(obx[i]).style.display = 'none';
	}

	document.getElementById(obx[0]).style.display = '';
}

function cortarPalabra (palabra, lonx) {
	if (palabra.length > lonx) {
		palabra = '...'+palabra.substr(-lonx);
	}

	return palabra;
}

function enlace () {
	var dir = arguments[0];
	var destino = arguments[1];

	url = dir.replace(/&amp;/g, '&');

	if (destino == '_blank') {
		window.open(url);
	} else {
		location.href = url;
	}

	return false;
}

function visible (cal) {
	var obx = document.getElementById(cal);

	if (obx.style.display == 'none') {
		obx.style.display = '';
	} else {
		obx.style.display = 'none';
	}
}
