// Funciones Javascript usadas por el VX cuando est? mostrando el album




// No selecciones que me hace feote el gif
//document.onselectstart=function(){return false}
//document.ondragstart=function(){return false}


// Funciones de la cosa de los botones
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;









	//	Esta saca una imagen en una ventana exterior

	function jf_mi(as_path, as_imagen, al_width, al_height, as_titulo, as_texto) {
	        var imagen = new Image;
	        var altura = 0;
	        imagen.src = as_path+as_imagen;

			var w_imagen = window.open("","imageWindow","width="+(al_width)+",height="+(al_height)+",scrollbars=no,resizable=yes,status=0");
			var w_imagen = window.open("","imageWindow","width="+(al_width)+",height="+(al_height)+",scrollbars=no,resizable=yes,status=0");

			if (as_titulo.length == 0) as_titulo="Im&aacute;gen";



	        w_imagen.document.write("<HTML><HEAD><TITLE>"+as_titulo+"</TITLE></HEAD>");
	        w_imagen.document.write("<BODY BGCOLOR='#eeeeee' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>");
	        w_imagen.document.write("<style type='text/css'>");
			w_imagen.document.write("<!--");
			w_imagen.document.write(".texto {  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 7pt; font-style: normal; color: #000000}");
			w_imagen.document.write("-->");
			w_imagen.document.write("</style>");

	        if (as_texto.length > 0) {
	        	w_imagen.document.write("<font class='texto'>");
	       		w_imagen.document.write(as_texto);
	        	w_imagen.document.write("</font>");
	        	altura = 20
	        }
	        w_imagen.document.write("<img name='imagen' src='"+imagen.src+"' border='0'>");
	        w_imagen.document.write("</BODY></HTML>");
	        w_imagen.document.close();
	        w_imagen.focus();
	}












// Mete los valores de texto en el ?rea de phpBBcode
//	as_texto	Texto a a?adir
//	al_num	N?mero de imagen que se est? a?adiendo
//	as_cnum	Color de fondo para el numero (solo para cuando se indica el texto vac?o)
//	as_ctit 	Color de tondo para el t?tulo (solo para cuando se indica el texto vac?o)

// Para almacenar los IDs de los componentes que se van seleccionando
var ContactoSelNum = new Array();
var ContactoSelTit = new Array();

function fjs_vx_region_set(as_texto, al_num, as_cnum, as_ctit) {
	textArea = document.getElementById('ta_intermedia');
	zonaIntermedia = document.getElementById('zona_intermedia');

	if (as_texto.length > 0) {
		// Marca el contacto que se ha pulsado
		contacto = document.getElementById('cnum' + al_num);
		contacto.bgColor = "#E67300";
		contacto = document.getElementById('ctit' + al_num);
		contacto.bgColor = "#FFAE5E";

		ContactoSelNum.push('cnum' + al_num);
		ContactoSelTit.push('ctit' + al_num);

		// Pone el texto
		if (textArea.value.length > 0) {
			var lineas = textArea.value.split('\n');
			textArea.rows = (lineas.length + 1);
			textArea.value += '\n'+as_texto+'\n';
		} else {
			textArea.rows = 1;
			textArea.value = as_texto+'\n';
		}
		zonaIntermedia.style.display = 'block';
	} else {
		// Recorre los arrays de los elementos que se han ido metiendo
		// en el array de IDs y les pone su color original

		li_cantidad = ContactoSelNum.length;
		for (n=0; n<li_cantidad; n++) {
			contacto = document.getElementById(ContactoSelNum.pop());
			contacto.bgColor = as_cnum;
		}
		li_cantidad = ContactoSelTit.length;
		for (n=0; n<li_cantidad; n++) {
			contacto = document.getElementById(ContactoSelTit.pop());
			contacto.bgColor = as_ctit;
		}

		// Quita los textos
		textArea.value = '';
		textArea.rows = 1;
		zonaIntermedia.style.display = 'none';
	}
}












// Para pedir el pass al pulsar el bot?n de editar un album
//	Llamada desde la lista de albumes
function jf_PidePassYVaDesdeAlbum() {
	var ls_pass=prompt("Password para editar este album:");
	if (ls_pass!=null && ls_pass!="") {
		parent.location.href="./?pass="+ls_pass;
	}
}
