//=========================================
//== Creado por: Francisco Gonzalez Muñoz==
//== Fecha: 31/07/2003                   ==
//== Funciones Globales Para Validacion  ==
//=========================================

//=== Redirecciona a Pagina que se indique en el menu ==
function LocationHref(objURL){
	var strURL = objURL;
	var newWindows = true;
	location.href = strURL;
	}
//== Crea efecto de mouse over sobre menu Horizontal ===
function over_btn(obj, btn){
	obj.src="img/btn_"+ btn +"Over.gif"
	}
//== Restablece imagen de menu HOrizontal cuando sale el mouse ===
function out_btn(obj, btn){
	obj.src="img/btn_"+ btn +".gif"
	}
//== Envia a pagina que indique el Btn del menu horizontal ===
function click_btn(pag){
	location.href=pag+".asp"
	}
	
//=== Entrega Digito Verificador del Rut Ingresado ===
function valRut(sRut){
	var i
	var nLargo
	var nSuma
	var nPosLetra
	var nAux
	var sRutAux
	var nMul
	var sDig
	var nResto
	var bPaso;
	
	sDig="";
	sRutAux = sRut.value;
	nLargo = sRutAux.length;
	nPosLetra = 0;
	nPosLetra = nLargo;
	nResto = 0;
	nSuma = 0;
	nMul = 2;
	nAux = 0;
	bPaso = 0;
	bPaso = sRutAux * 1
	
	if ((sRutAux != "") && (sRutAux != 0) && (!isNaN(bPaso))){
		for(i=1;(i<=nLargo);i++){
			nAux = sRutAux.substring(nPosLetra-1, nPosLetra)
			nSuma += (parseInt(nAux) * nMul);
			if (nMul >= 7){
				nMul=2
				}
			else{
				nMul++
				}
			nPosLetra = nPosLetra - 1
			}
		nResto =  nSuma % 11
		if(nSuma==1){
			sDig = "K"
			}
		else if(nSuma==0){
			sDig = 0
			}
		else{
			sDig = 11 - nResto
			}
		return sDig;
		}
	else{
		sRut.value="";
		return "";
		}	
	}
	
//==== Despues se Puede Ocupar =====================================================	
//==== Carga una página en una nueva ventana o en la misma =========================
//function LocationHref(objURL){
//	var strURL = objURL;
//	var newWindows = true;
	
//	if(strURL.substring(0,3).toLowerCase() == "../" && strURL.toLowerCase().indexOf("uf/ufdiaria.asp") == -1 && strURL.toLowerCase().indexOf("uf/ufanual.asp") == -1) newWindows = false;

			
//	if(strURL.toLowerCase().indexOf("mailto") != -1) newWindows = false;
	
//	if(newWindows){
//==== Abre una nueva Ventana
//		var PxHeight = screen.height - 220;
//		var PxWidth  = screen.width - 50;
		
//		if(strURL.toLowerCase() != "telefonos/index.asp")
//			window.open(strURL,"","height=" + PxHeight + ",width=" + PxWidth + ",left=17,top=23,directories=0,toolbar=1,menubar=1,resizable=1,scrollbars=yes,status=1,titlebar=1,copyhistory=1,location=1");
//		else
//			window.open(strURL,"","height=" + PxHeight + ",width=" + PxWidth + ",left=17,top=80,directories=0,toolbar=0,menubar=0,resizable=1,scrollbars=yes,status=1,titlebar=0,copyhistory=0,location=0");
	
//	}else{
//==== Carga en la misma ventana
//		location.href = strURL;
//	}	
//}


function lib_bwcheckII(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bwII=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
//var bwII=new lib_bwcheckII()


/*

*/
/*****************

You set the width and height of the divs inside the style tag, you only have to
change the divScrollTextCont, Remember to set the clip the same as the width and height.
You can remove the divUp and divDown layers if you want. 
This script should also work if you make the divScrollTextCont position:relative.
Then you should be able to place this inside a table or something. Just remember
that Netscape crash very easily with relative positioned divs and tables.

Updated with a fix for error if moving over layer before pageload.

****************/


//If you want it to move faster you can set this lower, it's the timeout:
//var speed = 30

//Sets variables to keep track of what's happening
//var loop, timer

//Object constructor
function makeObjII(obj,nest){
    nest=(!nest) ? "":'document.'+nest+'.'
	this.el=bwII.dom?document.getElementById(obj):bwII.ie4?document.all[obj]:bwII.ns4?eval(nest+'document.'+obj):0;
  	this.css=bwII.dom?document.getElementById(obj).style:bwII.ie4?document.all[obj].style:bwII.ns4?eval(nest+'document.'+obj):0;
	this.scrollHeight=bwII.ns4?this.css.document.height:this.el.offsetHeight
	this.clipHeight=bwII.ns4?this.css.clip.height:this.el.offsetHeight
	this.up=goUp;this.down=goDown;
	this.moveIt=moveIt; this.x=0; this.y=0;
    this.obj = obj + "Object"
    eval(this.obj + "=this")
    return this
}

// A unit of measure that will be added when setting the position of a layer.
//var px = bwII.ns4||window.opera?"":"px";

function moveIt(x,y){
	this.x = x
	this.y = y
	this.css.left = this.x+px
	this.css.top = this.y+px
}

//Makes the object go up
function goDown(move){
	if (this.y>-this.scrollHeight+oCont.clipHeight){
		this.moveIt(0,this.y-move)
			if (loop) setTimeout(this.obj+".down("+move+")",speed)
	}
}
//Makes the object go down
function goUp(move){
	if (this.y<0){
		this.moveIt(0,this.y-move)
		if (loop) setTimeout(this.obj+".up("+move+")",speed)
	}
}

//Calls the scrolling functions. Also checks whether the page is loaded or not.
function scroll(speed){
	if (scrolltextLoaded){
		loop = true;
		if (speed>0) oScroll.down(speed)
		else oScroll.up(speed)
	}
}

//Stops the scrolling (called on mouseout)
function noScroll(){
	loop = false
	if (timer) clearTimeout(timer)
}
//Makes the object
//var scrolltextLoaded = false
function scrolltextInit(){
	oCont = new makeObjII('divScrollTextCont')
	oScroll = new makeObjII('divText','divScrollTextCont')
	oScroll.moveIt(0,0)
	oCont.css.visibility = "visible"
	scrolltextLoaded = true
}
//Call the init on page load if the browser is ok...
//if (bwII.bwII) onload = scrolltextInit

/***************
Multiple Scripts
If you have two or more scripts that use the onload event, probably only one will run (the last one).
Here is a solution for starting multiple scripts onload:
   1. Delete or comment out all the onload assignments, onload=initScroll and things like that.
   2. Put the onload assignments in the body tag like in this example, note that they must have braces ().
   Example: <body onload="initScroll(); initTooltips(); initMenu();">
**************/

function makeArray(n)
{
  this.length = n;
  for (i=0; i<n; i++) this[i]="";
}

str = "Partner Consulting Ltda.";
blnk = " ";
str += blnk;
mcnt = 0;
msg = "";
stcnt=0;

function wiper()
{
   stcnt++;
   if (stcnt>3)
      {
        stcnt = 0;
        msg += str.substring(mcnt,mcnt+1);
        mcnt++;
        if (mcnt >= str.length) { mcnt=0; msg=""; }
      }

    csr = " ";
    if (stcnt & 1) csr ="_";
    window.status = msg+csr;
    timeID = window.setTimeout("wiper()",40);
}

wiper();