function Linkbrowse (URL,ancho,largo,scro){
scrollmax="No"
if (scro==1){
	scrollmax="Yes";
}
x = (screen.width - ancho) / 2;
y = (screen.height - largo) / 2;
window.open(URL,'',"width="+ancho+",height="+largo+",scrollbars="+scrollmax+",left="+x+",top="+y+", status=yes,toolbar=yes,resizable=yes,menubar=yes,location=yes")
}
function blanktext(){
	document.form1.pwd.value=""
}
function pulsar(val)
{	
	var sControl='';
	
	if (document.form1.pwd.value.length < 12) 
	{
		document.form1.pwd.value=document.form1.pwd.value + val;
	}
	else
	{
		alert('Máximo 12 dígitos')
	}
}
function sd_key(CTA,KEY,WT,HG){
x = (screen.width - WT) / 2
y = (screen.height - HG) / 2
   window.open("keyactiva.php?cta=" + CTA + "&keyactiva=" + KEY,'',"width=" + WT + ",height=" + HG + ",scrollbars=YES,left="+x+",top="+y) 
   return false
}
function retry(){
	parent.location="keyactiva.php?view=2"
}
function closewindow(){
	window.close()
}
function blanktext(){
	document.form1.pwd.value=""
}
function pulsar(val)
{	
	var sControl='';
	
	if (document.form1.pwd.value.length < 12) 
	{
		document.form1.pwd.value=document.form1.pwd.value + val;
	}
	else
	{
		alert('Máximo 12 dígitos')
	}
}
	var frmTabs = false;
	var tabCnt = 0;

function openTab(IDmenu,tab,tabCnt,tab_tope)
	{
	frmTabs = document.frmHostMain;
	var iii=1;
	if(frmTabs)
		{
			for(ii=1;ii<=tabCnt;ii++){
				if(document.getElementById('tab_'+IDmenu+'_'+ii)){
					iii=tab+tab_tope;
					if (ii>=tab && ii<iii){
						document.getElementById('tab_'+IDmenu+'_'+ii).style.display = "";}
					else{
						document.getElementById('tab_'+IDmenu+'_'+ii).style.display = "none";}
				}
			}
		}
	}

function f_Visible(iIndice,iLongitud,imagen,control,optsel,nhide,numtot)
{
var i=0;
var iNumer_Regis=0
i=parseInt(iIndice)
iNumer_Regis=parseInt(iLongitud)
var cadena=''
var NcountCredito=0
var saldo=0
saldo = parseInt(optsel)
NcountCredito = parseInt(numtot)
//if (document.getElementById(control + "_" + iIndice).style.display=="none")
//{
//var Limite=0
//Limite=parseInt(iIndice) + parseInt(iNumer_Regis) - 1
//for (i=parseInt(iIndice);i<=Limite;i++)
if (saldo==0){
	for (i=parseInt(iIndice);i<=NcountCredito;i++)
	{
	document.getElementById(control + "_" +  i).style.display="block"
	}
	return false;
}
for (i=parseInt(iIndice);i<=NcountCredito;i++)
	{
	if (eval("document.formctacte." + nhide + "_" + i +" .value")==saldo){
	//document.getElementById(control + "_" + i).style.display="block"
	//alert(document.getElementById(control + "_" + i))
		document.getElementById(control + "_" +  i).style.display="block"
		}
		else {
		document.getElementById(control + "_" +  i).style.display="none"
		}
	}
}
function optransf(ivalue,iChange){
	if (ivalue=='BAN'){
	document.getElementById(iChange).disabled=false}
	else {
	document.getElementById(iChange).disabled=true}
}
function sumtransf(iControl,iToti,iSoles,iDolares,itext,iVeri,ipag,iValue,iMoneda){
	var sumtot=0.00
	var txtmoneda="moneda"
	var iFin=0
	var ipreSum=0.00
	var nsumtot=0.00
	var iCtextpag = 0.00
	if (iVeri==1){
		iCtextpag = Number(eval(iControl+ "." + itext + "_" + ipag +".value"))
		if (iCtextpag>iValue){
			alert("El Monto Supera al Saldo o Deuda Total");
			document.getElementById(itext + "_" + ipag).value=""
//			return false;
		}
	}
	if (iMoneda==1){
		var txtMonedavalor=iSoles
	}
	else {
		var txtMonedavalor=iDolares			
	}
		iFin = parseInt(eval(iControl+ "." + iToti + ".value"))
		for (i=1;i<=iFin;i++){
			ipreSum = Number(eval(iControl + "." + itext + "_" + i +" .value"))
			if (eval(iControl + "." + txtmoneda + "_" + i + ".value")==iMoneda){
				nsumtot += ipreSum
			}
		}
		document.getElementById(txtMonedavalor).value=redondear2(nsumtot)
}
function redondear2(num){ 
	var Isubtot
	Isubtot=Math.floor(num)+".";
	var cents=100*(num-Math.floor(num))+0.5;
	Isubtot += Math.floor(cents/10);
	Isubtot += Math.floor(cents%10);
    return Isubtot; 
 } 

function loophide(iNumber,iCtrl,Imax,iName,Inametbox)
{
	if (iNumber<1){
		document.getElementById(iName).value=1	
		iNumber=1;
	}
for (i=1;i<=Imax;i++)
	{
	if (document.getElementById(Inametbox + "_" + i).value<=parseInt(iNumber)){
		document.getElementById(iCtrl+ "_" +  i).style.display="block";
		}
		else {
		document.getElementById(iCtrl + "_" +  i).style.display="none";
		}
		if (iNumber>Imax){
			document.getElementById(iName).value=Imax
//			i=Imax
		}
		if (iNumber<1){
			document.getElementById(iName).value=1
		}
	}
}
function SumMax(Ictrlm,Isum,Itot)
{
	var nA=Number(document.getElementById(Ictrlm).value);
	if (nA>=Itot){
		return;		
	}
	nA = nA + Isum
	document.getElementById(Ictrlm).value=nA
	loophide(nA,'hide',Itot,Ictrlm,'thide');
}
function ResMax(Ictrlm,Isum,Itot)
{
	var nA=Number(document.getElementById(Ictrlm).value);
	if (nA<=1){
		return;		
	}
	nA = nA - Isum
	document.getElementById(Ictrlm).value=nA
	loophide(nA,'hide',Itot,Ictrlm,'thide');
}
function mouseOver(elem,action) {
		if (action == 'to') {
			elem.style.backgroundColor='#E09F5D';
			elem.style.borderStyle='solid';
			elem.style.borderWidth='1px';
			elem.style.color='#ffffff';
			elem.style.borderColor='#F4F4F4';
		} else {
			elem.style.backgroundColor='#364865';
			elem.style.borderStyle='solid';
			elem.style.borderWidth='0px';
			elem.style.borderColor='#364865';
	}
}

function hide_dep(dep,tot,i)
	{
		oO=0;
		if (dep==0){
			document.form1.dep_coop.selectedIndex=dep;
				for(ii=1;ii<=tot;ii++){
						oO=eval("document.form1.hi_" + ii + ".value");
						document.getElementById(oO).style.display = "block";
						document.getElementById(oO + "o").style.display = "block";
					}
		}
		else {
		if (i>0){
		document.form1.dep_coop.selectedIndex=i;}
		for(ii=1;ii<=tot;ii++){
				if (document.getElementById(ii + '_dep_' + dep)){
					document.getElementById(ii + "_dep_" + dep).style.display = "block";
					document.getElementById(ii + "_dep_" + dep + "o").style.display = "block";}
				else {
					oO=eval("document.form1.hi_" + ii + ".value");
					document.getElementById(oO).style.display = "none";					
					document.getElementById(oO + "o").style.display = "none";}
		}
	}
}
function view_iframe(cod,total,i){
	document.frames("zone").hide_dep(cod,total,i);
}
function load_mapa(){
		vstring=document.form1.string.value;
		vdep=document.form1.dep_coop.value;
		document.form1.string.value='';
		x = (screen.width - 340) / 2;
		y = (screen.height - 350) / 2;
		window.open("localidades.php?string="+vstring+"&dep_coop="+vdep+"&hide_sw=1","","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=340,height=350,left="+x+",top="+y);
}
 function putFocus(formInst, elementInst) {
  if (document.forms.length > 0) {
   document.forms[formInst].elements[elementInst].focus();
  }
}
function MM_jumpMenu(targ,selObj,restore){ 
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}
function dir_iframe(cod){
parent.document.frames("zonecoopac").location.href="view_eeff_coopac.php?id="+cod;
}
function change_tr(i,Otr,Oselect,oFocus,It) {
	var a=eval("document.form1."+Oselect+i+".value");
	if (a==It){
		document.getElementById(Otr+i).style.display = "block";
		eval('document.form1.'+oFocus+'.focus()');
	}
	else{
		document.getElementById(Otr+i).style.display = "none";
	}
}
function valid(i){
	box = eval("document.form1.cbx_" +  i); 
	if (eval("document.form1.file_load_" + i + ".value") == "" || eval("document.form1.file_load_" + i + ".value")==" "){
		box.checked = false;
	}
	else {
		box.checked = true;
	}
}
function ClearList(OptionList, TitleName) 
{
	OptionList.length = 0;
}
	
function move(side)
{   
	var temp1 = new Array();
	var temp2 = new Array();
	var tempa = new Array();
	var tempb = new Array();
	var current1 = 0;
	var current2 = 0;
	var y=0;
	var attribute;
	
	//assign what select attribute treat as attribute1 and attribute2
	if (side == "right")
	{  
		attribute1 = document.form1.category_name; 
		attribute2 = document.form1.category_selected;
	}
	else
	{  
		attribute1 = document.form1.category_selected;
		attribute2 = document.form1.category_name;  
	}

	//fill an array with old values
	for (var i = 0; i < attribute2.length; i++)
	{  
		y=current1++
		temp1[y] = attribute2.options[i].value;
		tempa[y] = attribute2.options[i].text;
	}

	//assign new values to arrays
	for (var i = 0; i < attribute1.length; i++)
	{   
		if ( attribute1.options[i].selected )
		{  
			y=current1++
			temp1[y] = attribute1.options[i].value;
			tempa[y] = attribute1.options[i].text;
		}
		else
		{  
			y=current2++
			temp2[y] = attribute1.options[i].value; 
			tempb[y] = attribute1.options[i].text;
		}
	}

	//generating new options 
	for (var i = 0; i < temp1.length; i++)
	{  
		attribute2.options[i] = new Option();
		attribute2.options[i].value = temp1[i];
		attribute2.options[i].text =  tempa[i];
	}

	//generating new options
	ClearList(attribute1,attribute1);
	if (temp2.length>0)
	{	
		for (var i = 0; i < temp2.length; i++)
		{   
			attribute1.options[i] = new Option();
			attribute1.options[i].value = temp2[i];
			attribute1.options[i].text =  tempb[i];
		}
	}
}
function iLink(aHref)
{	
	parent.location=aHref;
}