var urlArray = new Array(6); //for URL's, increase size as necessary
var banArray = new Array(6); //for banners, increase size as necessary
var counter = 1;
var url = "#"; //initial URL

function go()
{ 
	box = document.form2.select1;
	destination = box.options[box.selectedIndex].value;
	if (destination) location.href = destination;
}

//add your necessary URL's
urlArray[0] = "#";
urlArray[1] = "#";
urlArray[2] = "#";
urlArray[3] = "#";
urlArray[4] = "#";
urlArray[5] = "#";
urlArray[6] = "#";

if(document.images) //pre-load all banner images
{
  for(i = 0; i < 7; i++)
  {
    banArray[i] = new Image(468, 60);
    banArray[i].src = "images/Imagen_col_izq_" + (i+1) + ".jpg";
  }
}

function getParams() {
var idx = document.URL.indexOf('?');
var params = new Array();
if (idx != -1) {
var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
for (var i=0; i<pairs.length; i++) {
nameVal = pairs[i].split('=');
params[nameVal[0]] = nameVal[1];
   }
}
return params;
}
params = getParams();

function AbreLiga()
{
		var linkx;
		linkx = document.form2.select.value;
		document.href = linkx;
	
}


function changeBanner() //banner changer function
{

  if(counter > 6)
   counter = 0;
  //alert("El objeto es:" + bannerObject); 
  var bannerObject = document.getElementById('theBanner');	
  if (bannerObject != null) {
	//alert("El objeto es:" + bannerObject);
  bannerObject.src = banArray[counter].src; //sets a new banner
  url = urlArray[counter]; //sets a new URL to the banner
  counter++; //increase the counter for the next banner
  } else {
	//alert("No se identifica... :" + bannerObject);
  }
}

//calls the changeBanner() function every 3 seconds
//change the timer as necessary (minutes * 60000) or (seconds * 1000)
var timer = window.setInterval("changeBanner()", 5000);	

function selecciona(area){
		var imageName;
		var imageObj;
		var styleObj;
	
		if (area==0) {
			document.getElementById('a').style.backgroundColor='#003366';
			document.img1.src='images/btn_la_empresa_off.jpg';	
			document.getElementById('b').style.backgroundColor='#003366';
			document.img2.src='images/btn_prod_ind_off.jpg';	
			document.getElementById('c').style.backgroundColor='#003366';
			document.img3.src='images/btn_prod_emp_off.jpg';	
			document.getElementById('d').style.backgroundColor='#003366';
			document.img4.src='images/btn_contrate_off.jpg';					
		} else
		if (area==1){
			styleObj = document.getElementById('a');
			imageName = 'images/btn_la_empresa_off.jpg';	
		} else
		if (area==2){
			styleObj = document.getElementById('b');
			imageName = 'images/btn_prod_ind_off.jpg';	
		} else
		if (area==3){
			styleObj = document.getElementById('c');
			imageName = 'images/btn_prod_emp_off.jpg';	
		} else
		if (area==4) {
			styleObj = document.getElementById('d');
			imageName = 'images/btn_contrate_off.jpg';					
		}
		
		imageObj = document.getElementById('img' + area);
		
		if (imageObj != null) {
			imageObj.setAttribute('src', imageName);
			styleObj.style.backgroundColor='#003366';
		}
}


//Servicios en Linea
var forma = null;

function accesa() {
	if(!checkForm()) {
    	alert('Los datos son obligatorios');
		return false;
  	} else  {
  		document.laForma.submit();
  	}
}

function checkForm() {
	var nombre = forma.getAttribute('id');
	if (nombre == 'afore') {
    	if ((document.laForma.usu.value != '') && (document.laForma.password.value != '')) {
			return true;
  		} else {
  			return false;
  		}
  	} else if (nombre == 'fondos') {
  		if ((document.laForma.usu2.value != '') && (document.laForma.password2.value != '')) {
			return true;
  		} else {
  			return false;
  		}
  	} else if (nombre == 'empleado') {
  		if ((document.laForma.clave.value != '') && (document.laForma.nip1.value != '')
			&& (document.laForma.nip2.value != '') && (document.laForma.nip3.value != '')) {
			return true;
  		} else {
  			return false;
  		}
  	}
}

function showForma(id) {
	var tabla = document.getElementById('general');
	if(forma != null) {
		forma.style.display = 'none';
  	}
	
	forma = document.getElementById(id);
	
	tabla.style.display = '';
	forma.style.display = '';
}

function showSubForma(id) {
	if (forma != null) {
		forma.style.display = 'none';
  	}
	
	if (document.getElementById(id) != 'afore') {
		var tabla = document.getElementById('general');
		tabla.style.display = 'none';
  	}
	
	forma = document.getElementById(id);
	forma.style.display = '';
}

function blink(objName, clase) {
    objName.className = clase;
}

  function abreVentana(url,ancho,alto) 
  	{ 
    popupWin = window.open(url,"","name=aviso,target=_top,toolbar=no,scrollbars=yes,resizable=no,width="+ancho+",height="+alto);
    popupWin.focus();
	}
  function abreVentanita(url) 
  	{ 
	//alert("URL='"+url+"'");
    popupWin = window.open(url,"","name=Ventanita,target=_top,toolbar=no,scrollbars=yes,resizable=no,width=380,height=350");
    popupWin.focus();
	}	
	
	
	 
	