function cambia_tarifa(){ 

    algo = document.form1.id_tarifa[document.form1.id_tarifa.selectedIndex].text
    
    algo2 = algo.split("[")
    algo2 = algo2[1].split("]")
    algo2 = algo2[0].split("|")
    
    for(i=0;i<4;i++){ 
		document.form1.s_tarifa.options[i].value = algo2[i] 
    }
    
    document.form1.tarifa.value = document.form1.s_tarifa[document.form1.s_tarifa.selectedIndex].value

    return true;
}

function displayRow(){
	CambiarEstado("emitir_webcam0");
	CambiarEstado("emitir_webcam1");
	CambiarEstado("emitir_webcam2");
	CambiarEstado("emitir_webcam3");
}

function CambiarEstado(elemento)
{
	var row = document.getElementById(elemento);
	if (row.style.display == '')
	{
		row.style.display = 'none';
	}
	else
	{
		row.style.display = '';
	}
	
}

function EliminarFoto(id)
{
    var row = document.getElementById("foto_eliminar");
    row.value = id;
}
function Ocultar(elemento)
{
	var row = document.getElementById(elemento);
	if (row.style.display == '')
	{
		row.style.display = 'none';
	}
	else
	{
		row.style.display = '';
	}
	
}


function showNumber(n, id) {
    var aDiv = document.getElementById('number_container');
    var start = aDiv.innerHTML;
    aDiv.innerHTML = start.substring(0, 6) + n;
    loadXMLDoc("http://www.maullando.com/index.php?op=ver_numero&id=" + id);
}

function getFile(url) {
    
    if (window.XMLHttpRequest) 
    {
	AJAX=new XMLHttpRequest();
    } 
    else 
    {
	AJAX=new ActiveXObject("Microsoft.XMLHTTP");
    }
    if (AJAX)
    {
	AJAX.open("GET", url, false);
        AJAX.send(null);
        return AJAX.responseText;
    }
    else
    {
	return false;
    }
}
                                       
var req;

function loadXMLDoc(url) {
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
		req.onreadystatechange = processReqChange;
		req.open("GET", url, true);
		req.send("");
	}
}
function processReqChange() {
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
            // ...processing statements go here...
            //alert(req.status   +" " +  req.statusText);
        } else {
            //alert("There was a problem retrieving the XML data:\n" +  req.statusText);
        }
    }
} 

