// JavaScript Document

// Foco
// objeto = form1.textfield
function Focus ( objeto )
{
	//objeto.focus();
	var param;
	param = ("document.getElementById('" + objeto + "').focus();");
	setTimeout(param,1); 
}

// Abrir ventana, se utiliza para los pop-up desde flash
function MM_openBrWindow ( theURL,winName,features )
{ //v2.0
  window.open(theURL,winName,features);
}

// Abrir flash
// nombreArchivoSwf = 'intro.swf'
// width  = valor en píxeles
// height   = valor en píxeles
// windowMode = 'transparent' o 'window'
function Run( nombreArchivoSwf, width, height, windowMode )
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + width + '" height="' + height + '">')
	document.write('<param name="movie" value="' + nombreArchivoSwf + '">')
	document.write('<param name="quality" value="high">')
	document.write('<param name="wmode" value="' + windowMode + '">')
	document.write('<embed src="' + nombreArchivoSwf + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" wmode="' + windowMode + '"></embed>')
	document.write('</object>')
}

// Chequeo de Fechas Válidas (invocar función "isDate")
// var dt=document.form1.Fecha
// if ( isDate(dt.value) == false ){ }

// Declaración de caracter de fecha válido, año mínimo y máximo.
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Chequear si el caracter actual es un número.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // Todos los caracteres son números.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Buscar en todos los caracteres del string uno a uno
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// Febrero tiene 29 días en todos los años divisibles por 4, 
    // EXCEPTO por aquellos que no son divisibles por 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}

function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strDay=dtStr.substring(0,pos1)
	var strMonth=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		alert("El formato de fecha debe ser: DD/MM/AAAA")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Por favor, ingrese un mes válido.")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Por favor, ingrese un día válido.")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Por favor, ingrese un año válido de 4 dígitos entre "+minYear+" y "+maxYear+".")
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Por favor, ingrese una fecha válida.")
		return false
	}
return true
}

// XML HTTP
var xmlhttp
var whichId
function loadXMLDocT(url,id)
{
	loadXMLDoc(url,id,true)
}

function loadXMLDocF(url,id)
{
	loadXMLDoc(url,id,false)
}

function loadXMLDoc(url,id,sync)
{
	xmlhttp = null
	whichId = id
	// Mozilla, etc.
	if (window.XMLHttpRequest)
	{
		xmlhttp=new XMLHttpRequest()
	} else if (window.ActiveXObject)
	{ // IE
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	if (xmlhttp!=null)
	{
		// especificación de la función que se ejecuta 
		// CADA VEZ que readyState cambia de valor:
		xmlhttp.onreadystatechange = state_Change
		xmlhttp.open("GET",url,sync)
		xmlhttp.send(null)
	} else {
		alert("Your browser does not support XMLHTTP.")
	}
}
// función que se ejecuta CADA VEZ que readyState cambia de valor:
function state_Change()
{
	if (xmlhttp.readyState==4)
	{ // if xmlhttp shows "loaded"
		if (xmlhttp.status==200)
		{ // if "OK"
			document.getElementById(whichId).innerHTML = xmlhttp.responseText
			//document.getElementById(whichId).innerHTML = xmlhttp.responseXML
		} else {
			alert("Problem retrieving data")
		}
	}
}
<!-- Begin
function moveimg(img_name,img_src) {
document[img_name].src=img_src;
}
// End -->
