var minCharsPwd=6;var minChars=300;var maxChars=50;var htmlForHeadSummary="";var htmlForSummary="";var minLengthForeignCIF=5;var msgErrReq="El campo es obligatorio";var msgErrEmail="El email no es correcto";var msgErrCbxReq="Es necesario escoger un elemento";var msgErrNumber="El campo debe ser numérico";var msgErrNumberRang="El campo no tiene un valor válido";var msgErrCIF="El CIF es incorrecto";var msgErrPwdNotMatch="Los contraseñas no coinciden."
var msgErrPwdLength="La longitud mínima es de "+minCharsPwd+" caracteres";var msgErrIsDate="El valor debe ser una fecha válida.";var msgErrDateCompare="El rango de fechas no es válido.";var msgErrorLengthMinima="La longitud mínima es de "+minChars+" caracteres";var msgErrorLengthMax="La longitud máxima es de "+maxChars+" caracteres";var msgErrURL="La URL no es correcta.";var msgErrorNumericoNon0="El valor no puede ser 0";var htmlErrorObligatorio="<span class=\"err sperr_obligatorio\" ><em class=\"sprt\"></em>"+msgErrReq+"</span>";var htmlErrorEmail="<span class=\"err sperr_mail\" ><em class=\"sprt\"></em>"+msgErrEmail+"</span>";var htmlErrorCbxObligatorio="<span class=\"err sperr_cbx_obligatorio\" ><em class=\"sprt\"></em>"+msgErrCbxReq+"</span>";var htmlErrorNumerico="<span class=\"err sperr_numerico\" ><em class=\"sprt\"></em>"+msgErrNumber+"</span>";var htmlErrorNumericoRang="<span class=\"err sperr_numerico_rang\" ><em class=\"sprt\"></em>"+msgErrNumberRang+"</span>";var htmlErrorCIF="<span class=\"err sperr_sintax_CIF\" ><em class=\"sprt\"></em>"+msgErrCIF+"</span>";var htmlErrorPasswordNotMatch="<span class=\"err sperr_pwd_not_match\" ><em class=\"sprt\"></em>"+msgErrPwdNotMatch+"</span>";var htmlErrorLengthPwd="<span class=\"err sperr_lengthPwd\" ><em class=\"sprt\"></em>"+msgErrPwdLength+"</span>";var htmlErrorLength="<span class=\"err sperr_length\" ><em class=\"sprt\"></em>"+msgErrorLengthMinima+"</span>";var htmlErrorLengthMax="<span class=\"err sperr_length\" ><em class=\"sprt\"></em>"+msgErrorLengthMax+"</span>";var htmlErrorIsDate="<span class=\"err sperr_IsDate\" ><em class=\"sprt\"></em>"+msgErrIsDate+"</span>";var htmlErrorDateCompare="<span class=\"err sperr_DateCompare\" ><em class=\"sprt\"></em>"+msgErrDateCompare+"</span>";var htmlErrorURL="<span class=\"err sperr_URL\" ><em class=\"sprt\"></em>"+msgErrURL+"</span>";var htmlErrorNumericoNon0="<span class=\"err sperr_numerico_non_0\" ><em class=\"sprt\"></em>"+msgErrorNumericoNon0+"</span>";$(document).ready(function(){$(".err_length").focus(function(){$(this).parent().find(".sperr_length").hide();$(this).removeClass("txReq");$(this).removeClass("ismarked");});$(".err_length_max").focus(function(){$(this).parent().find(".sperr_length_max").hide();$(this).removeClass("txReq");$(this).removeClass("ismarked");});$(".err_DateCompare").focus(function(){$(this).parent().find(".sperr_DateCompare").hide();$(this).removeClass("txReq");$(this).removeClass("ismarked");});$(".err_IsDate").focus(function(){$(this).parent().find(".sperr_IsDate").hide();$(this).removeClass("txReq");$(this).removeClass("ismarked");});$(".err_obligatorio").focus(function(){$(this).parent().find(".sperr_obligatorio").hide();$(this).removeClass("txReq");$(this).removeClass("ismarked");});$(".err_enabled_obligatorio").focus(function(){$(this).parent().find(".sperr_obligatorio").hide();$(this).removeClass("txReq");$(this).removeClass("ismarked");});$(".err_obligatorio_visible").focus(function(){$(this).parent().find(".sperr_obligatorio_visible").hide();$(this).removeClass("txReq");$(this).removeClass("ismarked");});$(".err_numerico").focus(function(){$(this).parent().find(".sperr_numerico").hide();$(this).removeClass("txReq");$(this).removeClass("ismarked");});$(".err_numerico_non_0").focus(function(){$(this).parent().find(".sperr_numerico_non_0").hide();$(this).removeClass("txReq");$(this).removeClass("ismarked");});$(".err_decimal").focus(function(){$(this).parent().find(".sperr_numerico").hide();$(this).removeClass("txReq");$(this).removeClass("ismarked");});$(".err_numerico_rang").focus(function(){$(this).parent().find(".sperr_numerico_rang").hide();$(this).removeClass("txReq");$(this).removeClass("ismarked");});$(".err_mail").focus(function(){$(this).parent().find(".sperr_mail").hide();$(this).removeClass("txReq");$(this).removeClass("ismarked");});$(".err_sintax_CIF").focus(function(){$(this).parent().find(".sperr_sintax_CIF").hide();$(this).removeClass("txReq");$(this).removeClass("ismarked");});$(".err_sintax_CIF_ByCountry").focus(function(){$(this).parent().find(".sperr_sintax_CIF").css("display","none");$(this).removeClass("txReq");$(this).removeClass("ismarked");});$(".err_cbx_obligatorio").focus(function(){$(this).parent().find(".sperr_cbx_obligatorio").hide();$(this).removeClass("txReq");$(this).removeClass("ismarked");});$(".err_cbx_obligatorio_visible_Base_0").focus(function(){$(this).parent().find(".sperr_cbx_obligatorio_visible_Base_0").hide();$(this).removeClass("txReq");$(this).removeClass("ismarked");});$(".err_pwd_not_match").focus(function(){$(this).parent().find(".sperr_pwd_not_match").hide();$(this).removeClass("txReq");$(this).removeClass("ismarked");});$(".err_lengthPwd").focus(function(){$(this).parent().find(".sperr_lengthPwd").hide();$(this).removeClass("txReq");$(this).removeClass("ismarked");});$(".err_URL").focus(function(){$(this).parent().find(".sperr_URL").hide();$(this).removeClass("txReq");$(this).removeClass("ismarked");});$(".err_length").focus(function(){$(this).parent().find(".sperr_length").hide();$(this).removeClass("txReq");$(this).removeClass("ismarked");});$(".err_length_max").focus(function(){$(this).parent().find(".sperr_length").hide();$(this).removeClass("txReq");$(this).removeClass("ismarked");});$(".err_DateCompare").blur(function(){var match=/\#(\w*)/i.exec($(this).attr("class"));if(!$(this).is(":disabled")&&$(this).val()!=''){if(!ComparaData($("#"+match[1]).val(),$(this).val()))
SetError(htmlErrorDateCompare,$(this));}});$(".err_IsDate").blur(function(){if(!$(this).is(":disabled")&&$(this).val()!=''){if(!IsDate($(this).val()))
SetError(htmlErrorIsDate,$(this));}});$(".err_enabled_obligatorio").blur(function(){if(!$(this).is(":disabled")){if($(this).val()==''){SetError(htmlErrorObligatorio,$(this));}}});$(".err_lengthPwd").blur(function(){if(!$(this).is(":disabled")&&$(this).val()!=''){if($(this).val().length<minCharsPwd)
SetError(htmlErrorLengthPwd,$(this));}});$(".err_length").blur(function(){if(!$(this).is(":disabled")&&$(this).val()!=''){if($(this).val().length<minChars)
SetError(htmlErrorLength,$(this));}});$(".err_length_max").blur(function(){if(!$(this).is(":disabled")&&$(this).val()!=''){var maxlength=$(this).attr("maxlength");if(maxlength!=null&&$(this).val().length>maxlength){maxChars=maxlength;msgErrorLengthMax="La longitud máxima es de "+maxChars+" caracteres";SetHtmlError();SetError(htmlErrorLengthMax,$(this));}}});$(".err_pwd_not_match").blur(function(){if(!$(this).is(":disabled")&&$(this).val()!=''){if($(this).val()!=$(".pwd_pattern").val())
SetError(htmlErrorPasswordNotMatch,$(this));}});$(".err_obligatorio").blur(function(){if(!$(this).is(":disabled")&&$(this).val()=='')
SetError(htmlErrorObligatorio,$(this));});$(".err_obligatorio_chk").focus(function(){$(this).parent().find(".sperr_obligatorio").hide();$(this).removeClass("txReq");$(this).removeClass("ismarked");});$(".err_obligatorio_visible").blur(function(){if(($(this).css("display")=="inline-block")&&($(this).val()=='')){SetError(htmlErrorObligatorio,$(this));}});$(".err_mail").blur(function(){if(!$(this).is(":disabled")&&$(this).val()!=''){var match=/^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/i.exec($(this).val());if(match==null){SetError(htmlErrorEmail,$(this));}}});$(".err_URL").blur(function(){if(!$(this).is(":disabled")&&$(this).val()!=''){var match=/^http:\/\/\w+([a-zA-Z0-9_\-\.])*\.\w{2,6}?(\/)?((\/).+)?$/i.exec($(this).val());if(match==null){SetError(htmlErrorURL,$(this));}}});$(".err_mail_ajax").blur(function(){if(!$(this).is(":disabled")&&$(this).val()!=''){var oParent=$(this).parent();var oThis=$(this);$.get("/_sysutils/Validator_Email.aspx",{Email:$(this).val()},function(j){if(j.length>0)
if(j=="False")SetError(htmlErrorEmail,oThis);});}});$(".err_sintax_CIF").blur(function(){if(!$(this).is(":disabled")&&$(this).val()!=''){var match=/[a-zA-Z]{0,1}[0-9]{7,8}[a-zA-Z0-9]{1}$/i.exec($(this).val());if(match==null){SetError(htmlErrorCIF,$(this));}}});$(".err_sintax_CIF_ByCountry").blur(function(){if($(this).val()!=''){var sCountry=$(this).attr("countryfield");if($("#"+sCountry).val()==57){var match=/[a-zA-Z]{0,1}[0-9]{7,8}[a-zA-Z0-9]{1}$/i.exec($(this).val());if(match==null){SetError(htmlErrorCIF,$(this));}}else{if($(this).val().length<minLengthForeignCIF){SetError(htmlErrorCIF,$(this));}}}});$(".err_cbx_obligatorio").blur(function(){if(!$(this).is(":disabled")&&($(this).val()==null||$(this).val()=='-1'||$(this).val()==''))
SetError(htmlErrorCbxObligatorio,$(this));});$(".err_cbx_obligatorio_visible").blur(function(){if($(this).is(":visible")&&($(this).val()==null||$(this).val()=='-1'||$(this).val()==''))
SetError(htmlErrorCbxObligatorio,$(this));});$(".err_obligatorio_chk").blur(function(){if(!$(this).is(":disabled")&&!$(this).attr("checked"))
SetError(htmlErrorObligatorio,$(this));});$(".err_cbx_obligatorio_visible_Base_0").blur(function(){if($(this).is(":visible")&&($(this).val()==null||$(this).val()=='0'||$(this).val()==''))
SetError(htmlErrorCbxObligatorio,$(this));});$(".err_numerico").blur(function(){if(!$(this).is(":disabled")&&$(this).val()!=''){if(isNaN($(this).val()))
SetError(htmlErrorNumerico,$(this));}});$(".err_numerico_non_0").blur(function(){if(!$(this).is(":disabled")&&$(this).val()!=''){if(isNaN($(this).val()))
SetError(htmlErrorNumerico,$(this));else if($(this).val()==0){SetError(htmlErrorNumericoNon0,$(this));}}});$(".err_numerico_non_0_block").blur(function(){if($(this).css("display")=="inline-block"){if(!$(this).is(":disabled")&&$(this).val()!=''){if(isNaN($(this).val()))
SetError(htmlErrorNumerico,$(this));else if($(this).val()==0){SetError(htmlErrorNumericoNon0,$(this));}}}});$(".err_decimal").blur(function(){if(!$(this).is(":disabled")&&$(this).val()!=''){var match=/^(-)?(\d*)(\,?)(\d*)$/i.exec($(this).val());if(match==null)
SetError(htmlErrorNumerico,$(this));}});$(".err_numerico_rang").blur(function(){var val=parseInt($(this).val());var minval=parseInt($(this).attr('minVal'));var maxval=parseInt($(this).attr('maxval'));var showErr=$(this).attr('showErr')!='false';if(!$(this).is(":disabled")&&!isNaN(val)&&!isNaN(minval)&&!isNaN(maxval)){if(val<minval||val>maxval){if(showErr){SetNumericRangError(minval,maxval);}
SetError(htmlErrorNumericoRang,$(this));}}});$(".ValidateForm").submit(function(){htmlForSummary='';$(".err").hide();$(".txReq").removeClass("txReq");$(".ismarked").removeClass("ismarked");$(".ValidateForm :input").trigger("blur");ValidaFCKEditor();if($(".ValidateForm").hasClass("SummaryError")){if(htmlForSummary!=''){SetSummary(htmlForSummary)
htmlForSummary="";return false;}else return true;}else{if($(".ismarked").length!=0){$.scrollTo($(".ismarked"),200);return false;}else return true;}});});function SetNumericRangError(minval,maxval){msgErrNumberRang="El campo debe ser un numérico entre "+minval+" y "+maxval+".";htmlErrorNumericoRang="<span class=\"err sperr_numerico_rang\" ><em class=\"sprt\"></em>"+msgErrNumberRang+"</span>";}
function SetShowTextError(p_show){if(!p_show){msgErrReq="";msgErrEmail="";msgErrCbxReq="";msgErrNumber="";msgErrNumberRang="";msgErrCIF="";msgErrPwdNotMatch="";msgErrPwdLength="";msgErrIsDate="";msgErrDateCompare="";msgErrorLengthMinima="";msgErrorLengthMax="";msgErrURL="";SetHtmlError();}}
function SetHtmlError(){htmlErrorObligatorio="<span class=\"err sperr_obligatorio\" ><em class=\"sprt\"></em>"+msgErrReq+"</span>";htmlErrorEmail="<span class=\"err sperr_mail\" ><em class=\"sprt\"></em>"+msgErrEmail+"</span>";htmlErrorCbxObligatorio="<span class=\"err sperr_cbx_obligatorio\" ><em class=\"sprt\"></em>"+msgErrCbxReq+"</span>";htmlErrorNumerico="<span class=\"err sperr_numerico\" ><em class=\"sprt\"></em>"+msgErrNumber+"</span>";htmlErrorNumericoRang="<span class=\"err sperr_numerico_rang\" ><em class=\"sprt\"></em>"+msgErrNumberRang+"</span>";htmlErrorCIF="<span class=\"err sperr_sintax_CIF\" ><em class=\"sprt\"></em>"+msgErrCIF+"</span>";htmlErrorPasswordNotMatch="<span class=\"err sperr_pwd_not_match\" ><em class=\"sprt\"></em>"+msgErrPwdNotMatch+"</span>";htmlErrorLengthPwd="<span class=\"err sperr_lengthPwd\" ><em class=\"sprt\"></em>"+msgErrPwdLength+"</span>";htmlErrorLength="<span class=\"err sperr_length\" ><em class=\"sprt\"></em>"+msgErrorLengthMinima+"</span>";htmlErrorLengthMax="<span class=\"err sperr_length\" ><em class=\"sprt\"></em>"+msgErrorLengthMax+"</span>";htmlErrorIsDate="<span class=\"err sperr_IsDate\" ><em class=\"sprt\"></em>"+msgErrIsDate+"</span>";htmlErrorDateCompare="<span class=\"err sperr_DateCompare\" ><em class=\"sprt\"></em>"+msgErrDateCompare+"</span>";htmlErrorURL="<span class=\"err sperr_URL\" ><em class=\"sprt\"></em>"+msgErrURL+"</span>";}
function SetError(error,input){if(!$(input).hasClass("ismarked")){if($(".ValidateForm").hasClass("SummaryError")){htmlForSummary+="<li><em class=\"sprt li\"></em>El campo <em><b>"+$(input).attr("FieldName")+"</b></em> : "+error+"</li>";}else{$(input).after(error);$(input).addClass("txReq");}}
$(input).addClass("ismarked");$(input).addClass("txReq");}function IsDate(dateStr){var datePat=/^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;var matchArray=dateStr.match(datePat);if(matchArray==null)
return false;day=matchArray[1];month=matchArray[3];year=matchArray[4];if(month<1||month>12)return false;if(day<1||day>31)return false;if((month==4||month==6||month==9||month==11)&&day==31)return false;
if(month==2){var isleap=(year%4==0&&(year%100!=0||year%400==0));if(day>29||(day==29&&!isleap))return false;}return true;}
function ComparaData(dataI,dataF){var patro=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/;var dataIni=dataI.match(patro);if(dataIni==null)return false;var dataFin=dataF.match(patro);if(dataFin==null)
return false;var diaI=parseInt(dataIni[1],10);var mesI=parseInt(dataIni[2],10);var anyI=parseInt(dataIni[3],10);var diaF=parseInt(dataFin[1],10);var mesF=parseInt(dataFin[2],10);var anyF=parseInt(dataFin[3],10);if(anyI<anyF)
return true;else if(anyI==anyF)if(mesI<mesF)return true;else if(mesI==mesF)if(diaI<=diaF)return true;else return false;else return false;else return false;}function SetSummary(mensaje){$(".vSummary").html(htmlForHeadSummary+"<ul>"+mensaje+"</ul>");$(".vSummary").show();$.scrollTo(".vSummary",200);}
function ValidaFCKEditor(){var fckName=$('#FCKName').val();if(fckName!=null){fckEditor1val=FCKeditorAPI.__Instances[fckName].GetHTML();if(fckEditor1val==''){SetError(htmlErrorObligatorio,$('#FCKName'));}else{if(fckEditor1val.length<minChars){SetError(htmlErrorLength,$('#FCKName'));}}}}
function limitChars(textid,limit){var text=$('#'+textid).val();var textlength=text.length;if(textlength>limit){$('#'+textid).val(text.substr(0,limit));return false;}else return true;}
var _val_agt=navigator.userAgent.toLowerCase();var _val_is_major=parseInt(navigator.appVersion);var _val_is_ie=((_val_agt.indexOf("msie")!=-1)&&(_val_agt.indexOf("opera")==-1));var _val_isNT=_val_agt.indexOf("windows nt")!=-1;var IE=(document.all&&(_val_agt.indexOf("opera")==-1));var IE4=(_val_is_ie&&(_val_is_major==4)&&(_val_agt.indexOf("msie 4")!=-1));var IE5=(_val_is_ie&&(_val_agt.indexOf("msie 5.0")!=-1));var IE6=(_val_is_ie&&(_val_agt.indexOf("msie 6.0")!=-1));var NS4=(document.layers);var DOM=(document.getElementById);var NS=(document.getElementById&&(_val_agt.indexOf("netscape")!=-1));var OPERA=(document.getElementById&&(_val_agt.indexOf("opera")!=-1));var FIREFOX=(document.getElementById&&(_val_agt.indexOf("firefox")!=-1));var MAC=(_val_agt.indexOf("mac")!=-1);function checkDate(InputDay,InputMonth,InputYear,Event){var monthLength=new Array(31,28,31,30,31,30,31,31,30,31,30,31);var day=eval("document.getElementById('"+InputDay+"')");var month=eval("document.getElementById('"+InputMonth+"')");var year=eval("document.getElementById('"+InputYear+"')");if(year.value=='aaaa'){year.value='';}
else if(year.value==''&&Event=='onblur'){year.value='aaaa';}else{if(isNaN(year.value)){year.value='aaaa';}else{if(year.value<1900){year.value='1900';}if(year.value/4==parseInt(year.value/4)){monthLength[1]=29;}if(year.value.length<4){month.value='aaaa';}}}if(month.value=='mm'){month.value='';}else if(month.value==''&&Event=='onblur'){month.value='mm';}else{if(isNaN(month.value)){month.value='mm';}else{if(month.value<1){month.value='01';}if(month.value>12){month.value='12';}if(month.value.length==1){month.value='0'+month.value;}}}if(day.value=='dd'){day.value='';}else if(day.value==''&&Event=='onblur'){day.value='dd';}else{if(isNaN(day.value)){day.value='dd';}else{if(day.value<1){day.value='01';}if(day.value>monthLength[month.value-1]){day.value=monthLength[month.value-1];}if(day.value.length==1){day.value='0'+day.value;}}}if((!isNaN(year.value))&&(!isNaN(month.value))&&(!isNaN(day.value))){var now=new Date();now=now.getTime();var dateToCheck=new Date();dateToCheck.setYear(year.value);dateToCheck.setMonth(month.value-1);dateToCheck.setDate(day.value);var checkDate=dateToCheck.getTime();var futureDate=(now<checkDate);var pastDate=(now>checkDate);if(futureDate){year.value='aaaa';}}}
function checkMonthYear(InputMonth,InputYear,Event){var month=eval("document.getElementById('"+InputMonth+"')");var year=eval("document.getElementById('"+InputYear+"')");if(year.value=='aaaa'){year.value='';}
else if(year.value==''&&Event=='onblur'){year.value='aaaa';}else{if(isNaN(year.value)){year.value='aaaa';}else{if(year.value<1900){year.value='1900';}if(year.value.length<4){month.value='aaaa';}}}if(month.value=='mm'){month.value='';}else if(month.value==''&&Event=='onblur'){month.value='mm';}else{if(isNaN(month.value)){month.value='mm';}else{if(month.value<1){month.value='01';}if(month.value>12){month.value='12';}if(month.value.length==1){month.value='0'+month.value;}}}if((!isNaN(year.value))&&(!isNaN(month.value))){var now=new Date();now=now.getTime();var dateToCheck=new Date();dateToCheck.setYear(year.value);dateToCheck.setMonth(month.value-1);dateToCheck.setDate('01');var checkDate=dateToCheck.getTime();var futureDate=(now<checkDate);var pastDate=(now>checkDate);if(futureDate){year.value='aaaa';}}}
function checkActulidadChecked(InputMonth,InputYear,CheckActualidad){var month=eval("document.getElementById('"+InputMonth+"')");var year=eval("document.getElementById('"+InputYear+"')");var check=eval("document.getElementById('"+CheckActualidad+"')");if(check.checked){month.value='mm';year.value='aaaa';month.disabled='true';year.disabled='true';}else{month.disabled='';year.disabled='';}}
function soloCaracteresValidos(){if((event.keyCode==60)||(event.keyCode==62)||(event.keyCode==39)){event.keyCode=0;}}
function soloNumeros(objEvent){var code=0;if(IE||OPERA)code=event.keyCode;else{if(objEvent!=null)code=objEvent.charCode;}if(code==0)return;var caracter=String.fromCharCode(code);var plant=new RegExp('\\d');if(!plant.test(caracter)){if(IE)event.keyCode=0;else{objEvent.stopPropagation();objEvent.preventDefault();}}}
function valDrop(control,regularExpression){var ctrl=document.getElementById(control);var success=true;if(ctrl.selectedIndex==-1){return 1;}
else{if(regularExpression!=''){var re=new RegExp(regularExpression);success=re.exec(ctrl.value);if(success){return 0;}else{return 2;}}else{return 0;}}}
function valString(control,regularExpression){var ctrl=document.getElementById(control);var success=true;if(ctrl.value==''){return 1;}
else{if(regularExpression!=''){var re=new RegExp(regularExpression);success=re.exec(ctrl.value);if(success){return 0;}else{return 2;}}else{return 0;}}}function ch_ok(email,e){var code=0;if(IE||OPERA)code=event.keyCode;else{if(e!=null)code=e.charCode;}if(code==0)return;var caracter=String.fromCharCode(code);var plant;var eliminar=false;if(!email){plant=new RegExp('[\"\#\$\&\'\/\<\>\x5B\xAA\xAC@\\x5D\u20AC\~\^]');eliminar=plant.test(caracter);}else{plant=new RegExp('[\\w@\\.-]');eliminar=!plant.test(caracter);}if(eliminar){if(IE)event.keyCode=0;else{e.stopPropagation();e.preventDefault();}}}
function setpixelvalue(campoOrigen,campoDestino){var valorDestino=$("#"+campoDestino).val();if(valorDestino==''||valorDestino=='undefined'){if($(".modalData #"+campoOrigen).length!=0){valorDestino=$(".modalData #"+campoOrigen+" option:selected").text();}
else{valorDestino=$("#"+campoOrigen+" option:selected").text();}if(valorDestino==''||valorDestino=='undefined'){valorDestino=$(".modalData #"+campoOrigen+" option:selected").text();}$("#"+campoDestino).val(valorDestino);}}