function mostrarProgresoForm(){
	cuenta=0;
	totalApartados=0;
	
		cuenta += (MM_findObj('catego').value==3) ? 1 : 0;
		cuenta += (MM_findObj('TipoVentaVehiculo').value=='NU') ? 1 : 0;
		cuenta += (MM_findObj('annosSinPartes').value==-1) 
					? 2 : (MM_findObj('annosSinPartes').value==0)
					? 0 : (MM_findObj('annosSinPartes').value==6)
					? 2 : 1;
		cuenta += (MM_findObj('conductorOcasional').value=='N') ? 4 : 0;
		cuenta += (MM_findObj('CodCompaniaAnterior').value=='noComp') ? 4 : 0;	
		
	for(k=0;k<apartados.length;k++){
		frm=apartados[k].formulario;
		for(n=0;n<frm.length;n++){
			totalApartados++;
			if(frm[n].valor!='') cuenta++;	
		}
	}

	if(document.all) top.document.getElementById("cuentaK").moverFlecha(cuenta, totalApartados-1);
	else 
	{
	    try{
	        MM_findObj("cuentaK", top.document).moverFlecha(cuenta, totalApartados-1);
	    }catch(ex){}
	}
	
}

function finalizarProgresoForm(){
	if(document.all) 
	    top.document.getElementById("cuentaK").moverFlecha(100, 100);
	else 
	    MM_findObj("cuentaK", top.document).moverFlecha(100, 100);
}

function redimensionar(){

/*    
    if(document.getElementById("css")!=null 
        && document.getElementById("css").value == "tarifika" 
        && document.getElementById("css").value.toLowerCase() == "bestcredit"){
        var actualHeight = getBodyHeight();
        //var frame=parent.document.getElementById("iframeTarificador");
        //var frame=parent.frames[0];
        //frame.height = actualHeight;
        
        parent.frames[0].window.frameElement.height = actualHeight+" px";
        
    }  
*/

}

function getBodyHeight()
{

    var height = "480px";
    var scrollHeight;
    var offsetHeight;

    if (document.height)
    {
        height = document.height;
    }
    else if (document.body)
    {
        if (document.body.scrollHeight)
        {
            height = scrollHeight = document.body.scrollHeight;
        }
        if (document.body.offsetHeight)
        {
            height = offsetHeight = document.body.offsetHeight;
        }

        if (scrollHeight && offsetHeight)
        {
            height = Math.max(scrollHeight, offsetHeight);
        }
    }

    return height;
    
}


// ************************************************************
// Validaciones generales
//     
var nav4 = window.Event ? true : false;

function soloNumeros(evt)
{
    // Espacio = 8, Enter = 13, '0' = 48, '9' = 57
    var key = (nav4 && evt.which) ? evt.which : evt.keyCode;
    return (key <= 13 || (key >= 48 && key <= 57));
}

function soloLetras(evt)
{
    // Espacio = 8, Enter = 13, '0' = 48, '9' = 57, 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122 
    var key = nav4 ? evt.which : evt.keyCode;
    return (key <= 13 || (key >= 48 && key <= 57) || (key >= 65 && key <= 90) || (key >= 97 && key <= 122)  );
}



/**/


function getArrayRequest(url)
{
	var splitSrc = url.split('?');
	var queryS = (splitSrc.length>1)?splitSrc[1]:"";

    var arrayQueryS = new Array();
    var splitQueryS = queryS.split('&');
    for(var a=0;a<splitQueryS.length;a++)
    {
        var sP = splitQueryS[a].split('=');
        arrayQueryS.push({
                            value: sP[0],
                            label: sP[1]
                         });
    }
    
    return arrayQueryS;

}
function getValor(array,value){

    for(var a=0;a<array.length;a++){
        if(array[a].value==value)
            return array[a].label;
    }

}

   
function cambiarColorFont(elem,color)
{
    elem.style.color = color;
}


//modifica una propiedad de una clase de estilos

function devolverPropiedadCss(regla,propi) 
{
    if(document.styleSheets.length>0)
    {
        if (document.all)
            miRegla = document.styleSheets[0].rules;
        else
            miRegla = document.styleSheets[0].cssRules;
        
        for (i=0; reg=miRegla[i]; i++){
            if (reg.selectorText.toLowerCase() == regla.toLowerCase() )
                return reg.style[propi];
        }
    }
}
function cambiarPropiedadCss(regla,propi,valor) 
{
    if(document.styleSheets.length>0)
    {
        if (document.all)
            miRegla = document.styleSheets[0].rules;
        else
            miRegla = document.styleSheets[0].cssRules;
        
        for (i=0; reg=miRegla[i]; i++){
            if (reg.selectorText.toLowerCase() == regla.toLowerCase() )
                reg.style[propi]=valor;
        }
    }
}



/*FUNCIONES PARA EL POSICIONAMIENTO DE CAPAS*/

// Determine browser and version.
function Browser() {

    var ua, s, i;

    this.isIE = false;
    this.isNS = false;

    this.version = null;

    ua = navigator.userAgent;

    s = "MSIE";
    if ((i = ua.indexOf(s)) >= 0) {
        this.isIE = true;
        this.version = parseFloat(ua.substr(i + s.length));
        return;
    }

    s = "Netscape6/";
    if ((i = ua.indexOf(s)) >= 0) {
        this.isNS = true;
        this.version = parseFloat(ua.substr(i + s.length));
        return;
    }

    s = "Gecko";
    if ((i = ua.indexOf(s)) >= 0) {
        this.isNS = true;
        this.version = 6.1;
        return;
    }
}

var browser = new Browser();
function actualizarPosicion(event)
{
    var X
    var Y
    if (browser.isIE){ // IE & Opera
        X = event.clientX + document.body.scrollLeft
        Y = event.clientY + document.body.scrollTop
    }
    else if (browser.isNS){
        //if (browser.version == 6.1 ) // Netscape 6.1 or higher (7.2 funciona) y Firefox
        { 
            X = event.clientX + window.scrollX;
            Y = event.clientY + window.scrollY;
        }
    }
    else 
        alert("Tu navegador puede no soportar esta página web. Lo sentimos.");
        
        
    return {x: X, y: Y};

}
