var myWidth = 0;
var myHeight = 0;
var AnchoImgFondo = 2000;
var AltoImgFondo = 1000;
var Path = "WebFiles/";

function idAlNewsLetter(url){
window.open(url);
}

function irAlInicio(Idioma){
	location.href = '?'+Idioma;
}

function irAAGI(){
  window.open("http://www.a-g-i.org");
}

function comprobarEmail(Idioma){
	//alert("HOOOO");
	obliCAS = "El Email es obligatorio.";
	obliENG = "Email is required.";
	errorCAS ="El Email introducido no es válido.";
	errorENG ="The submitted Email is not correct.";
	
	if (document.getElementById("email").value == ""){
		if (Idioma=="CAS"){
			alert(obliCAS);
		} else {
			alert(obliENG);
		}
     	return false;
    }else if (document.getElementById("email").value.indexOf("@") == -1 ){
     	if (Idioma=="CAS"){
			alert(errorCAS);
		} else {
			alert(errorENG);
		}
     	return false;
    }else if (document.getElementById("email").value.lastIndexOf(".") == -1 ){
     	if (Idioma=="CAS"){
			alert(errorCAS);
		} else {
			alert(errorENG);
		}
     	return false;
    }else if (document.getElementById("email").value.indexOf("@") > document.getElementById("email").value.lastIndexOf(".")){

     	if (Idioma=="CAS"){
			alert(errorCAS);
		} else {
			alert(errorENG);
		}
     	return false;
    } else {
    	return true;
    }
}

function Medidas(){
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  }else if( document.documentElement ){
    if ( document.documentElement.clientWidth || document.documentElement.clientHeight ){
      //IE 6+ in 'standards compliant mode'
      myWidth = document.documentElement.clientWidth;
      myHeight = document.documentElement.clientHeight;
    }else if ( document.body.clientWidth || document.body.clientHeight ){
      //IE 4 compatible
      myWidth = document.body.clientWidth;
      myHeight = document.body.clientHeight;
    }
  }else if( document.body ){
    if( document.body.clientWidth || document.body.clientHeight ){
      //IE 4 compatible
       myWidth = document.body.clientWidth;
       myHeight = document.body.clientHeight;
     }
  }
}

function Reposicionar(){
  Medidas();
  
/*  var F = document.getElementById("ImgFondo").style;
  var NewH = 0;
  var NewW = 0;

  NewH = myHeight;
  NewW = Math.floor(myHeight * AnchoImgFondo / AltoImgFondo);
  
  F.width = NewW + "px";
  F.height = NewH + "px";*/
  
  if ( $('#Contenedor').height() < myHeight ){
    $('#Contenedor').css({'height':myHeight+'px' });
  }else{
    aux = $('#Contenedor').height();
    $('#Contenedor').css({'height':aux+'px' });
  }
}

function Quitar(){
  document.getElementById("ImgFondoSpeaker").src = "";
  document.getElementById("FondoSpeaker").style.display = "none";
  document.getElementById("FondoSpeaker").style.visibility = "hidden";
  
  document.getElementById("Contenido").style.display = "block";
  document.getElementById("Contenido").style.visibility = "visible";
}

function Mostrar( Imagen ){
  document.getElementById("Contenido").style.display = "none";
  document.getElementById("Contenido").style.visibility = "hidden";
  
  document.getElementById("ImgFondoSpeaker").src = Path + Imagen;
  document.getElementById("FondoSpeaker").style.display = "block";
  document.getElementById("FondoSpeaker").style.visibility = "visible";
}

//Si el navegador del cliente es Mozilla la variable siguiente valdrá true
var moz = document.getElementById && !document.all;
//Flag que indica si estamos encima del objeto
var EstoyEnOver = false;
//Variable para almacenar un puntero al objeto que estamos encima
var dobj;
		
function arrastrarRaton(e){
  var fobj = moz ? e.target : event.srcElement;
			
  while (fobj.tagName.toLowerCase() != "html" && fobj.id != "Speakers" && fobj.tagName.toLowerCase()!="a") {
    fobj = moz ? fobj.parentNode : fobj.parentElement;
  }

  if (fobj.id == "Speakers") {
		dobj = fobj;
  }else{
    if (fobj.tagName.toLowerCase()!="a" && fobj.id != "Speakers"){
      Quitar();
      return false;
    }
  }
}


document.onmousemove = arrastrarRaton;
document.oncontextmenu=new Function("return false");
