// JavaScript Document
function resultadoUpload(estado, file,url) 
{

    var link = '<br /><br /><a href="fotosABC.php">Subir Otro Archivo</a> - <a href="verArchivos.php">Ver Imagenes</a>';

    if (estado == 0) var mensaje = 'El Archivo <a href="'+url+'' + file + '" target="_blank">' + file + '</a> se ha subido al servidor correctamente' + link;
    if (estado == 1) var mensaje = 'Error ! - El Archivo no llego al servdor' + link;
    if (estado == 2) var mensaje = 'Error ! - Solo se permiten Archivos tipo Imagen' + link;
    if (estado == 3) var mensaje = 'Error ! - No se pudo copiar Archivo. Posible problema de permisos en server' + link;
    
	document.getElementById('AvisoDivUpload').innerHTML = mensaje;   

}
function TituloEvento(combo) //Cambia el texto del titulo de Evento de acuerdo al elemento seleccionado
{
  document.getElementById('Id').value =combo.options[combo.selectedIndex].value;
  document.getElementById('nombreEvento').innerHTML = 'Fotografias del Evento : '+combo.options[combo.selectedIndex].text; 
  cargaFotos();

  
}

function SeleccionarFoto(id,url)//Selecciona una Foto y la pone en el area de seleccionadas
{
  var div = document.getElementById('selec');
  var check = document.getElementById('check'+id);
  var tbSelec = document.getElementById('tbSelec'+id);
  
  if(check.checked)
  {
    if(tbSelec == null)
    {
      var string ='<table id="tbSelec'+id+'"><tr><td width="50px" align="right">'+id+'</td><td align="left"><img src='+url+'   /></td></tr></table>';
      div.innerHTML += string;
    }
	
  }
  else
  {
    if(tbSelec != null)
    {
      padre = tbSelec.parentNode;
	  padre.removeChild(tbSelec);
    } 
  }

}


function compruebaCheck(id)
{
	if(id == '')
	{
	var num = window.document.getElementById('selec').childNodes.length;
	for (i=0;i<num;i++)
	{
		  var id = window.document.getElementById('selec').childNodes[i].id;
		  
		  id = id.substr(7,id.length);
		  
		  if(document.getElementById('check'+id) != null)
		  {
			var check = document.getElementById('check'+id);
			check.checked = true; 
		  
		  }	  

	}
	}
	else
	{
	  var tbSelec = document.getElementById('tbSelec'+id);
	  padre = tbSelec.parentNode;
	  padre.removeChild(tbSelec);
	}
}

                                             
function CreaSwf(img,wsize,hsize,opt){
    document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0\" width=\""+wsize+"\" height=\""+hsize+"\">");
    document.write("<param name=\"movie\" value=\""+img+"\">");
    document.write("<param name=\"quality\" value=\"high\">");
    document.write("<param name=\"wmode\" value=\"transparent\">");
    if(opt != null){
        document.write("<param name='FlashVars' value='"+opt+"'>");
        alt="FlashVars="+opt;
        
    }
    document.write("<embed src=\""+img+"\" wmode=\"transparent\" "+alt+" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+wsize+"\" height=\""+hsize+"\"></embed>");
    document.write("</object>");
}