function MWJ_findObj( oName, oFrame, oDoc ) {
	if( !oDoc ) { if( oFrame ) { oDoc = oFrame.document; } else { oDoc = window.document; } }
	if( oDoc[oName] ) { return oDoc[oName]; } if( oDoc.all && oDoc.all[oName] ) { return oDoc.all[oName]; }
	if( oDoc.getElementById && oDoc.getElementById(oName) ) { return oDoc.getElementById(oName); }
	for( var x = 0; x < oDoc.forms.length; x++ ) { if( oDoc.forms[x][oName] ) { return oDoc.forms[x][oName]; } }
	for( var x = 0; x < oDoc.anchors.length; x++ ) { if( oDoc.anchors[x].name == oName ) { return oDoc.anchors[x]; } }
	for( var x = 0; document.layers && x < oDoc.layers.length; x++ ) {
		var theOb = MWJ_findObj( oName, null, oDoc.layers[x].document ); if( theOb ) { return theOb; } }
	if( !oFrame && window[oName] ) { return window[oName]; } if( oFrame && oFrame[oName] ) { return oFrame[oName]; }
	for( var x = 0; oFrame && oFrame.frames && x < oFrame.frames.length; x++ ) {
		var theOb = MWJ_findObj( oName, oFrame.frames[x], oFrame.frames[x].document ); if( theOb ) { return theOb; } }
	return null;
}

function getObj(oName, oFrame, oDoc){
	return MWJ_findObj( oName, oFrame, oDoc );
}

function toggleBox(szDivID, iState){ // 1 visible, 0 hidden
    if(document.layers){	   //NN4+
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    } else if(document.getElementById){	  //gecko(NN6) + IE 5+
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
    } else if(document.all){	// IE 4
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
}

function setImage(name, normalImg, overImg, selectedImg, selection){
	//alert("setImage");
	var obj = MWJ_findObj(name);
	simplePreload(normalImg, overImg, selectedImg);
	
	obj.normal = normalImg;
	
	if(name == selection){
		obj.selected = true;
		obj.src = selectedImg;
	} else {
		obj.selected = false;
		obj.src = normalImg;
	}
	
	//alert(overImg);
	if((overImg != null)){
		//alert("seteando over");
		obj.over = overImg;
	} else {
		obj.over = null;
	}
}

function toggleImg(name, over){
	var obj = MWJ_findObj(name);
	//alert("togling");
	if((obj.over != null)){
		//alert("entro");
		if(over){
			//alert("over");
			obj.src = obj.over;
		} else {
			//alert("out");
			obj.src = obj.normal;
		}
	}
}

function setBgColor(name, normalColor, selectedColor, formElementName, selection){
	var obj = MWJ_findObj(name);
	var formElement = MWJ_findObj(formElementName);
	
	if(selection == ""){
		obj.bgColor = normalColor;
	} else if(selectedColor != null){
		if(formElement.value == selection){
			obj.bgColor = selectedColor;
		} else {
			obj.bgColor = normalColor;
		}
	} else {
		obj.bgColor = normalColor;
	}
}

function enableSelect(name){
	var obj = MWJ_findObj(name);
	obj.disabled = false;
}


function simplePreload()
{ 
  var args = simplePreload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++)
  {
	if(args[i] != null){
		document.imageArray[i] = new Image;
		document.imageArray[i].src = args[i];
		//alert(args[i]);
	}
  }
}

function selectOption(sel, optVal){
	for(i = 0; i < sel.options.length; i++){
		if(sel.options[i].value == optVal){
			sel.options[i].selected = true;
		} else {
			sel.options[i].selected = false;
		}
	}
}

function selectRadios(radios, optVal){
	for(i=0;i<radios.length;i++){
		if(radios[i].value == optVal){
			radios[i].checked = true;
			break;
		}
	}
}

function selectCheckboxes(cb, optVal2){
	//alert("cblength: " + cb.length);
	//alert("vallength: " + optVal2.length);
	for(j=0;j<optVal2.length;j++){
		//alert("length: " + cb.length);
		for(i=0; i<cb.length; i++){
			//alert(cb[i].value + " = " +optVal2[j]);
			if(cb[i].value == optVal2[j]){
				cb[i].checked = true;
				break;
			}
		}
	}
}

function fillSelect(sel, options){
	sel.options.length = 0;
	var i = 0;
	for (value in options){
		sel.options[i] = new Option(options[value],value);
		i++;
	}
}

function popUp(url){
	window.open(url);
}

function addSelectValuesToParamArray(fe, arr){
	if(fe.options[0].value != '0'){
		for(i = 0; i < fe.options.length; i++){
			if (fe.options[i].selected == true)
				arr[arr.length] = fe.name + '=' + URLEncode(fe.options[i].value);
		}
	}
}

function addTextFieldValueToParamArray(fe, arr){
	arr[arr.length] = fe.name + '=' + URLEncode(fe.value);
}

function addRadioValueToParamArray(fe, arr){
	for(i = 0; i < fe.length; i++){
		if (fe[i].checked == true)
			arr[arr.length] = fe[i].name + '=' + URLEncode(fe[i].value);
	}
}

function addCheckValueToParamArray(fe, arr){
	if (fe.checked == true)
		arr[arr.length] = fe.name + '=' + URLEncode(fe.value);
}

function paramArrayToUrl(arr){
	var url = arr[0];

	for(i = 1; i < arr.length; i++){
		url += '&' + arr[i];
	}
	
	return url;
}

function open_win(what_link, the_x, the_y, toolbar, addressbar, directories, statusbar, menubar, scrollbar, resize, history, pos, wname, codigo){ 
	var the_url = what_link;
	the_x -= 0;
	the_y -= 0;
	var how_wide = screen.availWidth;
	var how_high = screen.availHeight;
	if(toolbar == "0"){var the_toolbar = "no";}else{var the_toolbar = "yes";}
	if(addressbar == "0"){var the_addressbar = "no";}else{var the_addressbar = "yes";}
	if(directories == "0"){var the_directories = "no";}else{var the_directories = "yes";}
	if(statusbar == "0"){var the_statusbar = "no";}else{var the_statusbar = "yes";}
	if(menubar == "0"){var the_menubar = "no";}else{var the_menubar = "yes";}
	if(scrollbar == "0"){var the_scrollbars = "no";}else{var the_scrollbars = "yes";}
	if(resize == "0"){var the_do_resize =  "no";}else{var the_do_resize = "yes";}
	if(history == "0"){var the_copy_history = "no";}else{var the_copy_history = "yes";}
	if(pos == 1){top_pos=0;left_pos=0;}
	if(pos == 2){top_pos = 0;left_pos = (how_wide/2) -  (the_x/2);}
	if(pos == 3){top_pos = 0;left_pos = how_wide - the_x;}
	if(pos == 4){top_pos = (how_high/2) -  (the_y/2);left_pos = 0;}
	if(pos == 5){top_pos = (how_high/2) -  (the_y/2) - 10;left_pos = (how_wide/2) -  (the_x/2) - 6;}
	if(pos == 6){top_pos = (how_high/2) -  (the_y/2);left_pos = how_wide - the_x;}
	if(pos == 7){top_pos = how_high - the_y;left_pos = 0;}
	if(pos == 8){top_pos = how_high - the_y;left_pos = (how_wide/2) -  (the_x/2);}
	if(pos == 9){top_pos = how_high - the_y;left_pos = how_wide - the_x;}
	if (window.outerWidth ){
		var option = "toolbar="+the_toolbar+",location="+the_addressbar+",directories="+the_directories+",status="+the_statusbar+",menubar="+the_menubar+",scrollbars="+the_scrollbars+",resizable="+the_do_resize+",outerWidth="+the_x+",outerHeight="+the_y+",copyhistory="+the_copy_history+",left="+left_pos+",top="+top_pos;
//		wname=window.open(the_url, wname, option);
		wname=window.open(the_url, codigo, option);
		if(wname != null) wname.focus();
		if(wname == null) alert('Para un óptimo funcionamiento de la página, debe permitir que se muestren popups (ventanas emergentes).');
	} else {
		var option = "toolbar="+the_toolbar+",location="+the_addressbar+",directories="+the_directories+",status="+the_statusbar+",menubar="+the_menubar+",scrollbars="+the_scrollbars+",resizable="+the_do_resize+",Width="+the_x+",Height="+the_y+",copyhistory="+the_copy_history+",left="+left_pos+",top="+top_pos;
		if (!wname.closed && wname.location){
			wname.location.href=the_url;
		} else {
//			wname=window.open(the_url, wname, option);
			wname=window.open(the_url, codigo, option);
			//wname.resizeTo(the_x,the_y);
			if(wname != null) wname.focus();
			//if(wname != null) wname.location.href=the_url;
			if(wname == null) alert('Para un óptimo funcionamiento de la página, debe permitir que se muestren popups (ventanas emergentes).');
		}
	}
}

function getPixFromPercent(dim, percent){
	if(dim == "w"){
		var how_wide = screen.availWidth;
		return percent * how_wide;
	} else {
		var how_high = screen.availHeight;
		return percent * how_high;
	}
}

function URLEncode(str)
{
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	var plaintext = str;
	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
			    alert( "Unicode Character '" 
                        + ch 
                        + "' cannot be encoded using standard URL encoding.\n" +
				          "(URL encoding only supports 8-bit characters.)\n" +
						  "A space (+) will be substituted." );
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for

	return encoded;
};

function URLDecode(str)
{
   // Replace + with ' '
   // Replace %xx with equivalent character
   // Put [ERROR] in output if %xx is invalid.
   var HEXCHARS = "0123456789ABCDEFabcdef"; 
   var encoded = str;
   var plaintext = "";
   var i = 0;
   while (i < encoded.length) {
       var ch = encoded.charAt(i);
	   if (ch == "+") {
	       plaintext += " ";
		   i++;
	   } else if (ch == "%") {
			if (i < (encoded.length-2) 
					&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 
					&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
				plaintext += unescape( encoded.substr(i,3) );
				i += 3;
			} else {
				alert( 'Bad escape combination near ...' + encoded.substr(i) );
				plaintext += "%[ERROR]";
				i++;
			}
		} else {
		   plaintext += ch;
		   i++;
		}
	} // while
   return plaintext;
};

<!-- AGREGADO POR MILTON OÑA 2007-11-28 -->
<!-- INICIO -->

	function IsFlash(){
	
	var flashinstalled = 0;
	var flashversion = 0;
	MSDetect = "false";
if (navigator.plugins && navigator.plugins.length)
{
	x = navigator.plugins["Shockwave Flash"];
	if (x)
	{
		flashinstalled = 2;
		if (x.description)
		{
			y = x.description;
			flashversion = y.charAt(y.indexOf('.')-1);
		}
	}
	else
		flashinstalled = 1;
	if (navigator.plugins["Shockwave Flash 2.0"])
	{
		flashinstalled = 2;
		flashversion = 2;
	}
}
else if (navigator.mimeTypes && navigator.mimeTypes.length)
{
	x = navigator.mimeTypes['application/x-shockwave-flash'];
	if (x && x.enabledPlugin)
		flashinstalled = 2;
	else
		flashinstalled = 1;
}
else
	MSDetect = "true";

//alert("MSDetect = " +MSDetect);
return MSDetect;
	} //end function
	
	function SinFlash(){
		if (!IsFlash()) {
			//window.open("http://www.yahoo.com");
			//location.href='?act=formulario&tipo=2';
			document.frm_flash.submit();
		}
	}

// -->
<!-- FIN -->
