
	var fecha=new Date();
var diames=fecha.getDate();
var diasemana=fecha.getDay();
var mes=fecha.getMonth() +1 ;
var ano=fecha.getFullYear();

function loaderSim()
{

	listoCarga="si";
	for(var i = 0; i < cantidadImagenes; i++) 
	{
	if(document.images[i].complete==false)
	  {
		  listoCarga="no";
		  setTimeout("loaderSim()", 1000);
		  return;
	  }
	}
	if(listoCarga=="si")
	{

	xDisplay("divLoader","none")
	}

}
var textosemana = new Array (7);
  textosemana[0]="Domingo";  textosemana[1]="Lunes";  textosemana[2]="Martes";  textosemana[3]="Mi&eacute;rcoles";  textosemana[4]="Jueves";
  textosemana[5]="Viernes";  textosemana[6]="S&aacute;bado";

var textomes = new Array (12);
  textomes[1]="Enero";  textomes[2]="Febrero";  textomes[3]="Marzo";  textomes[4]="Abril";  textomes[5]="Mayo";
  textomes[6]="Junio";  textomes[7]="Julio";  textomes[8]="Agosto";  textomes[9]="Septiembre";  textomes[10]="Octubre";
  textomes[11]="Noviembre";  textomes[12]="Diciembre";


function formatText(index, panel) {
		  return index + "";
	    }
    
        $(function () {
        
            $('.anythingSlider').anythingSlider({
                easing: "easeOutCubic",       
                autoPlay: true,               
                delay: 3000,                  
                startStopped: false,           
                animationTime: 600,           
                hashTags: true,               
                buildNavigation: false,         
        		pauseOnHover: true,             
        		startText: "Iniciar",            
		        stopText: "Detener",             
		        navigationFormatter: formatText      
            });
            
            $("#slide-jump").click(function(){
                $('.anythingSlider').anythingSlider(6);
            });
            
        });
		
		
		$(function(){
	$.superbox();});
		
		$.superbox.settings = {
	boxId: "superbox", 
	boxClasses: "", 
	overlayOpacity: .8,
	boxWidth: "600", 
	boxHeight: "400", 
	loadTxt: "Cargando...", 
	closeTxt: "Cerrar", 
	prevTxt: "Anterior",
	nextTxt: "Siguiente" 
};

var fil = 100;
var p = 1;
var paginas  =  new Array();
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



 


function sigaNumero(id)
{//###########################################################  sigaNumero(id) #########################
 /* OPERADORES_____________________________________________
      * | # | PROGRAMADOR     |  |   FECHA   |  |   HORA   |
      * | 1 | Andy Vasquez    |  |25/09/2007 |  | 16:34:19 |
      * | 2 | jose villarroel |  |26/09/2007 |  | 11:40:19 |
      * | 1 | Andy Vasquez    |  |11/06/2008 |  | 17:30:19 |
      * |__________________________________________________|
      * 
      * DESCRIPCION: FUNCION ENCARGADA DE VALIDAR QUE LA CAJA DE TEXTO SOLO CONTENGA NUMEROS
      * 
	  * PARAMETROS_______________________________________________________________________________________________
      * | # |          NOMBRE       |  |                             DESCRIPCION                                |
      * | 1 |            id         |  |   id de la caja de texto que se desea verificar que no contenga letras |  
      * |___|___________________________________________________________________________________________________|
      * */
	//alert(id)
  if(xGetElementById(id).value.match(/[^0-9\ ]/)){
    xGetElementById(id).value=xGetElementById(id).value.replace(/[^0-9\ ]/gi,"");
		
  }
  xGetElementById(id).value = allTrim(xGetElementById(id).value);//msg(id);
  
}//###########################################################  sigaNumero(patron) #########################

function chCorreo(id)
{
	var correo = xGetElementById(id).value;
	if(correo != '')
	  {
		var resp = ValidaCorreo(correo);
		if(resp == 0)
		  {
		  	alert('SIM \n- Direcion de correo invalida');
			xGetElementById(id).focus();
			
		  }
		  return resp;
	  }

}



function ValidaCorreo(correo)
{//ini_____________________________ funcion que valida si un simple string es una direccion de correop valida
	
	var CERO=0;//FALSE CUANDO EL STRING NOOO SEA UN CORREO VALIDO
	var UNO=1;// TRUE CUANDO EL STRING SEA UN CORREO VALIDO

    	var splitted = correo.match("^(.+)@(.+)$");
   		 if(splitted == null) return CERO;
		 
    	if(splitted[1] != null )
    		{
      			var regexp_usuario=/^\"?[\w-_\.]*\"?$/;
      			if(splitted[1].match(regexp_usuario) == null) return CERO;
    		}
			
    	if(splitted[2] != null)
    		{
     			 var regexp_dominio=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      			if(splitted[2].match(regexp_dominio) == null) 
      				{
	    				var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    					if(splitted[2].match(regexp_ip) == null) return CERO;
      				}// if
      			return UNO;
    		}
		return CERO;
}//ini_____________________________ funcion que valida si un simple string es una direccion de correop valida

  function mostrarTwit()
   {
	  xDisplay('twitter','block') ;
	   xDisplay('fondoopaco','block') ;
	  
	  var pos=centrarVentana(400,300);
	  xGetElementById('twitter').style.left=pos[0]+"px";
	  xGetElementById('twitter').style.top=pos[1]+"px";
	
   }
    function ocultarTwit()
   {
	   xDisplay('twitter','none') ;
	    xDisplay('fondoopaco','none') ;
   }
  function mostrarWait()
   {
	  xDisplay('wait','block') ;
	  
	  var pos=centrarVentana(170,55);
	  xGetElementById('wait').style.left=pos[0]+"px";
	  xGetElementById('wait').style.top=pos[1]+"px";
	
   }
    function ocultarWait()
   {
	   xDisplay('wait','none') ;
   }
   	function centrarVentana(anchoCapa,altoCapa)
	{
	    //Calculamos el ancho y alto de la ventana del navegador
	    var anchoPantalla = xClientWidth();
	    var altoPantalla = xClientHeight();
	    
	    //Calculamos la posicion de X,Y restando las mitades del ancho y alto de la pantalla respecto al de la capa
	    var posicionX = (parseInt(anchoPantalla)/2) - (parseInt(anchoCapa)/2);
	    var posicionY = (parseInt(altoPantalla)/2) - (parseInt(altoCapa)/2);
	    
	    //Sumamos la cantidad de pixeles desplazados hacia abajo usando la barra de desplazamiento
		//Math.max(document.body.scrollTop,document.documentElement.scrollTop
		if(document.all?true:false==true)		   
		posicionY = posicionY + Math.max(document.body.scrollTop,document.documentElement.scrollTop);
		else
		posicionY = posicionY + window.pageYOffset;
	    
	    //Creamos un arreglo con los valores resultantes de X y Y
	    var posicion = new Array(posicionX, posicionY);
	    
	    return posicion;
	}
function mandarDatosTeclado(evt)
{
	var e = new xEvent(evt);//crea una instancia de la clase xEvent

    if(e.keyCode == 13)//verificamos que alla presionad enter
        {
			
			buscador();   
        }
	
	
}


var simPaginas = new Array();
simPaginas['sim'] = 0;
simPaginas['servicio'] = 0;
simPaginas['curso'] = 0;
simPaginas['contacto'] = 0;
simPaginas['portafolio'] = 0;
simPaginas['empleos'] = 0;
simPaginas['enlaces'] = 0;
simPaginas['soluciones'] = 0;
simPaginas['cursos'] = 0;
simPaginas['componentes'] = 0;

function muestraPagina(pagina,variable,idDiv)
{//____________________________________________________________________________________________________________________________

   if(simPaginas[variable] == 0)
   {//.........................................................................................................................................
   mostrarWait();
   xDisplay('contenidoPaginas','block');
    xDisplay('anythingSlider','none');
	location.href="#index";	
			var divv = xGetElementById(idDiv);

				
				var url =  'paginas/'+pagina;
				
				  AjaxRequest.post
			        ({'parameters':{ },
			        'onSuccess':function(req){
										   
											   mD.limpiaTexto(divv);
											   divv.innerHTML = req.responseText;
											
											   simPaginas[variable] = req.responseText;
												ocultarWait()
		

										     },
			        'url': url,
			        'onError':function(req)
			        {
			        alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);
			        }
			    });	
	}//.......................................................................................................................................................
	
	else
	{// ya esta cargada la variable
	
		var divv = xGetElementById(idDiv);
		xDisplay('contenidoPaginas','block');
   		 xDisplay('anythingSlider','none');
		location.href="#index";	
		
		
		mD.limpiaTexto(divv);
        divv.innerHTML = simPaginas[variable];
		
	}



}//_________


































function desvaneceCargador()
{//______________________________________________________
  tiempo = p*(-1);
  //alert(id+'....'+tiempo)
  obj = document.getElementById('cargadorOficial');
  //alert(p)
  fil += tiempo;
  obj.style.filter = 'alpha(opacity='+fil+')';
  obj.style.MozOpacity= fil / 100;

  	if(p<14)
	{
			//var px = p +'px';
			//xGetElementById('flashAlcance').style.width = px;
		    setTimeout("desvaneceCargador()",100);
			p++;
	}
	else
	{
	    
          fil = 75;
		  p = 1;
		  ocultaCargando('cargadorOficial');
	}
  
}//______________________________________________________



function falta()
{
	
	alert('SIM \n - Sera colocado proximamente!');
	
}

function muestracapa(id)
{


	var w = screen.width;
	var h = screen.height;
	
	var div = document.getElementById(id);
	
			var w1 = w+"px";
			var h1 = h+"px";
			div.style.position = 'absolute';
			div.style.top = '0px';
			div.style.left = '0px';
			div.style.width = w1;
			div.style.height = h1;
			

	div.style.display = 'block';

}




function enviarDatos()
{
	
	var txNombre=xGetElementById('txNombre').value;
	var txComentarios=xGetElementById('txComentarios').value;
	var txEmail=xGetElementById('txEmail').value;
	var txTelf=xGetElementById('txTelf').value;
	
	if(xGetElementById('txNombre').value!="" && xGetElementById('txComentarios').value!="" && xGetElementById('txEmail').value!="")
	{
		if(simValidaCorreo(xGetElementById('txEmail').value)==1)
		{
			mostrarWait();
			mD.remplazaTexto(xGetElementById('statusInfo'),'Enviando datos.... Espere por Favor.');
			xGetElementById('statusInfo').className="statusInfo";

			var parametros = "&txNombre="+txNombre+"&txComentarios="+txComentarios+"&txEmail="+txEmail+"&txTelf="+txTelf+"&tipo="+"sim";
					url= "transaccion/enviaCorreo.php";
					AjaxRequest.post
					(
					{
						'queryString':parametros
						,'url':url
						,'onSuccess':function(req)
									{
										var respuesta = req.responseText;	
										var resultado = eval("(" + respuesta + ")");
										//alert(respuesta)
										if(respuesta==1)
										{
											enviarDatosCliente(txEmail,txNombre);
											xGetElementById('txNombre').value="";
											xGetElementById('txEmail').value="";
											xGetElementById('txComentarios').value="";
											xGetElementById('txTelf').value="";
											mD.remplazaTexto(xGetElementById('statusInfo'),'Sus datos fueron enviados satisfactoriamente.');
											xGetElementById('statusInfo').className="statusInfoExito";
											ocultarWait();
										}
										else
										{
										mD.remplazaTexto(xGetElementById('statusInfo'),'Ha ocurrido un error al intentar enviar sus datos. intente mas tarde.');
											ocultarWait();
											xGetElementById('statusInfo').className="statusInfoError";
										}
									}
						,'onError':function(req)
						{ 
							alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);
						}
					}           
					);	

		}
		else
		{
		mD.remplazaTexto(xGetElementById('statusInfo'),'El correo introducido es incorrecto. Verifique.');
		xGetElementById('statusInfo').className="statusInfoError";	
			
		}
		
	}
	else
	{
		mD.remplazaTexto(xGetElementById('statusInfo'),'Existen datos sin introducir. Verifique.');
		xGetElementById('statusInfo').className="statusInfoError";
		
	}
	
}
function enviarDatosCliente(txEmail,txNombre)
{
	


			var parametros = "&txEmail="+txEmail+"&tipo="+"cliente"+"&txNombre="+txNombre;
					url= "transaccion/enviaCorreo.php";
					AjaxRequest.post
					(
					{
						'queryString':parametros
						,'url':url
						,'onSuccess':function(req)
									{
										var respuesta = req.responseText;	
										var resultado = eval("(" + respuesta + ")");
										
									}
						,'onError':function(req)
						{ 
							alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);
						}
					}           
					);	


	
}
function cancelarDatos()
{
	xGetElementById('txNombre').value="";
	xGetElementById('txEmail').value="";
	xGetElementById('txComentarios').value="";
	xGetElementById('txTelf').value="";
	mD.remplazaTexto(xGetElementById('statusInfo'),'Los campos marcados con (*) son obligatorios.');
	xGetElementById('statusInfo').className="statusInfo";
	
}

//#########################################Funcion encargada de validar  numeros de telefonos(permite numeros guion y parentesis)
function validarTelefono(id)//leandro
{
  if(xGetElementById(id).value.match(/[^0-9()\ -]/)){
    xGetElementById(id).value=xGetElementById(id).value.replace(/[^0-9()\- ]/gi,"")
  }
}
function validaSoloLetras(id)
{
  if(xGetElementById(id).value.match(/[^a-z\áéíóúÁÉÍÓÚñ ]/)){
    xGetElementById(id).value=xGetElementById(id).value.replace(/[^a-z\áéíóúÁÉÍÓÚñ ]/gi,"")
  }
}
//#########################################Funcion encargada de validar que solo se introduzcan numeros
function validaSoloNumeros(id)//leandro
{

  if(xGetElementById(id).value.match(/[^0-9\ ]/)){
    xGetElementById(id).value=xGetElementById(id).value.replace(/[^0-9\ ]/gi,"")
  }
}
function simValidaCorreo(correo)
{
	
	var CERO=0;//FALSE CUANDO EL STRING NOOO SEA UN CORREO VALIDO
	var UNO=1;// TRUE CUANDO EL STRING SEA UN CORREO VALIDO

    	var splitted = correo.match("^(.+)@(.+)$");
   		 if(splitted == null) return CERO;
		 
    	if(splitted[1] != null )
    		{
      			var regexp_usuario=/^\"?[\w-_\.]*\"?$/;
      			if(splitted[1].match(regexp_usuario) == null) return CERO;
    		}
			
    	if(splitted[2] != null)
    		{
     			 var regexp_dominio=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      			if(splitted[2].match(regexp_dominio) == null) 
      				{
	    				var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    					if(splitted[2].match(regexp_ip) == null) return CERO;
      				}// if
      			return UNO;
    		}
			
		return CERO;
		
		//matamos las variables
		CERO = null;
		UNO = null;
		splitted = null;
		regexp_usuario = null;
		regexp_dominio = null;
		regexp_ip = null;
}




