<!--
/* 
Funciones del DW. Se utilizan en los siguientes bloques de funciones.
*/
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function clicIzq(msg) {
        if (event.button == 1)
        alert(msg);
        return false;
}

var ns4 = (document.layers);
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);
var ns6 = (!document.all && document.getElementById);

/* 
Funciones para cambiar y restaurar el color de fondo de un elemento que tenga aplicado
un determinado estilo CSS. El parametro id es el identificador del elemento.
*/
function cambiarFondo(id){
// Netscape 4
if(ns4){

}
// Explorer 4
else if(ie4){

}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
captura = document.getElementById(id)
//captura.style.backgroundColor="#FFFFFF";
captura.className = "Mcolor00";
}
}

function restaurarFondo(id, clase){
// Netscape 4
if(ns4){

}
// Explorer 4
else if(ie4){

}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
captura = document.getElementById(id)
captura.className = clase;
}
}

/* Uso:
Para aplicar el rollover hay que introducir el sig. parámetro en la etiqueta que desencadene la acción: 
onMouseOut="restaurarFondo('fila01');" onMouseOver="cambiarFondo('fila01');"
El elemento que cambia el color de su estilo CSS va identificado con:
id="fila01"
*/

/* FUNCIÓN PARA IMPRIMIR UNA PARTE DE LA PÁGINA
*/
var gAutoPrint = true; // Flag for whether or not to automatically call the print function

function printSpecial()
{
	if (document.getElementById != null)
	{
		var html = '<HTML>\n<HEAD>\n';

		if (document.getElementsByTagName != null)
		{
			var headTags = document.getElementsByTagName("head");
			if (headTags.length > 0)
				html += headTags[0].innerHTML;
		}
		
		html += '\n</HE' + 'AD>\n<BODY>\n';
		
		var printReadyElem = document.getElementById("printReady");
		
		if (printReadyElem != null)
		{
				html += printReadyElem.innerHTML;
		}
		else
		{
			alert("Could not find the printReady section in the HTML");
			return;
		}
			
		html += '\n</BO' + 'DY>\n</HT' + 'ML>';
		
		var printWin = window.open("","printSpecial");
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
		if (gAutoPrint)
			printWin.print();
	}
	else
	{
		//alert("Sorry, the print ready feature is only available in modern browsers.");
		self.print();
	}
}
/*
*/
/* Función para añadir a Favoritos en IE y saca alert con instrucciones en NS, Opera y MacIE.
*/
  var Netscape, MSIE, Opera, Unknown;
  var Win, Mac, Other;
  var NetscapeVer, MSIEVer, OperaVer;
  
  Netscape = navigator.appName == "Netscape";
  MSIE = navigator.appName == "Microsoft Internet Explorer";
  Opera = navigator.userAgent.indexOf("Opera") > -1;
  Unknown = !(Netscape || MSIE || Opera);
  
  Win = navigator.userAgent.indexOf("Win") > -1;
  Mac = navigator.userAgent.indexOf("Mac") > -1;
  Other = !(Win || Mac);
  
  if(Netscape) {
    NetscapeVer = parseFloat(navigator.appVersion);
  }
  else if(MSIE) {
    n = navigator.userAgent;
    MSIEVer = n.substr(n.indexOf("MSIE ")+("MSIE ").length, 4);
    MSIEVer = parseFloat(MSIEVer); 
    
    if(Opera) {
      OperaVer = n.substr(n.indexOf("Opera ")+("Opera ").length, 4);
      OperaVer = parseFloat(OperaVer);
    }
  }

function FavoritosMixto() {
  if(Opera) {
    alert(favoritosT);
  }
  else if(Win && MSIE && MSIEVer >= 5) {
    window.external.AddFavorite(location.href,document.title);
  }
  else {
    alert(favoritosD);
  }
}

/* Funciones de enviar y borrar formulario con mensaje para evitar el doble clic
*/
var gClicked = false;

function enviar(theform) {
   
  if( gClicked ) {
  alert( espere );
  return false;
   } else {
  gClicked = true;
  p=MM_findObj(theform);
  p.submit();
  return true;
  }
     
}

function borrar(theform) {
  p=MM_findObj(theform);
  p.reset();
}
/*
*/
/* 
Funciones para los botones del abecedario.
*/
function cambiarAbc(id) {
  captura = document.getElementById(id);
  captura.className = "abcOver";
}

function restaurarAbc(id) {
  captura = document.getElementById(id);
  captura.className = "abc";
}


function abrirUpload(id, ancho, altura, categoria, tipo) {
		var w = 460;
		var h = 205;
        var winl = (screen.width - w) / 2;
        var wint = (screen.height - h) / 2;
        winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
		
        win = window.open('../upload.php?id='+id+'&ancho='+ancho+'&altura='+altura+'&identcat='+categoria+'&tipo='+tipo,'upload', winprops)
        if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}


/* 
*/
/* Función que recoge parámetros de URL mediante JS
*/
function ArgumentURL() {
        this.getArgument = _getArg;
        this.setArgument = _setArg;
        this.removeArgument = _removeArg;
        this.toString    = _toString;	//Allows the object to be printed
        //no need to write toString()
        this.arguments   = new Array();

        // Initiation
        var separator = "&";
        var equalsign = "=";

        var str = window.location.search.replace(/%20/g, " ");
        var index = str.indexOf("?");
        var sInfo;
        var infoArray = new Array();

        var tmp;

        if (index != -1) {
                sInfo = str.substring(index+1,str.length);
                infoArray = sInfo.split(separator);
        }

        for (var i=0; i<infoArray.length; i++) {
                tmp = infoArray[i].split(equalsign);
                if (tmp[0] != "") {
                        var t = tmp[0];
                        this.arguments[tmp[0]] = new Object();
                        this.arguments[tmp[0]].value = tmp[1];
                        this.arguments[tmp[0]].name = tmp[0];
                }
        }



        function _toString() {
                var s = "";
                var once = true;
                for (i in this.arguments) {
                        if (once) {
                                s += "?";
                                once = false;
                        }
                        s += this.arguments[i].name;
                        s += equalsign;
                        s += this.arguments[i].value;
                        s += separator;
                }
                return s.replace(/ /g, "%20");
        }

        function _getArg(name) {
                if (typeof(this.arguments[name].name) != "string")
                return null;
                else
                return this.arguments[name].value;
        }

        function _setArg(name,value) {
                this.arguments[name] = new Object()
                this.arguments[name].name = name;
                this.arguments[name].value = value;
        }

        function _removeArg(name) {
                this.arguments[name] = null;
        }

        return this;
}
function OpenWindow(url, name, properties){
	var newWin=open(url, name, properties);
	
	return newWin;
}
//-->