function popMe(urlx, format) {
	var url = urlx;
	ancho = "475"; alto = "400";

	if (format==1) { ancho = "475"; alto = "380"; } 	
	var option = "fullscreen=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,";	
	option += "width=" + ancho + ",height=" + alto;

	var newWindow = window.open(url, 'wPopMe', option);	
	newWindow.resizeTo( Math.ceil(ancho), Math.ceil(alto) );
	newWindow.moveTo  ( Math.ceil(50), Math.ceil(50) );
	newWindow.focus();
}   

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

function alertTerm(id) {
	 popMe("pop/termino.aspx?str="+id,1);
}

// CSS Browser Selector   v0.2.5
var css_browser_selector = function() {
	var 
		ua=navigator.userAgent.toLowerCase(),
		is=function(t){ return ua.indexOf(t) != -1; },
		h=document.getElementsByTagName('html')[0],
		b=(!(/opera|webtv/i.test(ua))&&/msie (\d)/.test(ua))?('ie ie'+RegExp.$1):is('gecko/')? 'gecko':is('opera/9')?'opera opera9':/opera (\d)/.test(ua)?'opera opera'+RegExp.$1:is('konqueror')?'konqueror':is('applewebkit/')?'webkit safari':is('mozilla/')?'gecko':'',
		os=(is('x11')||is('linux'))?' linux':is('mac')?' mac':is('win')?' win':'';
	var c=b+os+' js';
	h.className += h.className?' '+c:c;
}();

/****************/
function ShowHide(LayerName,TotalLayers){//v1.0
	var temp = new Array();
	temp = LayerName.split('_');
	ReLayerName = temp[0];
	
		for (i=1;i<=TotalLayers;i++){
		document.getElementById(ReLayerName+'_'+i).style.display = 'none';
		}
	document.getElementById(LayerName).style.display = 'block';
}
/***************/
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
/*********************/


function Buscar()
{
	DataBindError = false;
	if (typeof(DateInFrom) != "undefined")
		DateInFrom.Validate();
	if (typeof(DateInTo) != "undefined")
		DateInTo.Validate();
	if (!DataBindError)
	{
		document.forms[0].action = "NoteListSearchResults.aspx";
		document.forms[0].submit();
		return true;
	}
	else
		alert("Debe ingresar fechas validas para efectuar la búsqueda");
}
/***********************************/
function pop(a,b,w,h){
w2=w+12;
h2=h+30;
window.open(a,b,"width="+w+",height="+h+",outerwidth="+w2+",outerheight="+h2+",top=50,left=50,");
}

function pop2(a,b,w,h){
w2=w+12;
h2=h+30;
window.open(a,b,"width="+w+",height="+h+",outerwidth="+w2+",outerheight="+h2+",top=50,left=50,scrollbars=1");
}

function OpenPopUp(a){
window.open(a,null,"width=400,height=300, outerwidth=412,outerheight=430,top=50,left=50,scrollbars=1");
}

function verPolitica() {
			w = window.open("pop/politica.html", "_politica_", "width=350,height=500,top=50,left=50,scrollbars=1");
			w.focus();
		}


function ShowMessageWait(pDisabled)
{
	var ChildNodes, Objeto;
	//Si hay formulario, deshabilito todo.
	if (document.forms[0] != null && document.forms[0] != undefined)
	{
		if (pDisabled == null || pDisabled == undefined)
			pDisabled = true;
			
		if (pDisabled)
		{
			
			var pControls = document.forms[0].elements;
				
			for (var mIndex=0; mIndex<pControls.length; mIndex++)
			{
				if (pControls[mIndex] != undefined && pControls[mIndex] != null)
					if (pControls[mIndex].tagName != undefined && pControls[mIndex].tagName != null)
					{
						Objeto = pControls[mIndex];
						switch(Objeto.type)
						{
							case "text": 
								Objeto.readOnly = true;
								break;
							case "button": 
								Objeto.disabled = true;
								break;
							case "select-one": 
								if (!Objeto.disabled)
								{
									/*APARENTE BUG DE FIREFOX 2.0*/
									if (Objeto.SetReadOnly == undefined)
										InicializarSelect(Objeto);
										
									Objeto.SetReadOnly();
								}
								break;
						}
					}
			}
		}
	}
	ShowMessage("Aguarde um instante, por favor.<br/><br/>Processo em andamento.", "MessageWait", false);
}

function DataBindNoValidate()
{
	ShowMessage("Houve erro na inserção dos seus dados.<br/>Por favor, faça a correção e tente novamente.", "DataBindValidateAlert", null, true);
}
