// load first
function noSelect() {
	// quitar seleccion de texto
	document.onselectstart = function() {return false;} // ie
    document.onmousedown = function() {return false;} // mozilla
}
function loadPortada() {
	// lodear cont-left
	getdata('cont-left.php','cont-left');
	// lodear i_alcenit
	setTimeout("loadInicio()",1000);
}
function loadInicio() {
	setTimeout("getdata('inicio.php','container')",100);
}
function loadAlcenit() {
	getdata('i_alcenit.php','container');
}
// CAMBIADOR DE WORKBOX-BOX
function CngClass(cevt){
 document.getElementById("firstbox").setAttribute("class","workbox-box");
 document.getElementById("firstbox").setAttribute("className","workbox-box");
// lo otro
 var cevt=window.event||arguments.callee.caller.arguments[0];
 var cobj=window.event?cevt.srcElement:cevt.target;
 while (cobj.parentNode){
  if (cobj.nodeName=='LI') break;
  cobj=cobj.parentNode;
 }
 if (cobj.nodeName!='LI') return;
 var cul=cobj.parentNode;
 if (cul.lst) cul.lst.className='workbox-box';
 cul.lst=cobj;
 cul.lst.className='workbox-box-in';
}

/* manual con función

function changeCssClass(objDivID)
{
	if(document.getElementById(objDivID).className=='workbox-box')
	{document.getElementById(objDivID).className = 'workbox-box-in';}
	else
	{document.getElementById(objDivID).className = 'workbox-box-in';}
}*/

// AJAX LINKS
// here we define global variable
var ajaxdestination="";

function getdata(what,where) { // get data from source (what)
 try {
   xmlhttp = window.XMLHttpRequest?new XMLHttpRequest():
  		new ActiveXObject("Microsoft.XMLHTTP");
 }
 catch (e) { /* do nothing */ }

 document.getElementById(where).innerHTML ="<center><img src='img/ajax-loader.gif'></center>";
// we are defining the destination DIV id, must be stored in global variable (ajaxdestination)
 ajaxdestination=where;
 xmlhttp.onreadystatechange = triggered; // when request finished, call the function to put result to destination DIV
 xmlhttp.open("GET", what);
 xmlhttp.send(null);
  return false;
}

function triggered() { // put data returned by requested URL to selected DIV
  if (xmlhttp.readyState == 4) if (xmlhttp.status == 200) 
    document.getElementById(ajaxdestination).innerHTML =xmlhttp.responseText;
}

// TOP SCRIPT
function top() {
  if (document.body.scrollTop!=0 || document.documentElement.scrollTop!=0){
    window.scrollBy(0,-5);
    t=setTimeout('top()',10);
  }
  else clearTimeout ;
}

