
var noticia_actual;

function timedCount()
{
    cambia_imagen();

}

function cambia_imagen(){

    /*alert(home_actual);*/

    document.getElementById("n_titular").innerHTML=mynews[noticia_actual][1];
    document.getElementById("n_cuerpo").innerHTML=mynews[noticia_actual][2];
    document.getElementById("n_enlace").href="arghos-news.php?idnoticia="+mynews[noticia_actual][0];


    noticia_actual=noticia_actual+1;
    if(noticia_actual==mynews.length){
        noticia_actual=0;
    }
    if(mynews.length>1){
    t=setTimeout("cambia_imagen()",5000);
    }

}



var Ventana2;

function openIT(theURL,W,H, wname,S) {
  var prop;

  if (S!='no') S="yes"

  prop = "width="+W+",height="+H+",scrollbars="+S;


if (Ventana2) {
    if (Ventana2.closed) {
      Ventana2=open(theURL,wname,prop+",location=no,status=no,directories=no,toolbar=no,resizable=no,menubar=no");
      Ventana2.focus();
    }
    else {
      Ventana2=open(theURL,wname,prop+",location=no,status=no,directories=no,toolbar=no,resizable=no,menubar=no");
      Ventana2.focus();
    }
  }
  else {
      Ventana2=open(theURL,wname,prop+",location=no,status=no,directories=no,toolbar=no,resizable=no,menubar=no");
      Ventana2.focus();
  }
}

function clearInput(id,texto,tipo){
/*
  Esta función borrar el contenido por defecto de un input tipo texto y lo vuelve a mostrar.
  id: identificador del input
  texto: texto por defecto del input
  tipo: 'mostrar' o 'borrar'
*/
    if(tipo=='mostrar'){
        if(document.getElementById(id).value==''){
            document.getElementById(id).value=texto;
        }
    }
    if(tipo=='borrar'){
        if(document.getElementById(id).value==texto){
            document.getElementById(id).value='';
        }
    }

}

function send_form(form){

    document.getElementById(form).submit;

}

function emutation_ToObject(id) {
		if(document.layers){
			return (document.layers[id])?eval(document.layers[id]):null;
		}
		else if(document.all && !document.getElementById){
			return (eval("window."+id))?eval("window."+id):null;
		}
		else if(document.getElementById && document.body.style) {
			return (document.getElementById(id))?eval(document.getElementById(id)):null;
		}
	}

function emutation_FlashWrite(miEMswf, miEMcreativewidth, miEMcreativeheight, miEMwmode, miEMbgcolor, miID){

	var emswf = miEMswf;
	var emcreativewidth = miEMcreativewidth;
	var emcreativeheight = miEMcreativeheight;
	var emwmode = miEMwmode;
	var embgcolor = miEMbgcolor;

	ntcode = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='"+ emcreativewidth +"' height='"+ emcreativeheight +"' id='"+ miID +"'>";
	ntcode +="<param name='movie' value='" + emswf + "'>";
	ntcode +="<param name='quality' value='high'>";
	ntcode +="<param name='bgcolor' value='#" + embgcolor +"'>";
	ntcode +="<param name='wmode' value='"+ emwmode +"'>";
	ntcode +="<param name='menu' value='false'>";
	ntcode +="<embed src='" + emswf + "' quality='high' wmode='" + emwmode + "' width='" + emcreativewidth + "' height='" + emcreativeheight + "' bgcolor='#" + embgcolor +"' type='application/x-shockwave-flash' menu='false' name='"+ miID +"' swLiveConnect='true'></embed></object>";
  	document.write(ntcode);
}

function emutation_FlashInnerHTML(htmlElementId,code){
  var x=emutation_ToObject(htmlElementId);
  if(x){
    if(document.getElementById||document.all){
      x.innerHTML='';
      x.innerHTML=code;
      }
    else if(document.layers){
      x.document.open();
      x.document.write(code);
      x.document.close();
      }
    }
  }


  function valida (f) {
  if (f.nombre.value=="" || f.apellidos.value=="" || f.empresa.value=="" || f.cargo.value=="" || f.email.value==""| f.telefono.value=="") {
  	alert ('Todos campos son obligatorios.\n\nPor favor asegúrese de que están rellenos y pulse enviar.')
  } else {
    f.submit()
  }
 }

  /*------------------------------ AJAX ---------------------------- */

var XMLHttpRequestObject = false;
if (window.XMLHttpRequest) {
    XMLHttpRequestObject = new XMLHttpRequest();
} else if (window.ActiveXObject) {
    XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
}
function getData(dataSource, divID)
{
    if(XMLHttpRequestObject) {
        var obj = document.getElementById(divID);
        XMLHttpRequestObject.open("GET", dataSource);
        XMLHttpRequestObject.onreadystatechange = function()
        {
            if (XMLHttpRequestObject.readyState == 4 &&
            XMLHttpRequestObject.status == 200) {
            obj.innerHTML = XMLHttpRequestObject.responseText;
            }
        }
        XMLHttpRequestObject.send(null);
    }
}