function createXMLHttpRequest() {
	if (window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP");
	} else if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	}else{
		return new ActiveXObject("Msxml2.XMLHTTP");
		alert('No existe la posibilidad de AJAX');
	}
}

/*
var xmlHttp;
function showSeccion(seccion){
	if(seccion!=''){
		var url = 'secciones.php?secc='+seccion;
		xmlHttp = createXMLHttpRequest();
		xmlHttp.open("GET", url);
		xmlHttp.onreadystatechange = restulado;
		xmlHttp.send(null);
		
		
	
	}else{
		var url = 'secciones.php?secc=home'
		xmlHttp = createXMLHttpRequest();
		xmlHttp.open("GET", url);
		xmlHttp.onreadystatechange = restulado;
		xmlHttp.send(null);
	
		
	
	}
	function restulado() {
		if (xmlHttp.readyState == 4) {
			document.getElementById("content").innerHTML=xmlHttp.responseText;
		}
	}
}*/

function surfto(form)
{
var myindex=form.secciones.selectedIndex
if(myindex==3){
window.open(form.secciones.options[myindex].value,"_blank","");
}else{
	window.open(form.secciones.options[myindex].value,"_top","");

	}
}

function delCampos(form){

	var name=document.getElementById("nombre").value='';
	var email=document.getElementById("email").value='';
	var mensaje=document.getElementById("mensaje").value='';
}

function isEmpty(s)
{ return ((s == null) || (s.length == 0)); }
function isSpace(c)
{ return ((c == "\n") || (c == " ") || (c == "\b") || (c == "\t")); }
function isWhiteSpace(s)
{ for(i=0; i<s.length; i++)
  if(!isSpace(s.charAt(i))) return false;
  return true;
}
function warning(f,s)
{ f.focus();
  f.select();
  alert(s);
  return false;
}
function isEmail(email)
{
  if(isEmpty(email)) return false;
  if(isWhiteSpace(email)) return false;
  invalidChars = " /:,;";
  for(i=0; i<invalidChars.length; i++)
  {
    badChar = invalidChars.charAt(i);
    if(email.indexOf(badChar,0) > -1) return false; 
  }
  atPos = email.indexOf("@",1);
  if(atPos == -1) return false; 
  if(email.indexOf("@",atPos+1) > -1) return false; 
  periodPos = email.indexOf(".",atPos);
  if(periodPos == -1) return false; 
  if(periodPos+3 > email.length) return false; 
 return true;
}


function validateBoxRegistro(fm)
{
  
  email = fm.email.value;
 
  
  if(!isEmail(email)){
    warning(fm.email,"Captura tu Email");
	return false;
  }else{
	return true;  
	  }

}
function paginarEventos(pag){
	var url = "listado_eventos.php?pg=" + pag;
	xmlHttp = createXMLHttpRequest();
	xmlHttp.open("GET", url);
	xmlHttp.onreadystatechange = resultados;
	xmlHttp.send(null);
}
function resultados() {
	if (xmlHttp.readyState == 4) {
		document.getElementById("list_events").innerHTML = xmlHttp.responseText;
	}
}
/*
document.onmousedown = new Function("return false");
document.onselectstart = new Function ("return false");
if (window.sidebar) {
   document.onmousedown = new Function("return false");
   document.onclick = new Function("return true");
}

function rtclk(e) {
	if (document.all && !document.getElementById) {
		if (event.button == 2) return false;
		} else if (document.layers) {
			if (e.which == 2 || e.which == 3) {
				return false;
				}
		}
	} if (document.layers) document.captureEvents(Event.MOUSEDOWN);document.onmousedown = rtclk;document.oncontextmenu = function() {return false;}
	*/