/*****************************************************************************
Carousel de imágenes (marquesina horizontal). Script creado por Tunait! (18/8/2003) modificado el 25/12/2003.
Si quieres usar este script en tu sitio eres libre de hacerlo con la condición de que permanezcan intactas estas líneas, osea, los créditos.
No autorizo a publicar y ofrecer el código en sitios de script sin previa autorización
Si quieres publicarlo, por favor, contacta conmigo.
http://javascript.tunait.com/
tunait@yahoo.com 
******************************************************************************/
var ancho = 791  // especifica la anchura a mostrar
var alto = 120 // especifica la altura a mostrar (alto de las imágenes)
var velo = 100 // velocidad 
var dis = 1 //cantidad de pixels que desplaza por movimiento

var imagenes = new Array()
imagenes[0] = new Image()
imagenes[0].src = "sysimage/index_mainbanner.jpg" // ruta o nombre de imagen 

var vel = velo
pasos = 4
var tot = 0
var tam =0;
var pos,pos2,tam2 =0;
function escribe(){
document.write ('<div id ="fuera" style="position:relative; width:' + ancho + 'px; height:' + alto + 'px;overflow:hidden">');
document.write ('<span id="imas" style="position:absolute; width:' + tam + 'px;height:' + alto + 'px; left = ' + tam + 'px;"  onmouseover="if(detienee == 0){detienee = 0}" onmouseout="clearTimeout(tiempo);detienee=0;atras = false;vel=velo;mueve()">');
for (m=0;m<imagenes.length;m++){
	document.write ('<img border="0"  src ="' + imagenes[m].src + '" id="ima' + m + '" name="ima' + m + '"  onload="tot++;">');
}
document.write ('</span>');
document.write ('<span id="imas2" style="position:absolute; width:' + tam + 'px;height:' + alto + ';left=0;"  onmouseover="if(detienee == 0){detienee = 0}" onmouseout="clearTimeout(tiempo);detienee=0;atras = false;vel=velo;mueve()">');
for (m=0;m<imagenes.length;m++){
	document.write ('<img border="0" src ="' + imagenes[m].src + '" id="imaa' + m + '" name="imaa' + m + '" onload="tot++;">');
}
document.write ('</span>');
document.write ('</div>');
}
var detienee = 0,posb,pos2b;
function mueve(){
pos = document.getElementById('imas').style.left;
pos2 = document.getElementById('imas2').style.left;
pos = pos.replace(/px/,"");
pos = pos.replace(/pt/,"");
pos = new Number(pos);
pos2 = pos2.replace(/px/,"");
pos2 = pos2.replace(/pt/,"");
pos2 = new Number(pos2);
if(detienee == 1){
	posb = pos;
	pos2b = pos2;
	}
if(atras == true){
pos+=dis;
pos2 +=dis;
}
else{
pos -= dis;
pos2 -= dis;
}
if(pos2 < (-tam - dis)){
	if(detienee == 0){
		document.getElementById('imas2').style.left = pos  + (tam - dis);
		pos2 = document.getElementById('imas2').style.left;
		}
	else{
		document.getElementById('imas').style.left = pos 
		}
	}
else{
	document.getElementById('imas').style.left = pos 
	}

if(pos < (-tam + dis)){
	if(detienee == 0){
		document.getElementById('imas').style.left = pos2 + (tam - dis);
		pos = document.getElementById('imas').style.left;
		}
	else{
		document.getElementById('imas2').style.left = pos2;
		}
	}
else{
	document.getElementById('imas2').style.left = pos2
	}
if(detienee > 0){
	if(detienee == pasos){
		vel = velo;
		atras = true;
		detienee--;
		tiempo = setTimeout('mueve()',vel);
		}
	else{
		if(atras == true){
			if(detienee>(pasos/2))
				{detienee--}
			else{
			vel = velo;
			clearTimeout(tiempo)
			}
			}
	else{
		detienee++
		}
	if(detienee > (pasos/2) && atras == false){vel +=10}
		if(detienee < (pasos/2)){vel +=10}
		tiempo = setTimeout('mueve()',vel)
		}
	}
else{
tiempo = setTimeout('mueve()',vel)
	}
if(atras == true){
		if (pos == posb){
			clearTimeout(tiempo);
			atras = false;
			}
		}
}
var tiempo;
var atras = false, ini;
function inicio(){
if(tot == (imagenes.length * 2)){clearTimeout(ini);reDimCapas();mueve()}
else{ini=setTimeout('inicio()',500)}
}
function reDimCapas(){
for(m=0;m<imagenes.length;m++){
	tam +=document.getElementById('ima'+m).width
	document.getElementById('imas').style.left = tam;
	document.getElementById('imas').style.width = tam ;
	document.getElementById('imas2').style.width = tam;
	}
}
<!-- Begin
function checkrequired(which)
{
	var pssw = ""; // variable para almacenar una variable de texto

	if (document.images)
	{
		for (i=0; i < which.length; i++)
		{
			var tempobj = which.elements[i];
		
			// Es para validar que todos los campos no estén vacios y sea correcto el email
			if (   ((tempobj.type=="text"||tempobj.type=="textarea"||tempobj.type=="password") && tempobj.value=='')    ||    ( (tempobj.name=="email") && (emailCheck(tempobj.value) == 0) )    ||    ( (tempobj.name=="email_amigo") && (emailCheck(tempobj.value) == 0) )     ) 
			{					
				shortFieldName=tempobj.name.toUpperCase();
				alert("Por favor llene correctamente el campo "+shortFieldName+".");
				return false;
			}
			
			// En caso que este bien revisamos si los passwords concuerdan...
			else
			{
				if (tempobj.name == "password")
				{
					pssw = tempobj.value;
				}
				else
				{
					if (tempobj.name == "repassword")
					{
						if (pssw != tempobj.value)
						{
							shortFieldName=tempobj.name.toUpperCase();
							alert("Su contraseña no concide con la confirmación de contraseña.");
							return false;
						}
					}
				}
			}
	 	}
	}
	return true;
}

function checkrequired_comens(which)
{
	var pssw = ""; // variable para almacenar una variable de texto

	if (document.images)
	{
		for (i=0; i < which.length; i++)
		{
			var tempobj = which.elements[i];
		
			// Es para validar que todos los campos no estén vacios y sea correcto el email
			if (   ((tempobj.type=="textarea"|| ((tempobj.type=="text")&&(tempobj.name!="email")) ) && tempobj.value=='') ) 
			{					
				shortFieldName=tempobj.name.toUpperCase();
				alert("Por favor llene correctamente el campo "+shortFieldName+".");
				return false;
			}
	 	}
	}
	return true;
}

function emailCheck (emailStr) 
{
	/* The following variable tells the rest of the function whether or not
	to verify that the address ends in a two-letter country or well-known
	TLD.  1 means check it, 0 means don't. */
	var checkTLD=1;

	/* The following is the list of known TLDs that an e-mail address must end with. */
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

	/* The following pattern is used to check if the entered e-mail address
	fits the user@domain format.  It also is used to separate the username
	from the domain. */
	var emailPat=/^(.+)@(.+)$/;	

	/* The following string represents the pattern for matching all special
	characters.  We don't want to allow special characters in the address. 
	These characters include ( ) < > @ , ; : \ " . [ ] */
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

	/* The following string represents the range of characters allowed in a 
	username or domainname.  It really states which chars aren't allowed.*/	
	var validChars="\[^\\s" + specialChars + "\]";
	
	/* The following pattern applies if the "user" is a quoted string (in
	which case, there are no rules about which characters are allowed
	and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
	is a legal e-mail address. */
	var quotedUser="(\"[^\"]*\")";
	
	/* The following pattern applies for domains that are IP addresses,
	rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
	e-mail address. NOTE: The square brackets are required. */
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	
	/* The following string represents an atom (basically a series of non-special characters.) */
	var atom=validChars + '+';
	
	/* The following string represents one word in the typical username.
	For example, in john.doe@somewhere.com, john and doe are words.
	Basically, a word is either an atom or quoted string. */
	var word="(" + atom + "|" + quotedUser + ")";
	
	// The following pattern describes the structure of the user
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	
	/* The following pattern describes the structure of a normal symbolic
	domain, as opposed to ipDomainPat, shown above. */
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	
	/* Finally, let's start trying to figure out if the supplied address is valid. */
	/* Begin with the coarse pattern to simply break up user@domain into
	different pieces that are easy to analyze. */
	var matchArray=emailStr.match(emailPat);
	if (matchArray==null)
	{
		/* Too many/few @'s or something; basically, this address doesn't
		even fit the general mould of a valid e-mail address. */
		//alert("Su Correo electrónico es incorrecto (verifique la @ y .'s)");
		return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];

	// Start by checking that only basic ASCII characters are in the strings (0-127).
	for (i=0; i<user.length; i++)
	{
		if (user.charCodeAt(i)>127)
		{
			//alert("El usuario de correo contiene caracteres inválidos.");
			return false;
	   	}
	}
	for (i=0; i<domain.length; i++)
	{
		if (domain.charCodeAt(i)>127)
		{
			//alert("El dominio de correo contiene caracteres inválidos.");
			return false;
   		}
	}

	// See if "user" is valid 
	if (user.match(userPat)==null)
	{
		// user is not valid
		//alert("El usuario de correo parece ser inválido.");
		return false;
	}

	/* if the e-mail address is at an IP address (as opposed to a symbolic
	host name) make sure the IP address is valid. */
	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null)
	{
		// this is an IP address
		for (var i=1;i<=4;i++)
		{
			if (IPArray[i]>255)
			{
				//alert("La dirección IP destino es inválida");
				return false;
			}
		}
		return true;
	}

	// Domain is symbolic name.  Check if it's valid.
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++)
	{
		if (domArr[i].search(atomPat)==-1)
		{
			//lert("El nombre de dominio no parece ser válido.");
			return false;
		}
	}

	/* domain name seems valid, but now make sure that it ends in a
	known top-level domain (like com, edu, gov) or a two-letter word,
	representing country (uk, nl), and that there's a hostname preceding 
	the domain or country. */
	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1)
	{
		//alert("La dirección de correo debe terminar en con un dominio conocido o con dos letras" + "pais.");
		return false;
	}

	// Make sure there's a host name preceding the domain.
	if (len<2)
	{
		//alert("La dirección de correo no pertenece a ningun host");
		return false;
	}

	// If we've gotten this far, everything's valid!
	return true;
}
//  End -->

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
-->
}

  function mOvr(src,clrOver) {
    if (!src.contains(event.fromElement)) {
	  src.style.cursor = 'hand';
	  src.bgColor = clrOver;
	}
  }
  function mOut(src,clrIn) {
	if (!src.contains(event.toElement)) {
	  src.style.cursor = 'default';
	  src.bgColor = clrIn;
	}
  }
  function mClk(src) {
    if(event.srcElement.tagName=='TD'){
	  src.children.tags('A')[0].click();
    }
  }
  function cambiardisplay(elId){
	if (document.getElementById(elId).style.display == 'none') {
		document.getElementById(elId).style.display = 'block';
	} else { document.getElementById(elId).style.display = 'none' }
  }
// -->	