<!--
var PageLoaded=false;
function What_Browser()
{
	var Browser = navigator.appName;
	var Version = navigator.appVersion;
	var Platform = navigator.platform;
	// Determina el nombre del BROWSER
	if (Browser == "Netscape" ) { this.name = "NS"
	} else {
	if (Browser == "Microsoft Internet Explorer" ) { this.name = "IE"
	} else { this.name = Browser } }
	this.version = parseInt( navigator.appVersion );
	this.NS = (this.name =="NS" && this.version >=4 )
	this.NS4 = (this.name=="NS" && this.version ==4)
	this.NS5 = (this.name=="NS" && this.version >=5)
	this.IE = (this.name=="IE" && this.version >=4)
	this.IE4 = (Version.indexOf('MSIE 4')>0)
	this.IE5 = (Version.indexOf('MSIE 5')>0)                
	
	if (this.NS5) {this.name="IE"; this.NS=false;this.IE=true; this.IE5=true}
	
	this.platform = Platform;
	
}
// Determinamos el Navegador
var BW = new What_Browser();
// Buscar Todas las Capas e inicializarlas
function initObject(id,nestref)
{
	// Si es Netscape
	if (BW.NS)
	{
		if (BW.NS)
		{
			if (!nestref) var nestref = initObject.nestRefArray[id]
			this.css = (nestref)? eval("document."+nestref+".document."+id) : document.layers[id]
			this.elm = this.event = this.css
			this.doc = this.css.document
		}
		if (BW.NS5)
		{
			this.elm = document.getElementById(id)
			this.css = this.elm.style
			this.doc = document
		}
		this.x = this.css.left
		this.y = this.css.top
		this.width = this.css.clip.width
		this.height = this.css.clip.height
	}
	else if (BW.IE)
	{
		this.elm = this.event = document.all[id]
		this.css = document.all[id].style 
		this.doc = document
		this.x = this.elm.offsetLeft
		this.y = this.elm.offsetTop
		this.width = this.elm.scrollWidth
		this.height = this.elm.scrollHeight
	}
	this.id = id
	this.name = id.substr(0,id.indexOf("Div"));
	this.moveTo = moveTo
	this.moveBy = moveBy    
	this.show = LayerShow
	this.hide = LayerHide
	this.IScrossObject = crossObject
	this.LayerWrite = LayerWrite
	this.ISclip = determineClip
	this.LoadCapable = LoadCapable
	this.changeImg = ChangeImg
	// this.ISscroll = ISscroll
	this.setBGColor = setBGColor
	// this.scrollH = scrollH
	this.getHeight = getHeight
	this.getDimensions = getDimensions
	//alert(this.name+','+this.width+','+this.css.pixelWidth+','+this.elm.offsetWidth);	
}

// FUNCIONES CLIP
function determineClip()
{
	if (BW.IE)
	{
		if (this.css.clip && this.css.clip!='auto')
		{
			var clip = this.css.clip.split("rect(")[1].split(")")[0].split("px")
			this.clipx=parseInt(clip[3])
			this.clipy=parseInt(clip[0])
			this.clipxx=parseInt(clip[1])
			this.clipyy=parseInt(clip[2])
		} else {
			this.clipx=0
			this.clipy=0
			this.clipxx=0
			this.clipyy=0
		}
		
	}
	if (BW.NS)
	{
		this.clipx=parseInt(this.css.clip.left);
		this.clipy=parseInt(this.css.clip.top);
		this.clipxx=parseInt(this.css.clip.right);
		this.clipyy=parseInt(this.css.clip.bottom);
	}
	this.clipTo = clipTo
	this.clipBy = clipBy
	this.clipCross = clipCrossInit
	this.clipCrossFn = clipCrossFn
	if (BW.platform=='MacPPC' && BW.IE){this.clipTo(0,0,0,0)}
}                                       

function clipTo(x,y,x1,y1)
{
	if (x==null){x=this.clipx}
	if (y==null){y=this.clipy}
	if (x1==null){x1=this.clipxx}
	if (y1==null){y1=this.clipyy}
	if(BW.IE)
	{
		var rectstr = "rect("+y+"px "+x1+"px "+y1+"px "+x+"px)";
		this.css.clip = rectstr;
		if (BW.platform=='MacPPC' && BW.IE)
		{
			this.hide();this.show();
			
		}
	} 
	if(BW.NS)
	{
		this.css.clip.left = x;
		this.css.clip.right = x1;
		this.css.clip.top = y;
		this.css.clip.bottom = y1;
	}
	this.clipx=x
	this.clipy=y
	this.clipxx=x1
	this.clipyy=y1
}                                                       

function clipBy(x,y,x1,y1)
{
	if (x==null){x=0}
	if (y==null){y=0}
	if (x1==null){x1=0}
	if (y1==null){y1=0}
	this.clipTo((this.clipx+(x)), (this.clipy+(y)), (this.clipxx+(x1)), (this.clipyy+(y1)));
}

function clipCrossInit(x,y,x1,y1,steps,fn)
{
	if(!fn) fn='';
	fn = escape(fn);
	IncX = (this.clipx-x)/steps
	IncXX = (x1-this.clipxx)/steps
	InitialX = this.clipx
	InitialXX = this.clipxx
	IncY = (this.clipy-y)/steps
	IncYY = (y1-this.clipyy)/steps
	InitialY = this.clipy
	InitialYY = this.clipyy
	actualStep=0;
	this.clipCrossFn(IncX,IncXX,InitialX,InitialXX,IncY,IncYY,InitialY,InitialYY,steps,actualStep,fn)
}

function clipCrossFn(IncX,IncXX,InitialX,InitialXX,IncY,IncYY,InitialY,InitialYY,steps,actualStep,func)
{
	if (actualStep<=steps)
	{
		PosX = Math.round(InitialX-(IncX*actualStep))
		PosXX = Math.round(InitialXX+(IncXX*actualStep))
		PosY = Math.round(InitialY-(IncY*actualStep))
		PosYY = Math.round(InitialYY+(IncYY*actualStep))
		//alert(this.name+'.clipTo('+PosX+','+PosY+','+PosXX+','+PosYY+')');
		eval(this.name+'.clipTo('+PosX+','+PosY+','+PosXX+','+PosYY+')');
		actualStep++
		var fn = this.name+'.clipCrossFn('+IncX+','+IncXX+','+InitialX+','+InitialXX+','+IncY+','+IncYY+','+InitialY+','+InitialYY+','+steps+','+actualStep+',\''+func+'\')'
		setTimeout(fn,50);
	} else { eval(unescape(func)) }
}
// FUNCTIONES MOVIMIENTO
// .moveTo(x,y)
// .moveBy(x,y)
// Funciones Tipo Cross
// inicializar como Obj.crossObject();
// .crossTo (x,y) Desplaza hasta x,y
// .crossBy (x,y) Desplaza incrementando x e y

function moveTo(x,y)
{ 
	if (x=='null') { x = this.x }
	if (y=='null') { y = this.y }
	this.x = x;
	this.y = y;
	this.css.left = x;
	this.css.top = y;
}

function moveBy(x,y)
{
	if (x=='null') { x = 0 }
	if (y=='null') { y = 0 }
	this.moveTo(this.x+x, this.y+y);
}                                               


function crossObject()
{
	this.crossTo = crossTo
	this.crossFn = crossFn
	this.crossBy = crossBy
}

function crossBy(x,y,inc,speed)
{
	this.crossTo(this.x+x, this.y+y,inc,speed);
}

function crossTo(x,y,inc,speed,func)
{
	if(!func) func='';
	if (!inc) inc=10;
	if (!speed) speed=20;
	var Xinitial = this.x;
	var Yinitial = this.y;
	// calculo vector Desplazamiento
	var Xfinal = (x)-(Xinitial);
	var Yfinal = (y)-(Yinitial);
	// calculo Modulo vector resultante / incremento que nos da el num;
	var Num = Math.sqrt( Math.pow(Xfinal,2) + Math.pow(Yfinal,2) ) / inc;
	var incX = Xfinal/Num;
	var incY = Yfinal/Num;
	var crossToNum = Num;
	var ToExe = escape(func);
	var fn = this.name+'.crossFn(' + x + ',' + y + ',' + incX + ',' + incY + ',' + crossToNum + ', 0 ,' +  speed + ',\''+ToExe+'\')';
	setTimeout(fn,speed);
}

function crossFn(x, y, incX, incY, crossToNum, crossToAt, speed ,func)
{
	if (crossToAt < crossToNum-1)
	{
		this.moveBy(incX, incY);
		crossToAt++
		var fn = this.name+'.crossFn(' + x + ',' + y + ',' + incX + ',' + incY + ',' + crossToNum + ','+ crossToAt +',' +  speed + ',\''+func+'\')';
		setTimeout(fn,speed); } else { this.moveTo(x,y); eval(unescape(func));
	}
}
// FUNCIONES PARA MOSTRAR OCLUTAR CAPAS
// .show()
// .hide()
function LayerShow()
{
	this.css.visibility = (BW.NS)? "show" : "visible";
	this.visibility='show';
}
        
function LayerHide()
{
	this.css.visibility = (BW.NS)? "hide" : "hidden" 
	this.visibility='hide';
}

// funcion que cambia una imagen en un layer
function ChangeImg(name,img)
{
	if (BW.NS){ this.css.document.images[name].src = img; }
	if (BW.IE){ document.images[name].src = img;}
}
// FUNCION PARA CAMBIA COLOR DE FONDO

function setBGColor(color)
{
	if (BW.NS)
	{
		this.css.bgColor = color
	}
	if (BW.IE)
	{
		this.css.backgroundColor = color
	}
}
// Funcion write en Capas
// .LayerWrite(texto o HTML)										
function LayerWrite(str,style,mode)
{
	// substituir espacios por &nbsp;
	if (mode)
	{
		re = / /g;
		str=str.replace(re, '&nbsp;');
	}
	if (style){str='<span class="'+style+'">'+str+'</span>';}	
	if (BW.NS)
	{
		this.doc.open();
		this.doc.write(str);
		this.doc.close();
	}
	if (BW.IE)
	{
		this.event.innerHTML = str
	}
	if (BW.NS){	this.width = this.css.document.width;}
	if (BW.IE) {this.width = this.elm.scrollWidth;}
}

function InitLayers(nestref)
{
        // if (!DynLayer.set) DynLayer.set = true
        // Si es Netscape
	if (document.all) for (var i in document.links) { document.links[i].onfocus = document.links[i].blur; }
		
	if (BW.NS)
	{
		if (nestref) {index = eval('document.'+nestref+'.document')} else {nestref = ''; index = document;}
		for (var i=0; i<index.layers.length; i++)
		{
			var layername = index.layers[i].name
			initObject.nestRefArray[layername] = nestref
			var isDynamic = layername.indexOf("Div")
			// Si la Capa Contiene el texto Div
			if (isDynamic > 0) { eval(layername.substr(0,isDynamic)+' = new initObject("'+layername+'","'+nestref+'")') }
			if (index.layers[i].document.layers.length > 0) {initObject.refArray[initObject.refArray.length] = (nestref=='')? index.layers[i].name : nestref+'.document.'+index.layers[i].name }
		}
		// Si existen capas Acomodadas
		if (initObject.refArray.i < initObject.refArray.length) { InitLayers(initObject.refArray[initObject.refArray.i++])      }
	} else { 
		// Si es Explorer
	if (BW.IE)
	{
		for (var i=0; i<document.all.tags("DIV").length; i++) {
		var divname = document.all.tags("DIV")[i].id
		var isDynamic = divname.indexOf("Div")
		// Si la Capa Contiene el texto Div                     
		if (isDynamic > 0) {eval(divname.substr(0,isDynamic)+' = new initObject("'+divname+'")')}
	}
	}
        return true;
}}
initObject.nestRefArray = new Array()
initObject.refArray = new Array()
initObject.refArray.i = 0
initObject.set = false 
initObject.bufferCount = 0;
initObject.bufferObjName = new Array();

// funcines para calculo de altura
// getHeight(obj) retorna la altura del Objeto
function getHeight(obj)
{
	if (BW.NS){	this.height = this.css.document.height;}
	if (BW.IE) {this.height = this.elm.scrollHeight;}
			
}

function getDimensions()
{
	if (BW.NS){	this.height = this.css.document.height; this.width = this.css.document.width;}
	if (BW.IE) {this.height = this.elm.scrollHeight; this.width = this.elm.scrollWidth;}

}
// Funciones Para Craga de paginas eXternas
function LoadCapable()
{
	this.load = load;
	this.finishLoad = false;
	this.bufferCount = initObject.bufferCount++;
	if (BW.IE)
	{
		// Ponemos el codigo del iframe necesario 
		// document.write('<IFRAME STYLE="display:none" NAME="bufferFrame'+this.bufferCount+'"></IFRAME>');
		document.body.insertAdjacentHTML("BeforeEnd",'<IFRAME STYLE="position:absolute; left:0; top:0; width:0; height:0; clip:rect(0,0,0,0);" width=1 height=1 NAME="bufferFrame'+this.bufferCount+'"></IFRAME>');
	}
	// asignamos el objeto al buffer para despues saber cual es			
	initObject.bufferObjName[this.bufferCount]=this;
}


function load(url)
{
// Si no existe el objecto historia...
	if (!this.history)
	{
		this.history = new Array();
		this.history.pos = 0;
		this.history.len = 0;
		this.url = (url)? url : '' 
		this.gotu = HistoryGo
	}
		this.history[this.history.len] = url;
				if (BW.NS)
				{
					if (!load.Loading)
						{	
							load.Loading=true;
							this.css.load(url,this.css.width);
							this.history.pos+=1;
						}else{
							Load = this.name+'.load("'+url+'")'; setTimeout (Load,50);
							}
					}
		if (BW.IE)
		{ 
		if (!load.Loading)
						{
						load.Loading=true;
						if (top.Content)
						{
							eval('parent.Content.bufferFrame'+this.bufferCount+'.document.location = url'); 
						} else
						{
							eval('parent.bufferFrame'+this.bufferCount+'.document.location = url');
						} 
						this.history.pos+=1;
						this.history.len+=1;
						}else{
							Load = this.name+'.load("'+url+'")'; setTimeout (Load,50);
							}
		}
	return true;	 
}
load.Loading=false;
function HistoryGo(x)
{ 
	var toGo = this.history.pos+x;
	this.history.len=toGo;
	var start = (x==0 && this.history[0]!='')? 0:1
	if (x>=start && x< this.history.length)
	{
		this.load( this.history[this.history.length+x] )
	}
	this.load( this.history[toGo] )
	this.history.pos = toGo
}

function loaded(x,fn)
{

	if (BW.IE)
	{
		if (top.Content)
		{
			var buffer = 'parent.Content.bufferFrame'+x+'.document.body.innerHTML'; 
		} else { 
			var buffer = 'parent.bufferFrame'+x+'.document.body.innerHTML';
		}
		initObject.bufferObjName[x].elm.innerHTML = eval(buffer); 
	}
	load.Loading=false;
	eval(fn);
	
}

function BrowserDimensions()
{
	document.winW = (BW.NS4)? window.innerWidth : document.body.offsetWidth-6;
	document.winH = (BW.NS4)? window.innerHeight : document.body.offsetHeight-16;
}

function newLayer(id,nestref,x,y,html,w,h,bgColor,visibility,zIndex){
	if (BW.NS) {
		if (nestref)
		{
			var lyr = eval("document."+nestref+".document."+id+" = new Layer(w, document."+nestref+")")
			eval("document."+nestref+".document."+id+" = lyr")
		} else 
		{
			var lyr = document.layers[id] = new Layer(w)
			eval("document."+id+" = lyr")
		}
		lyr.name = id
		lyr.left = x
		lyr.top = y
		if (h!=null) lyr.clip.height = h
		if (bgColor!=null && bgColor!='null') {lyr.bgColor = bgColor}
		lyr.visibility = 'show'
		if (zIndex!=null) lyr.zIndex = zIndex
		if (html)
		{
			lyr.document.open()
			lyr.document.write(html)
			lyr.document.close()
		}
	}

	else if (BW.IE)
	{
		var str = '\n<DIV ID="'+id+'" style="position:absolute; left:'+x+'; top:'+y+'; width:'+w
		if (h!=null)
		{
			str += '; height:'+h
			str += '; clip:rect(0,'+w+','+h+',0)'
		}
		if (bgColor!=null) str += '; background-color:'+bgColor		
		if (zIndex!=null) str += '; z-index:'+zIndex
		if (visibility) str += '; visibility:'+visibility
		str += ';">'+((html)?html:'')+'</DIV>'
		if (nestref)
		{
			index = nestref.lastIndexOf(".")
			var nestlyr = (index != -1)? nestref.substr(index+1) : nestref
			document.all[nestlyr].insertAdjacentHTML("BeforeEnd",str);
		}
		else
		{ 
			document.body.insertAdjacentHTML("BeforeEnd",str);
		}
	}	
}

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 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];}}
}



//-->

String.prototype.isEmail = function()
{

	//email address has to have at least 5 chars
	if (this.length < 5)
	{
		return false;
	}

	var iChars = "*|,\":<>[]{}`';()&$#%";
	var eLength = this.length;

	for (var i=0; i < eLength; i++)
	{
		if (iChars.indexOf(this.charAt(i)) != -1)
		{
			//trace("Invalid Email Address : Illegal Character in Email Address : -->" + this.charAt(i) + "<--.");
			return false;
		}
	}

	var atIndex = this.lastIndexOf("@");
	if(atIndex < 1 || (atIndex == eLength - 1))
	{
		//trace("Invalid Email Address : Email Address must contain @ as at least the second chararcter.");
		return false;
	}

	var pIndex = this.lastIndexOf(".");
	if(pIndex < 4 || (pIndex == eLength - 1))
	{
		//trace("Invalid Email Address : Email Address must contain at least one . (period) in a valid position");
		return false;
	}

	if(atIndex > pIndex)
	{
		//this.__error = "Invalid Email Address : Email Address must be in the form of name@domain.domaintype";
		return false;
	}

	return true;
}
