// JavaScript Document<script type="text/javascript">

/* Agregar a Favoritos */
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}
/* Agregar a Favoritos  */

/*Protege Robo de Imagenes*/
function protect(e) {
alert("Lo sentimos, la imagenes estan protegidas.");
return false;
}

function trap() {
if(document.images)
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown = protect;
}
/*Protege Robo de Imagenes*/

/*Ver y Ocultar*/
    function verocultar(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
          e.style.display = 'block';
    }
/*Ver y Ocultar*/

/**/
function lookup(inputString) {
		if(inputString.length == 0) {
			// Hide the suggestion box.
			$('#suggestions').hide();
		} else {
			$.post("inc/rpc.php", {queryString: ""+inputString+""}, function(data){
				if(data.length >0) {
					$('#suggestions').show();
					$('#autoSuggestionsList').html(data);
				}
			});
		}
	} // lookup
	
	function fill(thisValue) {
		$('#inputString').val(thisValue);
		setTimeout("$('#suggestions').hide();", 200);
	}
	
	
	//Funcion para el Rut
function Text1_onclick() {
    rut = document.getElementById('rut').value;
    document.getElementById('dv').value = dv(rut);
}

function Text2_onclick() {
    rut1 = document.getElementById('rutemp').value;
    document.getElementById('dv1').value = dv1(rut1);
}
function dv(T){var M=0,S=1;for(;T;T=Math.floor(T/10))
S=(S+T%10*(9-M++%6))%11;return S?S-1:'K';}

function dv1(T){var M=0,S=1;for(;T;T=Math.floor(T/10))
S=(S+T%10*(9-M++%6))%11;return S?S-1:'K';}
