function MuestraNoticias( op ){
	xajax_MuestraNoticias( op );
}

function EditaNoticia( op , id ){
	xajax_MuestraNoticiaUnica( op , id , 1 );
}

function MuestraNoticiaUnica( op , id ){
	xajax_MuestraNoticiaUnica( op , id , 0 );
}

function MuestraMenuDeFotos( op ){
	xajax_MuestraMenuDeFotos( op );
		var cnv = document.getElementById( 'cnv' );
		jg_1 = new jsGraphics( cnv );
		jg_2 = new jsGraphics( cnv );
		jg_1.setColor('#ff0000');
		jg_2.setColor('#ff0000');
		xajax_ListaFotos( op , 0 , 0 );
}

function FOTO( n , avance ){
	var num;
	num = ( n*10/10 ) + avance;
	if ( num < 0 ){
		num = 0;
	}else if ( num >= maximo ){
		num = maximo - 1;
	}
	if ( num == 0 ){
		document.atras_0.src = "./img/disleft_bswa.gif";
		document.atras_1.src = "./img/disleft_bswa.gif";
	}else{
		document.atras_0.src = "./img/left.gif";
		document.atras_1.src = "./img/left.gif";
	}
	if ( num == ( maximo - 1) ){
		document.siguiente_0.src = "./img/disright_bswa.gif";
		document.siguiente_1.src = "./img/disright_bswa.gif";
	}else{
		document.siguiente_0.src = "./img/right.gif";
		document.siguiente_1.src = "./img/right.gif";
	}
	var src = "./doc/" + Fotos[ num ] + ".jpg";
	document.fotos.src = src;
	current = num;
	THUMB( )
}
function THUMB( ){
	var src;

	if( ( current + ( -3) ) < 0 || ( current + ( -3) ) >= maximo ){
		src = "./doc/white.jpg";
	}else{
		src = "./doc/" + Fotos[ current + ( -3) ] + "_thumb.jpg";
	}
	document.thumb_0.src = src;

	if( ( current + ( -2) ) < 0 || ( current + ( -2) ) >= maximo ){
		src = "./doc/white.jpg";
	}else{
		src = "./doc/" + Fotos[ current + ( -2) ] + "_thumb.jpg";
	}
	document.thumb_1.src = src;

	if( ( current + ( -1) ) < 0 || ( current + ( -1) ) >= maximo ){
		src = "./doc/white.jpg";
	}else{
		src = "./doc/" + Fotos[ current + ( -1) ] + "_thumb.jpg";
	}
	document.thumb_2.src = src;

	if( ( current + ( 1) ) < 0 || ( current + ( 1) ) >= maximo ){
		src = "./doc/white.jpg";
	}else{
		src = "./doc/" + Fotos[ current + ( 1) ] + "_thumb.jpg";
	}
	document.thumb_4.src = src;

	if( ( current + ( 2) ) < 0 || ( current + ( 2) ) >= maximo ){
		src = "./doc/white.jpg";
	}else{
		src = "./doc/" + Fotos[ current + ( 2) ] + "_thumb.jpg";
	}
	document.thumb_5.src = src;

	if( ( current + ( 3) ) < 0 || ( current + ( 3) ) >= maximo ){
		src = "./doc/white.jpg";
	}else{
		src = "./doc/" + Fotos[ current + ( 3) ] + "_thumb.jpg";
	}
	document.thumb_6.src = src;

}

function validar() {
	// Array con todos los elementos del formulario
	camposTexto = document.getElementById('ID_FORMULARIO').elements;
	for (x=0; x < camposTexto.length; x++) {
		if (camposTexto[x].value == '' && camposTexto[x].type=='text') {
			alert("El campo " + camposTexto[x].name + " estï¿½ vacio y es OBLIGATORIO");
			return false;
		}
	}
}



var sig ,cnv ,jg_1,jg_2;

var inicio_x,inicio_y;

var texto;

var y,x,d;

var x_1,x_2,y_1,y_2;

if  (document.getElementById){

(function(){

	//Stop Opera selecting anything whilst dragging.
	if (window.opera){
		document.write("<input type='hidden' id='Q' value=' '>");
	}

	var n = 500;
	var dragok = false;
	var tmp_x,tmp_y;
	function CalculaUtmMov( e ){
	}
	function move(e){
		if (!e) e = window.event;
		if (dragok){
			var temp = (typeof e.target != "undefined")?e.target:e.srcElement;
			if (temp.tagName != "HTML"|"BODY" && temp.className != "dragclass"&& temp.className != "dragpequena"){
				temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement;
			}
			if (temp.className == "dragclass"){
				x = e.layerX!=undefined?e.layerX:e.offsetX!=undefined?e.offsetX:e.pageX-temp.offsetLeft;
				y = e.layerY!=undefined?e.layerY:e.offsetY!=undefined?e.offsetY:e.pageY-temp.offsetTop;
				x_1.value = inicio_x;
				y_1.value = inicio_y;
				x_2.value = x;
				y_2.value = y;
				ACTUALIZA( );
			}
			return false;
		}
	}

	function down(e){
		if (!e) e = window.event;
		var temp = (typeof e.target != "undefined")?e.target:e.srcElement;
		if (temp.tagName != "HTML"|"BODY" && temp.className != "dragclass"&& temp.className != "dragpequena"){
			temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement;
		}
		if (temp.className == "dragclass"){
			dragok = true;
			inicio_x = x = e.layerX!=undefined?e.layerX:e.offsetX!=undefined?e.offsetX:e.pageX-temp.offsetLeft;
			inicio_y = y = e.layerY!=undefined?e.layerY:e.offsetY!=undefined?e.offsetY:e.pageY-temp.offsetTop;
			document.onmousemove = move;
			return false;
		}
	}

	function up(){
		dragok = false;
		document.onmousemove = null;
	}

	document.onmousemove = null;
	document.onmousedown = down;
	document.onmouseup = up;

})();
}//End.

function ACTUALIZA( ){
	var x_1,x_2;
	var y_1,y_2;
	if ( x > inicio_x ){
		x_1 = inicio_x;
		x_2 = x - inicio_x;
	}else{
		x_1 = x;
		x_2 = inicio_x - x;
	}
	if ( y > inicio_y ){
		y_1 = inicio_y;
		y_2 = y - inicio_y;
	}else{
		y_1 = y;
		y_2 = inicio_y - y;
	}
	if ( sig ){
		jg_1.clear();
		jg_2.setStroke(2);
		jg_2.drawEllipse( x_1 , y_1 , x_2 , y_2 );
		jg_2.paint( );
	}else{
		jg_2.clear();
		jg_1.setStroke(2);
		jg_1.drawEllipse( x_1 , y_1 , x_2 , y_2 );
		jg_1.paint( );
	}
	sig = !sig;
}

function dibuja( x_1 , y_1 , x_2 , y_2 ){
	var _x_1,_x_2;
	var _y_1,_y_2;
	if ( x_2 > x_1 ){
		_x_1 = x_1;
		_x_2 = x_2 - x_1;
	}else{
		_x_1 = x_2;
		_x_2 = x_1 - x_2;
	}
	if ( y_2 > y_1 ){
		_y_1 = y_1;
		_y_2 = y_2 - y_1;
	}else{
		_y_1 = y_2;
		_y_2 = y_1 - y_2;
	}
	if ( sig ){
		jg_1.clear();
		jg_2.setStroke(2);
		jg_2.drawEllipse( _x_1 , _y_1 , _x_2 , _y_2 );
		jg_2.paint( );
	}else{
		jg_2.clear();
		jg_1.setStroke(2);
		jg_1.drawEllipse( _x_1 , _y_1 , _x_2 , _y_2 );
		jg_1.paint( );
	}
	sig = !sig;
}
function dibuja_escribe(texto , x_1 , y_1 ){
	if ( sig ){
		jg_1.clear();
		jg_2.drawString(texto , x_1 , y_1 );  
		jg_2.paint( );
	}else{
		jg_2.clear();
		jg_1.drawString(texto , x_1 , y_1 );  
		jg_1.paint( );
	}
	sig = !sig;
}

function limpia( ){
	jg_1.clear();
	jg_2.clear();
}



/***********************************************
* Pausing up-down scroller- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function pausescroller(content, divId, divClass, delay){
	this.content=content //message array content
	this.tickerid=divId //ID of ticker div to display information
	this.delay=delay //Delay between msg change, in miliseconds.
	this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
	this.hiddendivpointer=1 //index of message array for hidden div
	document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')
	var scrollerinstance=this
	if (window.addEventListener) //run onload in DOM2 browsers
	window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
	else if (window.attachEvent) //run onload in IE5.5+
	window.attachEvent("onload", function(){scrollerinstance.initialize()})
	else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
	setTimeout(function(){scrollerinstance.initialize()}, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

pausescroller.prototype.initialize=function(){
	this.tickerdiv=document.getElementById(this.tickerid)
	this.visiblediv=document.getElementById(this.tickerid+"1")
	this.hiddendiv=document.getElementById(this.tickerid+"2")
	this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
	//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
	this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
	this.getinline(this.visiblediv, this.hiddendiv)
	this.hiddendiv.style.visibility="visible"
	var scrollerinstance=this
	document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
	document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
	if (window.attachEvent) //Clean up loose references in IE
	window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
	setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

pausescroller.prototype.animateup=function(){
	var scrollerinstance=this
	if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
		this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
		this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
		setTimeout(function(){scrollerinstance.animateup()}, 50)
	}
	else{
		this.getinline(this.hiddendiv, this.visiblediv)
		this.swapdivs()
		setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
	}
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

pausescroller.prototype.swapdivs=function(){
	var tempcontainer=this.visiblediv
	this.visiblediv=this.hiddendiv
	this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
	div1.style.top=this.visibledivtop+"px"
	div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

pausescroller.prototype.setmessage=function(){
	var scrollerinstance=this
	if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
	setTimeout(function(){scrollerinstance.setmessage()}, 100)
	else{
		var i=this.hiddendivpointer
		var ceiling=this.content.length
		this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
		this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
		this.animateup()
	}
}

pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
	if (tickerobj.currentStyle)
	return tickerobj.currentStyle["paddingTop"]
	else if (window.getComputedStyle) //if DOM2
	return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
	else
	return 0
}

//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------

function SeleccionarTodos( ){
	for (var i=0;i < document.forms[0].elements.length;i++){
		var elemento = document.forms[0].elements[i];
		if (elemento.type == "checkbox"){
			elemento.checked = true;
		}
	}
}
 function InvertirSeleccion( ){
	for (var i=0;i < document.forms[0].elements.length;i++){
		var elemento = document.forms[0].elements[i];
		if (elemento.type == "checkbox"){
			elemento.checked = !elemento.checked;
		}
	}
}
 
