<!--
var panelName;
var undefined;
var appconf=new Object();
var barraEstado=new Object();
var stateBar=new Object();
var reload=true;
var vkp_lastInput;

// JPC 16/02/2011 (conversió de les taules deplegables en taules normals): array per guardar les taules a desplegar. Cada element és a la seva vegada
// un array de dues posicions que conté:
// pos 0: id del tag div que conté la taula desplegable
// pos 1: alçada original de la taula
var arrayTaulesDespl = new Array();

function vkp_openInfo(lng) {
		
		var wndvkpinfo = window.open("/caixacat/cconline/benvinguda_TeclatVirtual/pop_benvingudaPart_"+lng+".html", "vkpinfopop", "toolbar=no,location=no,status=no,menubar=no,resizable=yes,width=650,height=640,left=25,top=25,alwaysRaised=yes");
		try {
			wndvkpinfo.focus();
		} catch (Ex) {
		
		}
}

function vkp_docmd(n) {
	
	var valor = vkp_lastInput.value;
	if(valor.length<4) {
		valor = valor + n.innerHTML;
		vkp_lastInput.value = valor;
	}	
	vkp_set(vkp_lastInput, '');
}

function vkp_clear() {
	vkp_lastInput.value = "";
}


function vkp_open(ctrl, name) {
	var x = new Array(10);
	var tot = 0;
	for(var i=0; i<10; i++) {
		x[i] = i;
	}
	
	while(tot!=10) {
		var n = Math.floor(Math.random()*10);
		if(n>=0 && n<10) {
			if(x[n]==-1) {
				continue;
			}
		}
		var k = "vkp_tv" + tot;
		document.getElementById(k).innerHTML=x[n];
		x[n]=-1;
		tot++;
	}
	if(name && name!="") {
		document.getElementById("vkp_name").innerHTML = '<b>' + unescape(name) + '</b>';
	}

	if(vkp_lastInput) {
		vkp_close(vkp_lastInput);
	}

	
	if(ctrl.name) {
		vkp_lastInput = ctrl;
	} else {
		vkp_lastInput = document.getElementById(ctrl);
	}
	
	vkp_set(vkp_lastInput);
	
	var container = document.getElementById("vkp");
	
	if(container && container.style) {
		container.style.visibility="visible";
	}
}

function vkp_set(obj) {
	obj.style.backgroundColor="#f5f094";
	
	var objTit = document.getElementById(obj.name+"TIT");
	var objNom = document.getElementById(obj.name+"NOM");
	var objSms = document.getElementById(obj.name+"SMS");
	try {		
		objTit.style.color="#e35205";
		objNom.style.color="#e35205";		
		if(objSms) objSms.style.color="#e35205";		
	} catch (exc) {
	}


}

function vkp_close(obj) {
	//var objName = obj.getAttribute("name");
	var objName = getAttributeValue(obj,"name");
	var objTit = document.getElementById(objName+"TIT");
	var objNom = document.getElementById(objName+"NOM");
	var objSms = document.getElementById(obj.name+"SMS");
	try {
		objTit.style.color="black";
		objNom.style.color="black";
		if(objSms) objSms.style.color="black";
		obj.style.backgroundColor="white";
	} catch (exc) {
	}

}


function encodeURL(urlName, session) {
	
	if(urlName) {
		
		if(urlName.indexOf(".pdf")==-1 && urlName.indexOf(".htm")==-1 && urlName.indexOf(";jsessionid")==-1){
			var pos = urlName.indexOf("?");
			
			if(pos==-1) {
				urlName = urlName + ";jsessionid="+session;
			} else {
			
				urlName = urlName.substring(0, pos) + ";jsessionid=" + session + urlName.substr(pos)
			}
		}
	}
	return urlName;
	
}

function start(str){
	panelName=str;
	if(parent.ccmenu!=undefined){
		parent.ccmenu.isOk=true;
		reload=false;
	
	if(appconf.locale!=undefined&&parent.ccmenu.setActiveWindowLocale!=undefined)
			parent.ccmenu.setActiveWindowLocale(appconf.locale);
	}
	if(appconf.helpWindowName!=undefined)
		appconf.helpWindowFile=appconf.helpWindowName+"_"+appconf.locale+".html";
	if(appconf.imagesdir!=undefined)
		appconf.hWImage=appconf.imagesdir+appconf.hWImage;
		
	
	/*
	// Tractament de combos TEST
	
	var x = document.getElementsByTagName("select");
	
	for(var i=0; i<x.length; i++) {
		try {
			if(x[i].options.length == 1) {
				var auxHidden = "<input type='hidden' id='" + x[i].id+"' name='"+x[i].name+"' value=\""+x[i].options[0].value + "\"/>";
				
				//x[i].parentNode.innerHTML="<div style=\"" + x[i].style.cssText + "\">" + x[i].options[0].text + "</div>"+auxHidden;
				x[i].style.display="none";
				x[i].parentNode.innerHTML=x[i].parentNode.innerHTML+"<div style=\"" + x[i].style.cssText + "\">" + x[i].options[0].text + "</div>";
				
			} else {
				
		        // var newOption = document.createElement("option");
		        // x[i].options.add(newOption, 0);
        		// newOption.text = "Triar";
        		// newOption.value=-1;
        		// x[i].selectedIndex = 0;
			}
			
		} catch (excp) {
	
		}
	}
	
	*/
	
	if(navigator.userAgent.indexOf("Opera")>=0) {
		var x = document.getElementsByTagName("DIV");
		if(x && x.length>0) {
			for(var i=0; i<x.length; i++) {
				var auxw = parseInt(x[i].style.width);
				if(auxw==3) {
					var auxopera=x[i].outerHTML.replace("width: 3px","          ");
					x[i].outerHTML=auxopera;
				}
			}
		}
	}
	
	
	if((navigator.userAgent.indexOf("Microsoft")<0 && navigator.userAgent.indexOf("MSIE")<0)) {
		if(navigator.userAgent.indexOf("Opera")<0) {
			
			var x = document.getElementsByTagName("DIV");
			
			if(x && x.length>0) {
				for(var i=0; i<x.length; i++) {
					
					var auxw = parseInt(x[i].style.width);
					
					if(auxw<=3) {
						x[i].style.width="";
						try {
							x[i].style.whiteSpace="nowrap";
						} catch (Excpx) {
						}
					}
				}
			}
			
			x = document.getElementsByTagName("PRE");
			
			if(x && x.length>0) {
				
				for(var i=0; i<x.length; i++) {
					
					var pare = x[i].parentNode;
					var nouNode = document.createElement("FONT");
					var novaPropietat = document.createElement("style");
					nouNode.appendChild(novaPropietat);
					try {
						nouNode.style.fontFamily = x[i].style.fontFamily;
					} catch (Excp2) {
					}	
					try {					
						nouNode.style.color = x[i].style.color;
					} catch (Excp2) {
					}	
					try {											
						nouNode.style.fontSize = parseInt(x[i].style.fontSize);
					} catch (Excp2) {
					}	
					try {											
						nouNode.innerHTML = x[i].innerHTML;						
					} catch (Excp2) {
					}	



	
					if(pare) {
						pare.appendChild(nouNode);
					}
				}
				
				while(x.length>0) {
	
					var pare = x[0].parentNode;
					x[0].style.visibility="hidden";
					
					if(pare) {
						pare.removeChild(x[0]);
						
					}
				}		
			}
		}	
	}
	
	// JPC 16/02/2011 (conversió de les taules deplegables en taules normals): S'incrementa, si és necessari, l'alçada (style.height) de cada taula 
	// desplegable de la página, de manera que es pugui visualitzar tot el seu contingut sense necessitat d'utilitzar barra d'scroll. D'aquesta manera
	// la barra d'scroll quedarà oculta.
	for (var i = 0; i < arrayTaulesDespl.length; i++)	{
		var name = arrayTaulesDespl[i][0];
		var palName = document.getElementById(name);	
		var palNameContentDiv = document.getElementById(name + "ContentDiv");
		var palNameHeaders = document.getElementById(name + "Headers");		
		
		var h = palNameContentDiv.offsetHeight + palNameHeaders.offsetHeight;
		if (h > parseInt(palName.style.height)) {
			palName.style.height = h;			
		}		
	}
}

function Check(obj){
	
	if(obj.checked) {
		//obj.value=obj.hvtrue;
		setAttributeValue(obj,"value", getAttributeValue(obj,"hvtrue"));
		//obj.value=getAttributeValue(obj,"hvtrue");
		//obj.value=obj.getAttribute("hvtrue");
	} else {
		//obj.value=obj.hvfalse;
		//obj.value=getAttributeValue(obj,"hvfalse");
		//obj.value=obj.getAttribute("hvfalse");
		setAttributeValue(obj,"value", getAttributeValue(obj,"hvfalse"));
	}
}

function isEnabled(objx){
	
	var objDisabled = "";
	
	if(objx.disabled) {
		objDisabled = objx.disabled;
	} else {
		objDisabled = getAttributeValue(objx, "disabled");
	}
	
	if(objDisabled!=true && objDisabled!="true"){
		return true;
	}else{
	 return false;
	}
}

function isVisible(object){
	
	if(object.style.visibility=="visible") {
		return true;
	} else {
		return false;
	}
}

function isEmpty(obj){
	
	if(obj.value!="") {
		return false;
	} else {
		return true;
	}
	
}

function isRequired(obj){
	
	var objRequired = "";
	
	if(obj.required) {
		objRequired = obj.required;
	} else {
		objRequired = getAttributeValue(obj, "required");
	}
	
	if(objRequired=="true" || objRequired==true) {
		return true;
	} else {
		return false;
	}
	
}


function isValid(object){
	
	var auxValid = "";
	

	
	if(object.type=="radio" || object.type=="checkbox"){
		if(object.checked=="true"||object.checked==true) {
			return true;
		} else {
			return false;
		}
	} else {	
		if(object.valid) {
			auxValid = object.valid;
		} else {
			auxValid = getAttributeValue(object, "valid");
		}		
		if(auxValid=="true"||auxValid==true) {
			return true;
		} else {
			return false;
		}
	}
}

function isValidQTImp(object){
	
	var auxValid = "";
	
	if(object.valid) {
			auxValid = object.valid;
	} else {
		auxValid = getAttributeValue(object, "valid");
	}		
	if(auxValid=="true"||auxValid==true) {
		return true;
	} else {
		return false;
	}
}

function enable(object,value){
	
	object.disabled=!value;
}

var notifyOnLabelChange;

function setVisible(object,value){
	
	var objName = getAttributeValue(object,"name");
	var idName = getAttributeValue(object,"id");
	if(value)
		document.getElementById(idName).style.visibility = "visible"; 
	else
		document.getElementById(idName).style.visibility = "hidden"; 
		
	if(notifyOnLabelChange==true&& getAttributeValue(object, "name") && objName!=panelName){
		
		if(form.elements[objName +"_div"]==undefined){
			
			//changeLabelVisibility(object.name.substring(0,object.name.length-4),value);
			changeLabelVisibility(objName.substring(0,objName.length-4),value);		
		}
	}
}

function setRequired(obj,b){
	setAttributeValue(obj,"required",b);
}

function labelEnabled(object,valor){
	setAttributeValue(object,"enabled",valor);
	
	if(value)
		object.style.color="#696969";
	else
		object.style.color="black";
}

function clearTextField(obj){
	obj.value="";
	obj.setAttribute("valid",false);

}

function clearComboBox(obj){
	obj.selectedIndex=0;
}

function isValidComboBox(obj){
	var retval = false;
	
	if(obj.selectedIndex!=-1){
		var str=obj.options[obj.selectedIndex].text;
		
		if(str!=" "){
			retval = true;
		}
		
	}
	
	if(obj.valid) {
		obj.valid = retval;
	} else {
		setAttributeValue(obj, "valid", retval);
	}
	return retval;
}

function isEmptyComboBox(obj){
	
	if(obj.selectedIndex!=-1){
		str=obj.options[obj.selectedIndex].text;
		if(str==" "||str==""){
			return true;
		}else{
			return false;
		}
	}else{
		return true;
	}
}

function focusOn(obj){
	obj.focus();
}

function translateBlankSpaces(strLabel){
	for(i=0;i <strLabel.length;i++){
		if(strLabel.charAt(i)==" "){
				strLabel=strLabel.substring(0,i)+"&nbsp;"+strLabel.substring(i+1);
		}
	}
	return strLabel+"&nbsp;";
}

var help;
var extendedHelp;
var viewHelp=false;
var timerID;

function overCFTT(shortMess,longMess,x,y,width,height,pos){
	if(!Number(y) || y<0)
		y=event.clientY;
	hideToolTip();
	if(shortMess!=""&&!viewHelp){
		if(pos=="")
			pos=appconf.tttDefaultPos;
		help=replaceBlankString(shortMess);
		extendedHelp=replaceBlankString(longMess);
		if(longMess==""){
			if(nav.isMac)
				message.innerHTML="<DIV style='position:absolute;border:1;border-color:black;border-style:solid'><TABLE border=0 cellspacing=0 cellpading=0 bgcolor='#000000'><TD nowrap bgcolor='#ffffe1' style='font-family:"+appconf.tttFontFamily+"; font-size:"+appconf.tttFontSize+"px'>"+help+"</TD></TABLE></DIV>";
			else
				message.innerHTML="<TABLE border=0 cellspacing=1 cellpading=0 bgcolor='#000000'><TD nowrap bgcolor='#ffffe1' style='font-family:"+appconf.tttFontFamily+"; font-size:"+appconf.tttFontSize+"px'>"+help+"</TD></TABLE>";
		}else{
			var img=appconf.hWImage;
			if(img!="")
				message.innerHTML="<TABLE border=0><A href='#' onclick='showLongToolTip();return false;'><IMG border=0 src='"+img+"' alt='"+help+"'></A></TABLE>";
		}
		var valid=true;
		if(pos=="B"||pos=="BR"||pos=="BL")
			message.style.top=y+height+5;
		else if(pos=="T"||pos=="TR"||pos=="TL")
			message.style.top=y-5;
		else if(pos=="R"||pos=="L")
			message.style.top=y+height/2;
		else
			valid=false;
		if(pos=="R"||pos=="BR"||pos=="TR")
			message.style.left=x+width+5;
		else if(pos=="L"||pos=="BL"||pos=="TL")
			message.style.left=x-5;
		else if(pos=="B"||pos=="T")
			message.style.left=x+width/2;
		else
			valid=false;
		if(valid){
			
			message.pos=pos;
			timerID=setInterval("showToolTip()",900)
		}
	}
}


function showToolTip(){
	if(timerID!=undefined)
			clearInterval(timerID);
	
	timerID=setInterval("hideToolTip()",3000);
	message.style.visibility="visible";
	
	if(message.pos=="L"||message.pos=="BL"||message.pos=="TL")
		message.style.left=parseInt(message.style.left)-message.offsetWidth;
	else if(message.pos=="B"||message.pos=="T")
		message.style.left=parseInt(message.style.left)-message.offsetWidth/2;
	
	if(message.pos=="T"||message.pos=="TR"||message.pos=="TL")
		message.style.top=parseInt(message.style.top)-message.offsetHeight;
	else if(message.pos=="R"||message.pos=="L")
		message.style.top=parseInt(message.style.top)-message.offsetHeight/2;
	
	viewHelp=true;
}
/////////////////
function hideToolTip(){
	if(timerID!=undefined)
		clearInterval(timerID);
		
		message.style.visibility="hidden";
		viewHelp=false;
}

function outCFTT(){
	if(extendedHelp==""||!viewHelp)
		hideToolTip();

}

function showLongToolTip(){
	
	hideToolTip();
	if(appconf.helpWindowFile!=undefined)
			showHelpWindowFTT();
}

var helpWindowFTT;

function showHelpWindowFTT(){
	var hWLeft=400-appconf.hWWidth/2;
	var hWTop=300-appconf.hWHeight/2;
	
	if(!(!helpWindowFTT||helpWindowFTT.closed)){
		helpWindowFTT.document.all["HelpWindowTitle"].innerHTML=help;
		helpWindowFTT.document.all["HelpWindowText"].innerHTML=extendedHelp;
		helpWindowFTT.focus();
	}else
		helpWindowFTT=window.open(appconf.helpWindowFile,"HW","resizable=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,width="+appconf.hWWidth+",height="+appconf.hWHeight+",left="+hWLeft+",top="+hWTop+",screenLeft="+hWLeft+",screenTop="+hWTop);
}

function replaceBlankString(str){
	while(str.indexOf(" ")!=-1){
		str=str.substring(0,str.indexOf(" "))+"&nbsp;"+str.substring(str.indexOf(" ")+1);
	}
	return str;
}

function showAlertWindow(mes){
	extras1="";
	extras2="";
	if(aWFontIsBold=="true"){
		extras1+="<B>";
		extras2="</B>"+extras2;
	}
	if(aWFontIsItalic=="true"){
		extras1+="<EM>";
		extras2="</EM>"+extras2;
	}
	aWLeft=400-aWWidth/2;
	aWTop=300-aWHeight/2;
	aWindow=window.open("","AW","resizable=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,width="+aWWidth+",height="+aWHeight+",left="+aWLeft+",top="+aWTop+",screenLeft="+aWLeft+",screenTop="+aWTop);
	aWindow.document.write("<HTML><HEAD><TITLE>"+aWTitle+"</TITLE></HEAD><BODY bgcolor='"+aWBGColor+"' onload='document.onclick = document.form.i.onclick' onblur='this.focus()'><CENTER><BR><FONT face='"+aWFontFamily+"' size='"+aWFontSize+"' color='"+aWFontColor+"'>"+extras1+mes+extras2+"</FONT><FORM id='form' name='form'><BR><INPUT id='i' name='i' type='button' value='"+aWButtonText+"'onclick='window.close()'></FORM></CENTER></BODY></HTML>");
	aWindow.focus();
}

function showError(error,var1,var2){
	var mensaje="";
	var str=error;
	if(error!=""&&error!=undefined){
		if(eval("window."+error)!=undefined)
			str=eval(error);
		
		if((var1!=undefined||var2!=undefined)&&str.indexOf("@")!=-1){
			for(i=0;i<str.length;i++){
				if(str.charAt(i)=="@"){
					if(str.charAt(i+1)=="1")
						mensaje+=var1;
						if(str.charAt(i+1)=="2")
							mensaje+=var2;
							
						i++;
				}else
					mensaje+=str.charAt(i);
			}
		}else
			mensaje=str;
		
		if(appconf.alertType!=undefined)
				alertType=appconf.alertType;
				
		if(alertType=="0")
			alert(mensaje);
		else if(alertType=="1")
			showAlertWindow(mensaje);
	}
		
		return true;
}

barraEstado.time=500;

var formSubmition=false;

var activo = "true";

function activar() {
		activo = "true";
		clearInterval(tiempo);
}
/////////////////////////////////////////////////////////////////////////
function formSubmit(){
	if (activo=="true")	{
 		activo = "false";
 		tiempo = setInterval('activar()',10000);	
		if(document.all['stateBarLayer']!=undefined){
			if(appconf.sbX!=undefined)					   
				activateStateBar(appconf.sbX,appconf.sbY,appconf.sbWidth,appconf.sbHeight,appconf.sbTime,appconf.sbIncX,appconf.sbTotLength);
			else
				activateStateBar(10,47,400,8,150,10,400);
		}
		
		if(barraEstado.time!=undefined && barraEstado.message!=undefined) {
			barraEstado.flag=0;
			clearInterval(barraEstado.timerId);
			barraEstado.timerId=setInterval('firstStatusMessage()',barraEstado.time*2);
			window.onunload=new function(){window.status="";};
		}
		
		formSubmition=true;
		form.submit();
	}
}





function activateStateBar(x,y,width,height,time,incx,length){
	clearInterval(stateBar.timer);
	var parent=eval("document."+panelName);
	stateBarLayer.style.clip="rect(0px,0px,"+height+"px,0px)";
	stateBar.height=height;
	stateBarLayer.style.top=y;
	stateBarLayer.style.left=x;
	stateBar.totalWidth=width;
	stateBar.length=length;
	stateBar.width=0;
	stateBar.incx=incx;
	stateBar.x=x;
	stateBar.time=time;
	stateBar.div=stateBarLayer;
	stateBar.setWidth=function(w){
		stateBar.div.style.clip="rect(0px,"+w+"px,"+stateBar.height+"px,0px)";
		stateBar.width=w;
	};
	setTimeout('stateBar.setWidth(stateBar.incx);stateBar.timer=setInterval("stateBarContinue()", stateBar.time);',time*3);
}

function stateBarContinue(){
	var x=0;x=stateBar.width+stateBar.incx;
	if(x>stateBar.length)
		x=0;
	stateBar.setWidth(x);
}

function firstStatusMessage(){
	clearInterval(barraEstado.timerId);
	barraEstado.flag=0;
	barraEstado.timerId=setInterval('statusMessage()',barraEstado.time);
}

function statusMessage(){
	var aux="";
	if(barraEstado.flag%2==0){
		for(var i=0;i<(barraEstado.flag-1)/2;i++)
			aux+=" .";
		window.status=barraEstado.message+aux;
	}else{
		window.status="";
	}
	if(barraEstado.flag==6)
		barraEstado.flag=-1;
	else
		barraEstado.flag++;
}

function finalize(str){
	if(appconf.hasFirmas==true)
		inputFirmas.focus();
	if(navigator.userAgent.indexOf("Mac")==-1)
		window.scroll(0,0);window.status="";
		
	// JPC 16/02/2011 (conversió de les taules deplegables en taules normals): per cada taula desplegable de la pàgina, es desplacen cap avall tots els
	// elements afectats pel desplegament.
	for (var i = 0; i < arrayTaulesDespl.length; i++)	{
		extendList(arrayTaulesDespl[i][0], arrayTaulesDespl[i][1]);
	}
}

function changeLabelQtImporte(obj,text1,text2,prop){
	if(obj.oldText1!=text1||obj.oldText2!=text2){
		setAttributeValue(obj,"oldText1",text1);
		setAttributeValue(obj,"oldText2",text2);
		var aux1="<B>"+text1+"</B>";
		var aux2=text2;
		if(window.appconf!=undefined&&appconf.qtImporteType!=undefined){
			var type=appconf.qtImporteType;
			switch(type.toUpperCase()){
				
				case "CV":
					aux1=text2;
				if(type.indexOf("C")!=-1)
					aux1="<B>"+aux1+"</B>";
					aux2=text1;
				if(type.indexOf("V")!=-1)
					aux2="<B>"+aux2+"</B>";
				break;
				
				case "C":	
				
					aux1=text2;
				if(type.indexOf("C")!=-1)
					aux1="<B>"+aux1+"</B>";
					aux2="";
				
				break;
				
				case "V":
					aux1=text1;
				if(type.indexOf("V")!=-1)
					aux1="<B>"+aux1+"</B>";
					aux2="";
				break;
				
				case "VC":
					aux1=text1;
					if(type.indexOf("V")!=-1)
						aux1="<B>"+aux1+"</B>";
						aux2=text2;
					if(type.indexOf("C")!=-1)
						aux2="<B>"+aux2+"</B>";
					break;
					
				default:
					aux1="<B>"+text1+"</B>";
					aux2=text2;break;
		}
	}
	if(aux2!=""){
		if(nav.isMac)
			obj.innerHTML="<DIV style='position:absolute;'><TABLE CELLPADDING='0' CELLSPACING='0' BORDER='0' style='font-family:"+prop[0]+";font-size:"+prop[1]+";color:"+prop[2]+";' width='"+prop[3]+"'><TR><TD width='50%'>"+aux1+"</TD><TD width='1'>&nbsp;</TD><TD width='50%'>"+aux2+"</TD></TR></TABLE></DIV>";
		else
			obj.innerHTML="<TABLE CELLPADDING='0' CELLSPACING='0' BORDER='0' style='font-family:"+prop[0]+";font-size:"+prop[1]+";color:"+prop[2]+";' width='"+prop[3]+"'><TR><TD width='50%'>"+aux1+"</TD><TD width='1'>&nbsp;</TD><TD width='50%'>"+aux2+"</TD></TR></TABLE>";
	}else{
		if(nav.isMac)
			obj.innerHTML="<DIV style='position:absolute;'><TABLE CELLPADDING='0' CELLSPACING='0' BORDER='0' style='font-family:"+prop[0]+";font-size:"+prop[1]+";color:"+prop[2]+";' width='"+parseInt(prop[3]/2)+"'><TR><TD width='100%'>"+aux1+"</TD></TR></TABLE></DIV>";
		else
			obj.innerHTML="<TABLE CELLPADDING='0' CELLSPACING='0' BORDER='0' style='font-family:"+prop[0]+";font-size:"+prop[1]+";color:"+prop[2]+";' width='"+parseInt(prop[3]/2)+"'><TR><TD width='100%'>"+aux1+"</TD></TR></TABLE>";
	}
 }
}

function BrowserCheck(){
	this.isNN=false;
	this.isIE=false;
	this.isMac=false;
	
	var b=navigator.appName;
	
	if(b=="Netscape"){
		this.isNN=false;
		this.isIE=true;
	}else if(b=="Microsoft Internet Explorer")
		this.isIE=true;
	if(navigator.userAgent.indexOf("Mac")!=-1)
		this.isMac=true;
}

var nav=new BrowserCheck();

function QtImporteBB(name,codeV,codeCV,flag,extMaskProp,extMaskV,extMaskCV,readOnly,valDes,cvalDes,props){
	
	
	var obj_div=eval(name+"_div");
	var obj_lbl;
	if(readOnly)
		obj_lbl=eval(name+"_lbl");
		
		var obj_imp=eval("form."+name+"_importe");
		var obj_mon=eval("form."+name+"_moneda");
		var obj_val=eval("form."+name+"_valor");
		var obj_cval=eval("form."+name+"_contravalor");
		
		var validDiv = obj_div.valid;
		validDiv =(!isEmpty(obj_imp)&&!isEmpty(obj_mon));
		
		if(flag!=false&&(getAttributeValue(obj_imp,"oldValue")!=obj_imp.value||getAttributeValue(obj_mon,"oldValue")!=obj_mon.value)){
			if(obj_mon.value!=""){
				if(obj_mon.value==codeV){
					if(extMaskV!=null)
						setAttributeValue(obj_imp,extMaskProp,getAttributeValue(obj_val,extMaskProp));
					else{
						setAttributeValue(obj_imp,extMaskProp,"");
						//obj_imp[extMaskProp]="";
					}
				}else if(obj_mon.value==codeCV){
						if(extMaskCV!=null)
							setAttributeValue(obj_imp,extMaskProp,getAttributeValue(obj_cval,extMaskProp));
						else
							setAttributeValue(obj_imp,extMaskProp,"");
							
					}
					applyExternalMaskToObject(obj_imp);
			}
			//if(getAttributeValue(obj_imp, "iR")!="") {
			//COMPATIBILIDAD FIREFOX
			if(obj_imp.value!="") {
				setAttributeValue(obj_imp,"iR",((getAttributeValue(obj_imp,extMaskProp)=="")? parseNumber(obj_imp.value): parseNumber(removeMask(obj_imp.value,getAttributeValue(obj_imp,extMaskProp)))));
			}else if(obj_imp.value=="" && getAttributeValue(obj_imp, "iR")!=""){
				setAttributeValue(obj_imp,"iR","");
			}
			
			if(!isEmpty(obj_imp)&&!isEmpty(obj_mon)){
				if(obj_mon.value==codeV){
					
					if(extMaskV!=null)
						obj_val.value=removeMask(obj_imp.value,getAttributeValue(obj_val,extMaskProp));
					else
						obj_val.value=obj_imp.value;
					
					if(extMaskV!=null)
						obj_cval.value=getImportChanged(removeMask(obj_imp.value,getAttributeValue(obj_val,extMaskProp)),obj_mon.value,codeCV);
					else
						obj_cval.value=getImportChanged(obj_imp.value,obj_mon.value,codeCV);
				
				}else if(obj_mon.value==codeCV){
					
					if(extMaskCV!=null)
						obj_val.value=getImportChanged(removeMask(obj_imp.value,getAttributeValue(obj_cval,extMaskProp)),obj_mon.value,codeV);
					else
						obj_val.value=getImportChanged(obj_imp.value,obj_mon.value,codeV);
					
					if(extMaskCV!=null)
						obj_cval.value=removeMask(obj_imp.value,getAttributeValue(obj_cval,extMaskProp));
					else
						obj_cval.value=obj_imp.val;
				}
				if(readOnly){
					var val_lbl="";
					var cval_lbl="";
					
					if(extMaskV!=null)
						val_lbl=translateBlankSpaces(applyMask(obj_val.value,getAttributeValue(obj_val,extMaskProp))+" "+valDes);
					else
						val_lbl=translateBlankSpaces(obj_val.value+" "+valDes);
					
					if(extMaskCV!=null)
						cval_lbl=translateBlankSpaces(applyMask(obj_cval.value,getAttributeValue(obj_cval,extMaskProp))+" "+cvalDes);
					else
						cval_lbl=translateBlankSpaces(obj_cval.value+" "+cvalDes);
					
					changeLabelQtImporte(obj_lbl,val_lbl,cval_lbl,props);
				}
			}else{
				obj_val.value="0";obj_cval.value="0";
				
				if(extMaskV!=null)
					obj_val.value=applyMask(obj_val.value,getAttributeValue(obj_val,extMaskProp));
				if(extMaskCV!=null)
					obj_cval.value=applyMask(obj_cval.value,getAttributeValue(obj_cval,extMaskProp));
			}
			
			/*
			var objImpValue = obj_imp.oldValue;
			objImpValue = obj_imp.value;
			var objMonValue = obj_mon.oldValue;
			objMonValue = obj_mon.value;
			*/
			setAttributeValue(obj_imp,"oldValue", getAttributeValue(obj_imp,"value"));
			setAttributeValue(obj_mon,"oldValue", getAttributeValue(obj_mon,"value"));
			
			return true;
		
		}else
			return false;
}

function writeCboBox(name,data,internalvalue,externalvalue){
	var html="";
	var rows=(data.length)/2;
	if(rows==1){
		var llena=false;
		for(var i=0;i<data.length;i++){
			if(data[0]!=""){
				llena=true;
				break;
			}
		}
		if(!llena)
			rows=0;
	}
	if(rows>0){
		for(var i=0;i<rows;i++){
			html+='<OPTION value = "'+data[2*i+internalvalue]+'" text = "'+data[2*i+externalvalue]+'"> '+data[2*i+externalvalue]+'</OPTION>';
		}
	}else{
			html+='<OPTION value = "" text = ""></OPTION>';
	}
	document.write(html);
	return true;
}

function setAttributeValue(obj, attribName, attribValue) {
	
	//alert("Objeto setAttribute: " + attribName);
	obj.setAttribute(attribName, attribValue);
}

function getAttributeValue(obj, attribName) {
	//alert("Objeto getAttribute: " + obj + attribName);
	var attr = "";
	try {	
		attr = obj.getAttribute(attribName);
		if (attr==null) {
			attr = "";
		}
	} catch (excpt) {
		
	}
	
	return attr;
}

//-->

