﻿function ir(url) {
	alert("Cambiar la llamada a ir por irURL");
	location.href=url;
}

function irURL(url) {
	location.href=url;
}

function vaciarSelect(oSelect) {
	
	var num = oSelect.options.length;
		for(i=0;i<num;i++) {
			oSelect.remove(0);
		}
}

function confirmar(urlOK) {
		var r=confirm("¿Esta seguro?")
		if (r==true) {
			window.location.href=urlOK;
		}			  
	}


function rellenarSelect(oSelect, datos, valores) {	
	var num = new Number(datos.length);
		for (i=0;i<num;i++) {
			var o = document.createElement('option');
			o.value = valores[i];
						
			var textoNodo=new String(unescape(datos[i]));
			textoNodo=textoNodo.replace(/[+]/g," ");
			o.appendChild(document.createTextNode(textoNodo));
			oSelect.appendChild(o);			
		}	
}

function msgboxSINO(mensaje,urlSi,urlIcono) {
	
 //   $(function() {        
		HTMLmensaje='<div id="msgbox">';
		if (urlIcono==undefined) {
			urlIcono="templates/IMGs/advertencia.gif";
		}
		
		HTMLmensaje+='<div class="imagen"><img src="'+urlIcono+'" alt="Icono" /></div>';
		HTMLmensaje+='<div class="mensaje">'+mensaje+'</div><div class="botones"><input type="submit" id="yes" value="Si" /> <input type="submit" id="no" value="No" /></div></div>';        
		
        $.blockUI(HTMLmensaje);					 
		
		
		$('#yes').click(function() { 
			//Cargamos la pagina
			window.location=urlSi;
			//$.unblockUI();
        }); 
 
        $('#no').click($.unblockUI); 
    //}); 
}

function msgboxSINO_v2(mensaje,urlSi,urlIcono) {
	
 //   $(function() {        
		HTMLmensaje='<div id="msgbox">';
		if (urlIcono==undefined) {
			urlIcono="templates/IMGs/advertencia.gif";
		}
		
		HTMLmensaje+='<div class="imagen"><img src="'+urlIcono+'" alt="Icono" /></div>';
		HTMLmensaje+='<div class="mensaje">'+mensaje+'</div><div class="botones" style="width:200px"><input type="submit" id="yes" value="Si" /> <input type="submit" id="no" value="No" /></div></div>';        
		
        $.blockUI({ message: HTMLmensaje, css: {height: '130px',width: '400px'}});					 
		
		$('#yes').click(function() { 
			//Cargamos la pagina
			window.location=urlSi;
			//$.unblockUI();
        }); 
 
        $('#no').click($.unblockUI); 
    //}); 
}