//------------------------------------------------------
function check_otro_item(list_name, item_string){
/*
	Verifica si el String item_string se encuentra
	o no en la lista llamada list_name.
	
	Si se encuentra lo selecciona.
	Sino, hace visible el campo "_otro" y lo
	ingresa en el mismo.
*/

	//alert(list_name + " -> " + item_string);
	
	//obtengo la lista
	var list = document.forms[0].elements[list_name];
	var list_otro_name = list_name + "_otro";
	//var list_otro = document.getElementById(list_otro_name);
	var t_otro=list_otro_name;
	var enLista=new Boolean;

	//Busco SELECCIONADO EN LISTA
	//recorro la lista -------------------
	for(i=0; i<list.length; i++){
		//veo si el valor está en la lista
		if(item_string==list[i].value){
			enLista=true;
			break;//salgo del for
		}
	}//end for
	//------------------------------------
	
	
	if(enLista==true){
		//+ está en la lista: lo selecciono
		list.value=item_string;
	} else {
		/*
		//+ no está en la lista
		//seleccio "Altre" en la lista
		//que es siempre el último item
		list.selectedIndex=list.length-1;
		
		//hago visible el campo de ingreso alternativo
		show_otro(list, t_otro);
		
		//le asigno el valor
		list_otro.value=item_string;
		*/		
	}
	
}

//-----------------------------------------------------

function focusItem(objName){
	obj=document.getElementById(objName);
	obj.focus();
}

//-----------------------------------------------------

function hide(tableName){
	var table = document.getElementById(tableName); 
	table.style.display="none";
}
//...............................................

function show(tableName){
	var table = document.getElementById(tableName); 
	table.style.display="block";
}
//...............................................

function showHide(tableName){
	var table = document.getElementById(tableName); 
	
	if(table.style.display=="block"){
		table.style.display="none";
	} else {
		table.style.display="block";	
	}
}
//...............................................

function gotoIndex(){
	location="index.php";
}
//...............................................

function clearStatus(){
	status=("");	
}
//...............................................

function showHandOn(obj){
	obj.style.cursor="hand";
	status=("// Follow me to the beginning");
}
//...............................................

function isLinkOn(obj){
	obj.style.cursor="hand";
	obj.style.color="#000000";
}
//...............................................

function isLinkOff(obj){
	obj.style.color="#FFFFFF";
}
//...............................................

function popup(theURL,winName,features,popwidth,popheight) { //v2.0
  window.open(theURL,winName,features + ",width=" + popwidth + ",height=" + popheight + ",left=" + (screen.width-popwidth)/2 + ",top=" + (screen.height-popheight)/2 + "'");

  /*
  	use example:
  	
  	onClick="javascript:popup('list_photo.php','asociarFoto','status=no','400','400');"
  */
}
//...............................................

function AddURL(URL) {
  	url=prompt("Ingrese la URL aquí","www.");
  	Text=document.form1.news.value;
	if (url!=null) {
		document.form1.news.value=Text + "<a href=http://" + url + ">" + url + "</a>";
	}
}


function addDate() {
	fecha=new Date();
	day = fecha.getDate(); 
	month = parseInt(fecha.getMonth()) + 1; 
	year = fecha.getFullYear();
	dia = fecha.getDay();
	
	//obtengo el nombre del día según el valor de fecha.getDay()
	switch (dia){
		case 0: 
			dia="Domingo";
			break;
			
		case 1:
			dia="Lunes";
			break;
			
		case 2:
			dia="Martes";
			break;
			
		case 3:
			dia="Miércoles";
			break;
			
		case 4:
			dia="Jueves";
			break;
			
		case 5:
			dia="Viernes";
			break;
			
		case 6:
			dia="Sábado";
			break;
			
		default:
			dia="";
	}
	
	document.update.fecha.value=day + "." + month + "." + year;
}
//...............................................


function submitForm(formname,action){
	document.forms[formname].action=action;
	document.forms[formname].submit();
}
//...............................................

function imgSlideShow(){
	count=0;
		for(i=1; i<=6; i++) { 
				count++;
				setTimeout("document.images['imgSlide'].src='images/slideShow/img"+count+".jpg';",i*10000);
				
		} 
}
//...............................................

function popUpImg(theURL,winName,features,imgWidth,imgHeight) { //v2.0 by MYD
  window.open(theURL,winName,features + ",left=" + (screen.width-imgWidth)/2  + "'" + ",top=" + (screen.height-imgHeight)/2  + "'");
}
//...............................................
