﻿var urlweb = "http://www.quecontactos.com/";

temp_idu = 1;
var validarformulariocount = 1;
function comenzando() {
    if (document.getElementById("dlSexo").value == "")
        ErrorMensaje("dlSexo", "diverrSex");
    else {
        document.location.href = urlweb+"p_co.aspx?u=" + document.getElementById("dlSexo").value;
    }
}
function Registrate() {
  document.location.href = urlweb+"register.aspx";
}
function get_pos_X(element) {
	var current_left = 0;
	
	if (element.offsetParent) {
		while (element.offsetParent) {
			current_left += element.offsetLeft
			element = element.offsetParent;
		}
	} else if (element.x)
		current_left += element.x;
	
	return current_left ;
}
function get_pos_Y(element) {
	var current_top = 0;
	
	if (element.offsetParent) {
		while (element.offsetParent) {
			current_top += element.offsetTop
			element = element.offsetParent;
		}
	} else if (element.y)
		current_top += element.y;
	
	return current_top;
}
function ErrorMensaje(origen,capa)
{
    var textbox = document.getElementById(origen);
    var selectbox = document.getElementById(capa);
    selectbox.style.display = '';
    selectbox.style.position = 'absolute';
    selectbox.style.left = get_pos_X(textbox) + document.getElementById(origen).offsetWidth +10 + 'px';
    selectbox.style.top = (get_pos_Y(textbox) ) + 'px';
    selectbox.style.display='inline';
}
function ERRORusupass()
{
    var textbox = document.getElementById("txtUsuarioRegistrado");
    var selectbox = document.getElementById("diverrRegUP");
    selectbox.style.left = get_pos_X(textbox)  -120 + 'px';
    selectbox.style.top = (get_pos_Y(textbox) +38) + 'px';
    selectbox.style.position = 'absolute';
    selectbox.style.display='inline';
}
function CarProhibidos()
{ 
    var intTecla = event.keyCode; 
    var sLetra = String.fromCharCode(intTecla).toUpperCase();
    var sNoPermitidos = "&¿?#·|'%*<>\"";
    if(sNoPermitidos.indexOf(sLetra) != -1) 
        return false;
}

function trimjs(texto){
	if (texto.length == 1 && texto.charCodeAt(0) == 160) texto = '';
	texto = texto.replace (/^\s*/,'').replace(/\s*$/,'').replace(" ","");
	return(texto);
}