
﻿
function get_proxy_http()
{var frame=document.getElementById('proxy');if(!frame)
return null;var frame_document;if(typeof(frame.contentDocument)!="undefined")
{var frame_document=frame.contentDocument;var frame_window=frame.contentWindow;}
else
{var frame_document=frame.document;var frame_window=frame.contentWindow;}
if(!frame_document)
return null;var HXR=frame_window.getXMLHttpRequest();return HXR;}
function process_ajax_url(this_url)
{var ajax_url='';var ajax_static_url='';if(window.ajax_url_prefix && false)
{ajax_url=window.ajax_url_prefix;ajax_url.replace(/^\s+|\s+$/g,'');var last_char=ajax_url.charAt(ajax_url.length-1);if(last_char!="\/"&&last_char!="\\")
ajax_url=ajax_url+'\/';}
else{}
if(window.ajax_static_url_prefix && false)
{ajax_static_url=window.ajax_static_url_prefix;ajax_static_url.replace(/^\s+|\s+$/g,'');var last_char=ajax_static_url.charAt(ajax_static_url.length-1);if(last_char!="\/"&&last_char!="\\")
ajax_static_url=ajax_static_url+'\/';}
else{}
this_url=this_url.replace('#','');if(ajax_static_url==document.URL)
{ajax_url=ajax_static_url+"proxy/proxy.php?proxy_url="+ajax_url+this_url;;}
else
{ajax_url=ajax_url+this_url;}
return ajax_url;}
function process_submit_url(this_url)
{var ajax_url='';if(window.ajax_url_prefix && false)
{ajax_url=window.ajax_url_prefix;ajax_url.replace(/^\s+|\s+$/g,'');var last_char=ajax_url.charAt(ajax_url.length-1);if(last_char!="/"&&last_char!="\\")
ajax_url=ajax_url+'/';}
else{}
this_url=this_url.replace('#','');ajax_url=ajax_url+this_url;return ajax_url;}
function WBECheckBrowser(){this.ver=navigator.appVersion;this.dom=document.getElementById?1:0;this.ie6=(this.ver.indexOf("MSIE 6")>-1&&this.dom)?1:0;this.ie5=(this.ver.indexOf("MSIE 5")>-1&&this.dom)?1:0;this.ie4=(document.all&&!this.dom)?1:0;this.ie=(this.ie4||this.ie5||this.ie6);this.ns5=(this.dom&&parseInt(this.ver)>=5)?1:0;this.ns4=(document.layers&&!this.dom)?1:0;this.ns=(this.ns4||this.ns5);this.bw=(this.ie6||this.ie5||this.ie4||this.ns4||this.ns5);return this;}
function WBEJsHelper(){this.include=function(script_filename){document.write('<'+'script language="javascript" type="text/javascript"');document.write(' src="'+script_filename+'">');document.write('</'+script+'>');}
this.getMouseXY=function(event)
{var position=new Object();if(document.documentElement&&document.body&&window.event){position.x=window.event.clientX+document.documentElement.scrollLeft+document.body.scrollLeft;position.y=window.event.clientY+document.documentElement.scrollTop+document.body.scrollTop;}else if(window.scrollX!=undefined){position.x=event.clientX+window.scrollX;position.y=event.clientY+window.scrollY;}
return position;};this.findPos=function(obj){var curleft=curtop=0;if(obj.offsetParent){curleft=obj.offsetLeft
curtop=obj.offsetTop
while(obj=obj.offsetParent){curleft+=obj.offsetLeft
curtop+=obj.offsetTop}}
return[curleft,curtop];}
this.getWindowSize=function(){var myWidth=0,myHeight=0;if(typeof(window.innerWidth)=='number'){myWidth=window.innerWidth;myHeight=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){myWidth=document.documentElement.clientWidth;myHeight=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){myWidth=document.body.clientWidth;myHeight=document.body.clientHeight;}
return[myWidth,myHeight];}
this.getWindowScrollXY=function(){var scrOfX=0,scrOfY=0;if(typeof(window.pageYOffset)=='number'){scrOfY=window.pageYOffset;scrOfX=window.pageXOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scrOfY=document.body.scrollTop;scrOfX=document.body.scrollLeft;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){scrOfY=document.documentElement.scrollTop;scrOfX=document.documentElement.scrollLeft;}
return[scrOfX,scrOfY];}
this.doPageScroll=function(pos_xy){var oSize=this.getWindowSize();var oScroll=this.getWindowScrollXY();var oPageHeight=oScroll[1]+oSize[1];var oPageWidth=oScroll[0]+oSize[0];if(oScroll[1]>0&&oScroll[1]<=pos_xy.y&&pos_xy.y<oScroll[1]+10)
window.scrollTo(oScroll[0],oScroll[1]-5);else if(oPageHeight-10<pos_xy.y&&pos_xy.y<=oPageHeight)
window.scrollTo(oScroll[0],oScroll[1]+5);if(oScroll[0]>0&&oScroll[0]<=pos_xy.x&&pos_xy.x<oScroll[0]+10)
window.scrollTo(oScroll[0]-5,oScroll[1]);else if(oPageWidth-10<pos_xy.x&&pos_xy.x<=oPageWidth)
window.scrollTo(oScroll[0]+5,oScroll[1]);}
this.getViewWidth=function(){var oSize=this.getWindowSize();return oSize[0];};this.getViewHeight=function(){var oSize=this.getWindowSize();return oSize[1];};this.handleEvent=function(object,sEvent,handler,remove){if(!remove){if(object.addEventListener){object.addEventListener(sEvent,handler,true);}else{object.attachEvent("on"+sEvent,handler);}}else{if(object.removeEventListener)
object.removeEventListener(sEvent,handler,true);else
object.detachEvent("on"+sEvent,handler);}};this.getMaxZindex=function(){var allElems=document.getElementsByTagName?document.getElementsByTagName("*"):document.all;var maxZIndex=0;var sNum;var elem;var cStyle;for(var i=0;i<allElems.length;i++){elem=allElems[i];cStyle=null;if(elem.currentStyle)
cStyle=elem.currentStyle;else if(document.defaultView&&document.defaultView.getComputedStyle)
cStyle=document.defaultView.getComputedStyle(elem,"");if(cStyle)sNum=Number(cStyle.zIndex);else sNum=Number(elem.style.zIndex);if(!isNaN(sNum))maxZIndex=Math.max(maxZIndex,sNum);}
return maxZIndex;};};function WBEDivManager(sId)
{this.TAG_NAME="DIV";this.id=sId;this.div=new Object();this.browserCheck=new WBECheckBrowser();this.x0=0;this.y0=0;this.x1=0;this.y1=0;this.w=0;this.h=0;this.Int=function(d_x,d_y)
{return isNaN(d_y=parseInt(d_x))?0:d_y;};this.reset=function(){this.resetPageXY();this.resetWH();};this.hide=function(){this.div.style.display="none";};this.show=function(){this.div.style.display="block";};this.resetPageXY=function()
{var object=this.div;this.x0=this.y0=0;if(object.offsetLeft!=undefined){while(object){this.x0+=object.offsetLeft;this.y0+=object.offsetTop;object=object.offsetParent||null;}}else{this.x0=object.pageX||0;this.y0=object.pageY||0;}};this.resetWH=function(){if(this.div.clip)this.w=this.Int(this.div.clip.width);else if(this.div.offsetWidth!=undefined)this.w=this.Int(this.div.offsetWidth);else if(this.div.css.pixelWidth!=undefined)this.w=this.Int(this.div.css.pixelWidth);else if(this.div.css.width!=undefined)this.w=this.Int(this.div.css.width);else this.w=0;this.x1=this.x0+this.w;if(this.div.clip)this.h=this.Int(this.div.clip.height);else if(this.div.offsetHeight!=undefined)this.h=this.Int(this.div.offsetHeight);else if(this.div.css.pixelHeight!=undefined)this.h=this.Int(this.div.css.pixelHeight);else if(this.div.css.height!=undefined)this.h=this.Int(this.div.css.height);else this.h=0;this.y1=this.y0+this.h;};this.moveToXY=function(new_x,new_y){this.isXYPosition=true;this.div.style.position="absolute";this.div.style.top=new_y+'px';this.div.style.left=new_x+'px';this.resetPageXY();};this.resize=function(new_w,new_h){if(this.div.resizeTo){this.div.resizeTo(new_w,new_h);}else if(this.div.pixelWidth){this.div.pixelWidth=new_w;this.div.pixelHeight=new_h;}else{if(new_w!=undefined)
this.div.style.width=(new_w)?new_w+'px':null;if(new_h!=undefined)
this.div.style.height=(new_h)?new_h+'px':null;}
this.resetWH();};this.isOver=function(cX,cY){return((this.x0<=cX&&cX<=this.x1)&&(this.y0<=cY&&cY<=this.y1));};this.getChildIndex=function(oObject){var childs;var idx=0;var i=0;if(this.div.hasChildNodes())
{childs=(this.div.children||this.div.childNodes);while(i<childs.length){if(childs[i].tagName==this.TAG_NAME&&childs[i].id!=undefined){if(childs[i]==oObject||childs[i]==oObject.div)return idx;idx++;}
i++;}}
return idx;};this.getChildAt=function(idx){var childs;var iDivCount;if(this.div.hasChildNodes()){childs=(this.div.children||this.div.childNodes);iDivCount=0;for(var i=0;i<childs.length;i++){if(childs[i].tagName!=this.TAG_NAME||childs[i].id==undefined)continue;if(iDivCount==idx)return childs[i];iDivCount++;}}
return null;};this.insertChildAt=function(oObject,idx){var oTargetDiv;oTargetDiv=this.getChildAt(idx)
if(oObject.div){if(oTargetDiv){this.div.insertBefore(oObject.div,oTargetDiv);}else
this.div.appendChild(oObject.div);oObject.resetPageXY();}else if(oObject){if(oTargetDiv)
this.div.insertBefore(oObject,oTargetDiv);else
this.div.appendChild(oObject);}};this.getChildBelowMouse=function(mX,mY){var childs;var o_child;var ichild_index;if(this.div.hasChildNodes()){childs=(this.div.children||this.div.childNodes);ichild_index=0;for(var i=0;i<childs.length;i++){o_child=childs[i];if(o_child.tagName!=this.TAG_NAME||o_child.id==undefined)continue;o_child=new WBEDivManager(o_child.id);if(o_child.isOver(mX,mY)){o_child.parentIndex=ichild_index;return o_child;}
ichild_index++;}}
return null;}
this.getLastChild=function(){var childs;var o_child;var oLastChild=null;if(this.div.hasChildNodes()){childs=(this.div.children||this.div.childNodes);for(var i=0;i<childs.length;i++){o_child=childs[i];if(o_child.tagName!=this.TAG_NAME||o_child.id==undefined)continue;oLastChild=new WBEDivManager(o_child.id);}}
return oLastChild;}
this.scrollPage=function(pos_xy){var oSize=getWindowSize();var oScroll=getWindowScrollXY();var oPageHeight=oScroll[1]+oSize[1];var oPageWidth=oScroll[0]+oSize[0];if(oScroll[1]>0&&oScroll[1]<=pos_xy.y&&pos_xy.y<oScroll[1]+10)
window.scrollTo(oScroll[0],oScroll[1]-5);else if(oPageHeight-10<pos_xy.y&&pos_xy.y<=oPageHeight)
window.scrollTo(oScroll[0],oScroll[1]+5);if(oScroll[0]>0&&oScroll[0]<=pos_xy.x&&pos_xy.x<oScroll[0]+10)
window.scrollTo(oScroll[0]-5,oScroll[1]);else if(oPageWidth-10<pos_xy.x&&pos_xy.x<=oPageWidth)
window.scrollTo(oScroll[0]+5,oScroll[1]);}
this.div=document.getElementById(this.id);try{this.reset();}catch(e){}}
function WBEDragDropManager()
{this.object;this.w_helper=new WBEJsHelper();this.mouseXY;this.isMoving=false;this.startValues=new Object();this.movingValues=new Object();this.endValues=new Object();this.zIndex=0;this.type=0;this.MinOffSet=10;this.yRefCoord=0;this.xRefCoord=0;this.doAutoScroll=false;this.setZoneMoving=function(){this.type=0;};this.setXYMoving=function(){this.type=1;};this.setResizing=function(){this.type=2;};this.continueWithEvents=function(event){if(window.event){window.event.cancelBubble=true;window.event.returnValue=false;}else if(event){event.preventDefault();};};this.checkMinOffSet=function(event,mouseXY){this.continueWithEvents(event);return((this.startValues.cursorX-this.MinOffSet)<mouseXY.x&&mouseXY.x<(this.startValues.cursorX+this.MinOffSet)&&(this.startValues.cursorY-this.MinOffSet)<mouseXY.y&&mouseXY.y<(this.startValues.cursorY+this.MinOffSet));};this.start=function(event,id)
{if(id){this.object=document.getElementById(id);}else{if(window.event)
this.object=window.event.srcElement;else if(event.target)
this.object=event.target;if(this.object.nodeType==3)
this.object=this.object.parentNode;}
this.movingValues.movingObj=new WBEDivManager(this.object.id);this.continueWithEvents(event);this.mouseXY=this.w_helper.getMouseXY(event);this.resetValues();if(this.zIndex==0)this.zIndex=this.w_helper.getMaxZindex();this.object.style.zIndex=this.zIndex++;this.isMoving=false;};this.resetValues=function(){this.movingValues.movingObj=new WBEDivManager(this.object.id);if(this.mouseXY){this.startValues.cursorX=this.mouseXY.x;this.startValues.cursorY=this.mouseXY.y;this.endValues.left=this.mouseXY.x;this.endValues.top=this.mouseXY.y;}
this.startValues.x=(parseInt(this.movingValues.movingObj.x0,10)||0);this.startValues.y=(parseInt(this.movingValues.movingObj.y0,10)||0);this.startValues.z=this.movingValues.movingObj.div.style.zIndex;this.startValues.top=(parseInt(this.object.offsetTop,10)||0);this.startValues.left=(parseInt(this.object.offsetLeft,10)||0);this.startValues.h=this.movingValues.movingObj.h;this.startValues.w=this.movingValues.movingObj.w;}
this.move=function(event)
{this.mouseXY=this.w_helper.getMouseXY(event);if(this.doAutoScroll)
this.w_helper.doPageScroll(this.mouseXY);this.continueWithEvents(event);switch(this.type)
{case 0:if(this.mouseXY.x<0||this.mouseXY.y<0)return;this.movingValues.movingObj.moveToXY(this.mouseXY.x+3,this.mouseXY.y+3);break;case 1:if(this.mouseXY.x<0||this.mouseXY.y<0)return;this.movingValues.movingObj.moveToXY(this.startValues.left+(this.mouseXY.x-this.startValues.cursorX),this.startValues.top+(this.mouseXY.y-this.startValues.cursorY));break;case 2:this.movingValues.movingObj.w=100+(this.mouseXY.x-this.startValues.cursorX);this.movingValues.movingObj.h=100+(this.mouseXY.y-this.startValues.cursorY);if(this.movingValues.movingObj.w<100)this.movingValues.movingObj.w=null;if(this.movingValues.movingObj.h<100)this.movingValues.movingObj.h=null;this.movingValues.movingObj.resize(this.movingValues.movingObj.w,this.movingValues.movingObj.h);break;}}
this.stop=function(event){this.mouseXY=this.w_helper.getMouseXY(event);this.isMoving=false;}
this.reset=function(){this.object=null;}
this.manageMouseMoveHandler=function(handler,remove){this.w_helper.handleEvent(document,"mousemove",handler,remove);};this.manageMouseUpHandler=function(handler,remove){this.w_helper.handleEvent(document,"mouseup",handler,remove);};};function WBEDialogPopup()
{this.TabbableTags=new Array("A","BUTTON","TEXTAREA","INPUT","IFRAME");this.TabIndexes=new Array();this.url="";this.width=400;this.height=400;this.returnFunc=null;this.IsDialogShowed=false;this.gi=0;this.title="Component";this.zIndex=1000;this.HasToHideSelects=(parseInt(window.navigator.appVersion.charAt(0),10)<=6&&window.navigator.userAgent.indexOf("MSIE")>-1);this.oldHeight=0;this.maskLayer;this.titleLayer;this.containerLayer;this.iFrameLayer;this.shadowLayer;this.popupIsShown=false;this.hideSelects=false;this.isWizard=false;this.wbe_JsHelper=new WBEJsHelper();this.wbe_createDialogLayers=function()
{if(!document.getElementById('wbe_DialogMask')){document.write("<div id='wbe_edit_box_shadow'></div>");document.write("<div id='wbe_DialogMask' style=\"background-image: url('include/admin/img/maskBG.png')\">&nbsp;</div>");document.write("<div id='wbe_edit_box' style='display:none'>");document.write("<div id='wbe_edit_box_header'>");document.write("<div id='wbe_edit_box_title'></div>");document.write("<div id='buttons'>");document.write("<img src='include/admin/img/btn_min_edt_box.gif' id='wbe_bar_btn_min' hspace=3 border=0 onclick='javascript:___wbe_DialogMinimize()'>");document.write("<img src='include/admin/img/btn_rest_edt_box.gif' id='wbe_bar_btn_max' hspace=3 border=0 onclick='javascript:___wbe_DialogMaximize()' style='display:none' >");document.write("<img src='include/admin/img/btn_clo_edt_box.gif' hspace=3 border=0 onclick='javascript:___wbe_HideDialogHandler()'>");document.write("</div>");document.write("</div>");document.write("<div id='wbe_edit_box_showhelp'><a href='javascript:___showHelp(200);' onClick=''>ayuda &gt;&gt;</a></div>");document.write("<div id='wbe_edit_box_margin_top'> </div>");document.write("<div id='wbe_edit_box_help'>");document.write("<div id='wbe_edit_box_hidehelp'><a href='javascript:___hideHelp();'>&lt;&lt; ocultar ayuda</a></div>");document.write("<div id='wbe_edit_box_help_tit'></div>");document.write("<div id='wbe_edit_box_help_text'>");document.write("</div>");document.write("</div>");document.write("<iframe id=wbe_DialogIFrame name=wbe_editIFrame scrolling=auto frameborder=0 MARGINWIDTH=0 MARGINHEIGHT=0></iframe>");document.write("</div>");}};this.init=function(){this.wbe_createDialogLayers();this.maskLayer=document.getElementById("wbe_DialogMask");this.containerLayer=document.getElementById("wbe_edit_box");this.iFrameLayer=document.getElementById("wbe_DialogIFrame");this.titleLayer=document.getElementById("wbe_edit_box_title");this.shadowLayer=document.getElementById("wbe_edit_box_shadow");this.width=800;this.height=600;this.returnFunc=null;this.IsDialogShowed=false;if(!document.all){document.onkeypress=wbe_keyDownHandler;}
window.onresize=___wbe_CenterDialogHandler;window.onscroll=___wbe_CenterDialogHandler;};this.show=function(bHideButtons)
{if(bHideButtons)
document.getElementById('buttons').style.display="none";else
document.getElementById('buttons').style.display="";___restartHelpWindow();document.getElementById("wbe_edit_box").style.filter='alpha(opacity=100)';document.getElementById("wbe_edit_box").style.opacity='1';this.isWizard=false;this.IsDialogShowed=true;this.disableTabIndexes();this.titleLayer.innerHTML="Editor: "+this.title;this.maskLayer.style.display="block";this.containerLayer.style.display="block";this.shadowLayer.style.display="block";this.zIndex=this.wbe_JsHelper.getMaxZindex();this.maskLayer.style.zIndex=this.zIndex++;this.shadowLayer.style.zIndex=this.zIndex++
this.containerLayer.style.zIndex=this.zIndex++;this.center(this.width,this.height);var titleBarHeight=parseInt(document.getElementById("wbe_edit_box_header").offsetHeight,10);this.containerLayer.style.width=this.width+"px";this.containerLayer.style.height=(this.height+titleBarHeight)+"px";___resizeShadow();this.iFrameLayer.style.width=this.width+"px";;this.iFrameLayer.style.height=(this.height)+"px";this.iFrameLayer.src=process_ajax_url(this.url);if(this.IsDialogShowed==true)this.hideSelectBoxes();};this.showWizard=function(bHideButtons)
{if(bHideButtons)
document.getElementById('buttons').style.display="none";else
document.getElementById('buttons').style.display="";___restartHelpWindow();document.getElementById("wbe_edit_box").style.filter='alpha(opacity=100)';document.getElementById("wbe_edit_box").style.opacity='1';this.isWizard=true;this.IsDialogShowed=true;this.titleLayer.innerHTML="Asistente";this.maskLayer.style.display="none";this.containerLayer.style.display="block";this.shadowLayer.style.display="block";this.zIndex=this.wbe_JsHelper.getMaxZindex();this.maskLayer.style.zIndex=this.zIndex++;this.containerLayer.style.zIndex=this.zIndex++;this.center(this.width,this.height);var titleBarHeight=parseInt(document.getElementById("wbe_edit_box_header").offsetHeight,10);this.containerLayer.style.width=this.width+"px";this.containerLayer.style.height=(this.height+titleBarHeight)+"px";this.iFrameLayer.style.width=this.width+"px";;this.iFrameLayer.style.height=(this.height)+"px";this.iFrameLayer.src=process_ajax_url(this.url);if(this.IsDialogShowed==true)this.hideSelectBoxes();___resizeShadow();};this.showWizardWithFading=function(bHideButtons)
{if(bHideButtons)
document.getElementById('buttons').style.display="none";else
document.getElementById('buttons').style.display="";this.containerLayer.style.display='';this.containerLayer.style.filter='alpha(opacity=0)';this.containerLayer.style.opacity='0.0';this.showWizard();setTimeout('___FadeWizard(0);',10);};this.center=function(){if(this.IsDialogShowed){if(!this.isWizard){if(this.width==null||isNaN(this.width)){this.width=this.containerLayer.offsetWidth;}
if(this.height==null){this.height=this.containerLayer.offsetHeight;}
var fullHeight=this.wbe_JsHelper.getViewHeight();var fullWidth=this.wbe_JsHelper.getViewWidth();var scTop=(document.documentElement.scrollTop)?parseInt(document.documentElement.scrollTop,10):parseInt(document.body.scrollTop,10);var scLeft=(document.documentElement.scrollLeft)?parseInt(document.documentElement.scrollLeft,10):parseInt(document.body.scrollLeft,10);this.maskLayer.style.height=fullHeight+"px";this.maskLayer.style.width=fullWidth+"px";this.maskLayer.style.top=scTop+"px";this.maskLayer.style.left=scLeft+"px";window.status=this.maskLayer.style.top+" "+this.maskLayer.style.left+" "+this.gi++;var titleBarHeight=parseInt(document.getElementById("wbe_edit_box_header").offsetHeight,10);this.containerLayer.style.top=150+"px";this.containerLayer.style.left=(scLeft+((fullWidth-this.width)/2))+"px";this.shadowLayer.style.top=160+"px";this.shadowLayer.style.left=((scLeft+((fullWidth-this.width)/2))-10)+"px";}else{if(this.width==null||isNaN(this.width)){this.width=this.containerLayer.offsetWidth;}
if(this.height==null){this.height=this.containerLayer.offsetHeight;}
var fullWidth=this.wbe_JsHelper.getViewWidth();var titleBarHeight=parseInt(document.getElementById("wbe_edit_box_header").offsetHeight,10);var scTop=(document.documentElement.scrollTop)?parseInt(document.documentElement.scrollTop,10):parseInt(document.body.scrollTop,10);var scLeft=(document.documentElement.scrollLeft)?parseInt(document.documentElement.scrollLeft,10):parseInt(document.body.scrollLeft,10);this.containerLayer.style.top=150+"px";this.containerLayer.style.left=(scLeft+(fullWidth-(this.width+30)))+"px";this.shadowLayer.style.top=160+"px";this.shadowLayer.style.left=((scLeft+(fullWidth-(this.width+30)))-10)+"px";}}};this.hide=function(){this.IsDialogShowed=false;this.restoreTabIndexes();if(!this.maskLayer)return;this.maskLayer.style.display="none";this.containerLayer.style.display="none";this.shadowLayer.style.display="none";if(this.returnFunc)
this.returnFunc(this.iFrameLayer.returnVal);this.iFrameLayer.src='';if(this.HasToHideSelects)this.displaySelectBoxes();}
this.hideSelectBoxes=function(){for(var i=0;i<document.forms.length;i++){for(var e=0;e<document.forms[i].length;e++){if(document.forms[i].elements[e].tagName=="SELECT")
document.forms[i].elements[e].style.visibility="hidden";}}};this.displaySelectBoxes=function(){for(var i=0;i<document.forms.length;i++){for(var e=0;e<document.forms[i].length;e++){if(document.forms[i].elements[e].tagName=="SELECT")
document.forms[i].elements[e].style.visibility="visible";}}};this.disableTabIndexes=function(){if(document.all){var i=0;for(var j=0;j<this.TabbableTags.length;j++){var tagElements=document.getElementsByTagName(this.TabbableTags[j]);for(var k=0;k<tagElements.length;k++){this.TabIndexes[i]=tagElements[k].tabIndex;tagElements[k].tabIndex="-1";i++;}}}};this.restoreTabIndexes=function(){if(document.all){var i=0;for(var j=0;j<this.TabbableTags.length;j++){var tagElements=document.getElementsByTagName(this.TabbableTags[j]);for(var k=0;k<tagElements.length;k++){tagElements[k].tabIndex=this.TabIndexes[i];tagElements[k].tabEnabled=true;i++;}}}};this.minimize=function(){this.iFrameLayer.style.display='none';this.containerLayer.style.height=16;this.shadowLayer.style.height=0;document.getElementById("wbe_bar_btn_min").style.display='none';document.getElementById("wbe_bar_btn_max").style.display='';};this.maximize=function(){this.iFrameLayer.style.display='';this.containerLayer.style.height=this.height;var titleBarHeight=parseInt(document.getElementById("wbe_edit_box_header").offsetHeight,10);___resizeShadow();document.getElementById("wbe_bar_btn_min").style.display='';document.getElementById("wbe_bar_btn_max").style.display='none';};this.resize=function(iWidth,iHeight){this.width=iWidth;this.height=iHeight;this.center();this.containerLayer.style.width=this.width+"px";var titleBarHeight=parseInt(document.getElementById("wbe_edit_box_header").offsetHeight,10);this.containerLayer.style.height=(this.height+titleBarHeight)+"px";___resizeShadow();this.iFrameLayer.style.width=this.width+"px";;this.iFrameLayer.style.height=(this.height)+"px";};};function wbe_keyDownHandler(event){if(___wbeADMIN.dialogPopUp.IsDialogShowed&&event.keyCode==9)return false;}
function ___wbe_CenterDialogHandler(){___wbeADMIN.dialogPopUp.center();}
function ___wbe_DialogMaximize(){___wbeADMIN.dialogPopUp.maximize();}
function ___wbe_DialogMinimize(){___wbeADMIN.dialogPopUp.minimize();}
function ___wbe_HideDialogHandler(){document.getElementById("wbe_DialogIFrame").style.display='';___wbeADMIN.dialogPopUp.hide();}
function ___FadeWizard(in_op){in_op+=10;if(in_op<100){document.getElementById("wbe_edit_box").style.filter='alpha(opacity='+in_op+')';document.getElementById("wbe_edit_box").style.opacity='0.'+in_op;setTimeout('___FadeWizard('+in_op+');',10);}else{document.getElementById("wbe_edit_box").style.filter='alpha(opacity=100)';document.getElementById("wbe_edit_box").style.opacity='1';}}
function ___showHelp(width_help){var edit_box=new WBEDivManager("wbe_edit_box");var new_width_edit_box;new_width_edit_box=edit_box.w+width_help+5-2;document.getElementById('wbe_edit_box').style.width=''+new_width_edit_box+'px';document.getElementById('wbe_edit_box_help').style.display='block';document.getElementById('wbe_edit_box_help').style.height=edit_box.h+'px';document.getElementById('wbe_edit_box_margin_top').style.display='block';document.getElementById('wbe_edit_box_showhelp').style.display='none';___wbeADMIN.dialogPopUp.width=new_width_edit_box;___wbeADMIN.dialogPopUp.center();___resizeShadow();}
function ___hideHelp(){var edit_box=new WBEDivManager("wbe_edit_box");var help_box=new WBEDivManager("wbe_edit_box_help");var new_width_edit_box;if(help_box.w==0){new_width_edit_box=___wbeADMIN.dialogPopUp.width}else{new_width_edit_box=edit_box.w-help_box.w-5-2;}
document.getElementById('wbe_edit_box').style.width=''+new_width_edit_box+'px';___hideHelpWindow();___wbeADMIN.dialogPopUp.width=new_width_edit_box;___wbeADMIN.dialogPopUp.center();___resizeShadow();}
function ___hideHelpWindow(){document.getElementById('wbe_edit_box_help').style.display='none';document.getElementById('wbe_edit_box_margin_top').style.display='none';document.getElementById('wbe_edit_box_showhelp').style.display='block';}
function ___restartHelpWindow(){document.getElementById('wbe_edit_box_help').style.display='none';document.getElementById('wbe_edit_box_margin_top').style.display='block';document.getElementById('wbe_edit_box_showhelp').style.display='none';document.getElementById('wbe_edit_box_help_tit').innerHTML='';document.getElementById('wbe_edit_box_help_text').innerHTML='';}
function ___setHelp(helpTile,helpText){if(''+helpText==''){document.getElementById('wbe_edit_box_margin_top').style.display='none';document.getElementById('wbe_edit_box_showhelp').style.display='none';}else{document.getElementById('wbe_edit_box_help_tit').innerHTML=unescape(helpTile);document.getElementById('wbe_edit_box_help_text').innerHTML='<p>'+unescape(helpText)+'</p>';document.getElementById('wbe_edit_box_showhelp').style.display='block';document.getElementById('wbe_edit_box_margin_top').style.display='none';}
___resizeShadow();}
function ___resizeShadow(){var oDivPopUp=new WBEDivManager('wbe_edit_box');document.getElementById('wbe_edit_box_shadow').style.height=oDivPopUp.h+'px';document.getElementById('wbe_edit_box_shadow').style.width=oDivPopUp.w+'px';}
function WBE_AjaxClass()
{this.parameters=new Array();this.httpReq;this.url="NO_OUTPUT.wbe";this.xml_resource="XML_DOCUMENT.wbe";this.params;this.async=false;this.skip_edit_mode=false;this.hasErrors=(!this.httpReq||this.httpReq.status!=200);this.timeout=0;this.waitResponseHandler=function(){};this.clear=function(){this.parameters=new Array();}
this.addEventPostParameter=function(sName,sValue){if(sName!=null&&sValue!=null){sValue+="";if(sValue.indexOf('&')>0){a_sValue=sValue.split('&');sValue=a_sValue[0];var sAuxName=a_sValue[1].substring(0,a_sValue[1].indexOf('='));var sAuxValue=a_sValue[1].substring(a_sValue[1].indexOf('=')+1);this.addPostParameter(sAuxName,sAuxValue);}
this.parameters[this.parameters.length]=sName+"="+encodeURIComponent(sValue);}}
this.addPostParameter=function(sName,sValue){if(sName!=null&&sValue!=null){this.parameters[this.parameters.length]=sName+"="+encodeURIComponent(sValue);}}
this.getXMLNodeValue=function(oXMLNode,sTagName){var value=oXMLNode.getElementsByTagName(sTagName);return(value!=null&&value.length>0&&value[0].firstChild!=null)?value[0].firstChild.nodeValue:'';}
this.call=function(){this.httpReq=get_proxy_http();if(this.httpReq==null)
if(window.XMLHttpRequest){this.httpReq=new XMLHttpRequest();if(this.async)
this.httpReq.onreadystatechange=this.waitResponseHandler;}else if(window.ActiveXObject){try{this.httpReq=new ActiveXObject("Msxml2.XMLHTTP");if(this.async)
this.httpReq.onload=this.waitResponseHandler;}catch(e){try{this.httpReq=new ActiveXObject("Microsoft.XMLHTTP");if(this.async)
this.httpReq.onreadystatechange=this.waitResponseHandler;}catch(e){}}}
if(!this.httpReq){alert('No puedo crear una instancia AJAX');return false;}
this.url=this.url.replace('#','');if(this.skip_edit_mode){if(this.params!="")this.params+="&";else this.params+="?";this.params+="switch_off_edit_environment=1";}
if(this.timeout>0)this.httpReq.timeout=this.timeout;this.httpReq.open("POST",process_ajax_url(this.url),this.async);this.httpReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");this.httpReq.send(this.params);if(!this.async)
this.responseText=this.httpReq.responseText;};this.throwEvent=function(sEvent,asParams,bDoXmlOutput,sUrl)
{var xmlDoc;if(sUrl)this.url=sUrl;this.params="event="+sEvent;if(asParams){for(var i=0;i<asParams.length;i++)
this.params+="&"+asParams[i];}
this.call();if(!bDoXmlOutput)return this.responseText;if(this.responseText=="")return null;if(document.implementation&&document.implementation.createDocument)
{xmlDoc=document.implementation.createDocument("","",null);xmlDoc.async=false;xmlDoc.onload=function(){return(xmlDoc.readyState==4);};this.LoadXMLMozilla(xmlDoc,this.responseText);}else{if(window.ActiveXObject){xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async=false;xmlDoc.onreadystatechange=function(){return(xmlDoc.readyState==4);};xmlDoc.loadXML(this.responseText);}}
return xmlDoc.documentElement;};this.throwCall2=function(sUrl){var xmlDoc;if(sUrl)this.url=sUrl;this.params="";for(var i=0;i<this.parameters.length;i++){if(this.params!="")this.params+="&";if(this.parameters[i]!=undefined)this.params+=this.parameters[i];}
this.call();}
this.throwEventXML=function(sEvent){return this.throwEvent2(sEvent,true,this.xml_resource);}
this.throwEvent2=function(sEvent,bDoXmlOutput,sUrl)
{this.addEventPostParameter("event",sEvent);this.throwCall2(sUrl);if(!bDoXmlOutput)return this.responseText;if(this.responseText=="")return null;if(document.implementation&&document.implementation.createDocument)
{xmlDoc=document.implementation.createDocument("","",null);xmlDoc.async=false;xmlDoc.onload=function(){return(xmlDoc.readyState==4);};this.LoadXMLMozilla(xmlDoc,this.responseText);}else{if(window.ActiveXObject){xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async=false;xmlDoc.onreadystatechange=function(){return(xmlDoc.readyState==4);};xmlDoc.loadXML(this.responseText);}}
return xmlDoc.documentElement;};this.LoadXMLMozilla=function(oDoc,s)
{var doc2=(new DOMParser()).parseFromString(s,"text/xml");while(oDoc.hasChildNodes())
oDoc.removeChild(this.lastChild);for(var i=0;i<doc2.childNodes.length;i++){oDoc.appendChild(oDoc.importNode(doc2.childNodes[i],true));}};this.throwCall=function(asParams,bDoXmlOutput,sUrl)
{var xmlDoc;if(sUrl)this.url=sUrl;if(asParams){for(var i=0;i<asParams.length;i++)
this.params+="&"+asParams[i];}else{this.params="";for(var i=0;i<this.parameters.length;i++){if(this.params!="")this.params+="&";if(this.parameters[i]!=undefined)this.params+=this.parameters[i];}}
this.call();if(!bDoXmlOutput)return this.responseText;if(this.responseText=="")return null;if(document.implementation&&document.implementation.createDocument)
{xmlDoc=document.implementation.createDocument("","",null);xmlDoc.async=false;xmlDoc.onload=function(){return(xmlDoc.readyState==4);};this.LoadXMLMozilla(xmlDoc,this.responseText);}else{if(window.ActiveXObject){xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async=false;xmlDoc.onreadystatechange=function(){return(xmlDoc.readyState==4);};xmlDoc.loadXML(this.responseText);}}
return xmlDoc.documentElement;};this.createXmlDoc=function(sXml)
{var xmlDoc;if(sXml=="")return null;if(document.implementation&&document.implementation.createDocument)
{xmlDoc=document.implementation.createDocument("","",null);xmlDoc.async=false;xmlDoc.onload=function(){return(xmlDoc.readyState==4);};this.LoadXMLMozilla(xmlDoc,sXml);}else{if(window.ActiveXObject){xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async=false;xmlDoc.onreadystatechange=function(){return(xmlDoc.readyState==4);};xmlDoc.loadXML(sXml);}}
return xmlDoc.documentElement;};};function ___WBECheckSession(){var httpReq;if(window.XMLHttpRequest){httpReq=new XMLHttpRequest();}else if(window.ActiveXObject){try{httpReq=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{httpReq=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
if(httpReq){httpReq.open("POST","session_check.aspx");httpReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");httpReq.send("");}
setTimeout('___WBECheckSession()',300000);}
___WBECheckSession();function WbePositionReloader()
{this.posId=null;this.pageId=null;this.Ajax=new WBE_AjaxClass();this.url="VIEW_POSITION_ZONE.wbe";this.GetXmlObjAsStr=function(inXmlNode){if(inXmlNode.xml){return inXmlNode.xml;}else{if(XMLSerializer){return(new XMLSerializer()).serializeToString(inXmlNode);}}}
this.GetXmlNodeChildsAsStr=function(inXmlNode){var sOut='';for(var i=0;i<inXmlNode.childNodes.length;i++){sOut+=this.GetXmlObjAsStr(inXmlNode.childNodes[i]);}
return sOut;}
this.reload=function(){var sResult,xmlObj;if(this.pageId==null){if(window.parent!=undefined&&window.parent.___wbeADMIN!=undefined){this.pageId=window.parent.___wbeADMIN.resourceId;this.Ajax.addPostParameter("show_parent_div",1);}else if(self.___wbeADMIN){this.pageId=self.___wbeADMIN.resourceId;}}
if(this.posId==undefined){alert('No se puede recargar posición. Id de posición no definido.')
return;}
this.Ajax.addPostParameter("position_id",this.posId);if(this.pageId==undefined){alert('No se puede recargar posición. Id página no definido.')
return;}
this.Ajax.addPostParameter("parent_resource_id",this.pageId);if(this.url==undefined){alert('No se puede recargar posición. No se ha definido página destino.')
return;}
sResult=this.Ajax.throwCall(null,false,this.url);if(sResult){window.parent.document.getElementById('WBECP_'+this.posId).innerHTML=sResult;if(window.parent.document.getElementById('change_mode_chk')){if(window.parent.document.getElementById('change_mode_chk').checked){window.parent.document.getElementById('WBECP_'+this.posId).style.border="1px dashed #FF0000";window.parent.document.getElementById('menu-bar-'+this.posId).style.display='block';}}else{if(window.parent.document.getElementById('menu-bar-'+this.posId)){window.parent.document.getElementById('menu-bar-'+this.posId).style.display='none';}}}
this.Ajax.clear();};};function InmediaFormBuilder(iPosition)
{this.posId=iPosition;this.front=1;this.selectedCatIds=new Array();this.selectedParentIds=new Array();this.addSelectedCategory=function(iId){this.selectedCatIds[this.selectedCatIds.length]=iId;}
this.addParentRelation=function(iId){this.selectedParentIds[this.selectedParentIds.length]=iId;}
this.arrayContainsValue=function(a_array,iId){var i;if(a_array==null)return false;for(i=0;i<a_array.length;i++){if(a_array[i]==iId)return true;}
return false;}
this.GetCategoriesByParentId=function(iParentCat){var oAjax=new WBE_AjaxClass();if(iParentCat==null)return null;oAjax.addPostParameter("cat_id",iParentCat);var oXmlDoc=oAjax.throwEventXML('cms_get_child_categories');var sStatus=oAjax.getXMLNodeValue(oXmlDoc,'s');if(sStatus=='0'){return oXmlDoc.getElementsByTagName("c");}else{alert('Error recuperando categorías');return null;}};this.createCategoryCheckBox=function(iParentCatId,sObjectName,bMultiple){var i;var oDiv=document.getElementById(sObjectName);if(oDiv==null)return;var oNodeList=this.GetCategoriesByParentId(iParentCatId);var sOut='';for(i=0;i<oNodeList.length;i++){var oNode=oNodeList[i];var iValue=oNode.childNodes[0].firstChild.data;var sDesc=oNode.childNodes[1].firstChild.data;var bContains=this.arrayContainsValue(this.selectedCatIds,iValue);var sSelected=(bContains||(!bMultiple&&this.selectedCatIds.length==0&&i==0))?'checked':'';var sType=(bMultiple)?"checkbox":"radio";sOut+="<input class='form_"+sType+"' type='"+sType+"' name='category_"+this.posId+"' value='"+
iValue+"' "+sSelected+"> "+sDesc+"<br/>";}
oDiv.innerHTML=sOut;}
this.fillCategoryCombo=function(iParentCat,sObjectID){var i;var oComboElem=document.getElementById(sObjectID);if(oComboElem==null)return;oComboElem.name="category_"+this.posId;var oNodeList=this.GetCategoriesByParentId(iParentCat);for(i=0;i<oNodeList.length;i++){var oNode=oNodeList[i];var iValue=oNode.childNodes[0].firstChild.data;var sDesc=oNode.childNodes[1].firstChild.data;var opt=new Option(sDesc,iValue);opt.selected=(this.arrayContainsValue(this.selectedCatIds,iValue));oComboElem.options[oComboElem.length]=opt;}}
this.getContentListByTypeId=function(iCParentId){var oAjax=new WBE_AjaxClass();if(iCParentId==null)return null;oAjax.addPostParameter("ctype_id",iCParentId);var oXmlDoc=oAjax.throwEventXML('cms_get_content_list');var sStatus=oAjax.getXMLNodeValue(oXmlDoc,'s');if(sStatus=='0'){return oXmlDoc.getElementsByTagName("c");}else{alert('Error recuperando contenidos');return null;}}
this.getFrontContentListByTypeIdAndAtt=function(iCParentId,sAttCode){var oAjax=new WBE_AjaxClass();if(iCParentId==null)return null;oAjax.addPostParameter("front",this.front);oAjax.addPostParameter("ctype_id",iCParentId);oAjax.addPostParameter("att_code",sAttCode);var oXmlDoc=oAjax.throwEventXML('cms_get_content_list_byAtt');var sStatus=oAjax.getXMLNodeValue(oXmlDoc,'s');if(sStatus=='0'){return oXmlDoc.getElementsByTagName("c");}else{alert('Error recuperando contenidos');return null;}}
this.getFrontContentListByTypeId=function(iCParentId){var oAjax=new WBE_AjaxClass();if(iCParentId==null)return null;oAjax.addPostParameter("ctype_id",iCParentId);oAjax.addPostParameter("front",this.front);var oXmlDoc=oAjax.throwEventXML('cms_get_content_list');var sStatus=oAjax.getXMLNodeValue(oXmlDoc,'s');if(sStatus=='0'){return oXmlDoc.getElementsByTagName("c");}else{alert('Error recuperando contenidos');return null;}}
this.getContentListByTypeIdAndParents=function(iCParentId,oParentIds){var oAjax=new WBE_AjaxClass();if(iCParentId==null)return null;oAjax.addPostParameter("ctype_id",iCParentId);if(oParentIds){var sIds='';for(var i=0;i<oParentIds.length;i++){if(oParentIds[i]!='')
if(sIds.length>0)sIds+=',';sIds+=oParentIds[i];}
oAjax.addPostParameter("parent_ids",sIds);}
var oXmlDoc=oAjax.throwEventXML('cms_get_content_list');var sStatus=oAjax.getXMLNodeValue(oXmlDoc,'s');if(sStatus=='0'){return oXmlDoc.getElementsByTagName("c");}else{alert('Error recuperando contenidos');return null;}}
this.fillContentParentCombo=function(iContentTypeId,sObjectName){var i;var oComboElem=document.getElementById(sObjectName);if(oComboElem==null)return;oComboElem.name="content_parent_"+this.posId;var oNodeList=this.getContentListByTypeId(iContentTypeId);for(i=0;i<oNodeList.length;i++){var oNode=oNodeList[i];var iValue=oNode.childNodes[0].firstChild.data;var sDesc=oNode.childNodes[1].firstChild.data;var opt=new Option(sDesc,iValue);opt.selected=(this.arrayContainsValue(this.selectedParentIds,iValue));oComboElem.options[oComboElem.length]=opt;}}
this.fillContentParentComboFrontByAtt=function(iContentTypeId,sAttCode,sObjectName){var i;var oComboElem=document.getElementById(sObjectName);if(oComboElem==null)return;var oNodeList=this.getFrontContentListByTypeIdAndAtt(iContentTypeId,sAttCode);for(i=0;i<oNodeList.length;i++){var oNode=oNodeList[i];var iValue=oNode.childNodes[0].firstChild.data;var sDesc=oNode.childNodes[1].firstChild.data;var opt=new Option(sDesc,iValue);oComboElem.options[oComboElem.length]=opt;}
for(i=0;i<oComboElem.options.length;i++){var opt=oComboElem.options[i];if(this.arrayContainsValue(this.selectedParentIds,opt.value)){opt.selected=true;break;}}}
this.fillContentParentComboFront=function(iContentTypeId,sObjectName){var i;var oComboElem=document.getElementById(sObjectName);if(oComboElem==null)return;oComboElem.name="content_parent_"+this.posId;var oNodeList=this.getFrontContentListByTypeId(iContentTypeId);for(i=0;i<oNodeList.length;i++){var oNode=oNodeList[i];var iValue=oNode.childNodes[0].firstChild.data;var sDesc=oNode.childNodes[1].firstChild.data;var opt=new Option(sDesc,iValue);oComboElem.options[oComboElem.length]=opt;}
for(i=0;i<oComboElem.options.length;i++){var opt=oComboElem.options[i];if(this.arrayContainsValue(this.selectedParentIds,opt.value)){opt.selected=true;break;}}}
this.fillContentParentComboWithParents=function(iContentTypeId,sObjectName,oParentIds){var i;var oComboElem=document.getElementById(sObjectName);if(oComboElem==null)return;oComboElem.name="content_parent_"+this.posId;var oNodeList=this.getContentListByTypeIdAndParents(iContentTypeId,oParentIds);for(i=0;i<oNodeList.length;i++){var oNode=oNodeList[i];var iValue=oNode.childNodes[0].firstChild.data;var sDesc=oNode.childNodes[1].firstChild.data;var opt=new Option(sDesc,iValue);opt.selected=(this.arrayContainsValue(this.selectedParentIds,iValue));oComboElem.options[oComboElem.length]=opt;}}
this.getFieldMultipleValues=function(sFieldName){var i,j;var scat_id='';var a_values=new Array();var oElems=document.getElementsByName(sFieldName);if(oElems==null)return scat_id;for(j=0;j<oElems.length;j++){var oElem=oElems[j];if(oElem.options){for(i=0;i<oElem.options.length;i++){if(oElem.options[i].selected){if(!this.arrayContainsValue(a_values,oElem.options[i].value)){a_values[a_values.length]=oElem.options[i].value;if(scat_id!=null&&scat_id!='')scat_id+=',';scat_id+=oElem.options[i].value;}}}}else{if(oElem.checked){if(!this.arrayContainsValue(a_values,oElem.value)){if(scat_id!=null&&scat_id!='')scat_id+=',';scat_id+=oElem.value;}}}}
return scat_id;}}
function WishListManager()
{this.addToWishList=function(sCode,sId){var bOK=false;var oAjax=new WBE_AjaxClass();oAjax.clear();oAjax.addPostParameter('wl_item_id',sId);oAjax.addPostParameter('wl_item_code',sCode);xmlObj=oAjax.throwEventXML('wish_list_add');if(xmlObj){bOK=true;}
if(!bOK)
alert('Se ha producido un error');else{document.location.reload();}};this.removeFromWishList=function(sCode,sId){var bOK=false;var oAjax=new WBE_AjaxClass();oAjax.clear();oAjax.addPostParameter('wl_item_id',sId);oAjax.addPostParameter('wl_item_code',sCode);xmlObj=oAjax.throwEventXML('wish_list_remove');if(xmlObj){bOK=true;}
if(!bOK)
alert('Se ha producido un error');else{document.location.reload();}};this.saveAndNew=function(){var bOK=false;var oAjax=new WBE_AjaxClass();oAjax.clear();xmlObj=oAjax.throwEventXML('wish_list_save_and_new');if(xmlObj){bOK=true;}
if(!bOK)
alert('Se ha producido un error');else{document.location.reload();}};}
var ___WLM=new WishListManager();function WBEFormValidator()
{this.NIFValidator=new NIF_CIFValidator();this.posId=1;this.sLng='es';this.groupErrorMsg=false;this.showAllErrorMsg=false;this.sMsgMandatoryField="Por favor, introduzca un valor en el campo ";this.sMsgMaxLength="El texto introducido es demasiado largo. Actualmente tiene #current# caracteres. El máximo permitido es #max#."
this.oErrorLayer=null;this.LOGIN="^[a-zA-Z0-9_-]+$";this.PASSWORD="^[a-zA-Z0-9_-]+$";this.EMAIL="^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,4})+$";this.URL="(((file|gopher|news|nntp|telnet|http|ftp|https|ftps|sftp)://)|(www\\.))+(([a-zA-Z0-9\\._-]+\\.[a-zA-Z]{2,6})|([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}))(/[a-zA-Z0-9\\&amp;%_\\./-~-]*)?";this.DIRECCIONWEB="(http://)*(([a-zA-Z0-9\\._-]+\\.[a-zA-Z]{2,6})|([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}))(/[a-zA-Z0-9\\&amp;%_\\./-~-]*)?";this.FECHA="^\\d{1,2}/\\d{1,2}/\\d{4}$";this.HORA="^\\d{1,2}:\\d{2}$";this.MATRICULA="^(\\d{4}[BCDFGHJKLMNPRSTVWXYZbcdfghjklmnprstvwxyz]{3})$|^([a-zA-Z]{1,2}\\d{4}[a-zA-Z]{1,2})$";this.ENTERO="^(-|[0-9])[0-9]*$";this.FLOAT="^(-|[0-9])[0-9]*(,|\.)[0-9]+$";this.POSTCODE="^\\d{5}$";this.TELEFONO="^\\d{9}$";this.WEBDIR="^[a-z0-9_·áàéèíïóòúüñç]+$";this.NOMBREDOMINIO="^[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])";this.MONEDA="^[0-9]{1,3}(\\.[0-9]{3})*(,[0-9]{1,2})?$|^[0-9]+(,[0-9]{1,2})?$";this.FLOAT2="^-?[0-9]+(,|\.)[0-9]+$";this.LOGIN_MIN_LONG=5;this.PASSWORD_MIN_LONG=5;this.setErrorLayerById=function(sId){this.oErrorLayer=document.getElementById(sId);};this.setErrorLayer=function(elem){this.oErrorLayer=elem;};this.check_frames=false;this.bJustResult=false;sInvalidDefault_es="Formato inválido, por favor revise los datos";this.texts_es=new Array();this.texts_es[0]="Por favor, rellene los campos obligatorios.";this.texts_es[1]="El texto introducido es demasiado largo. Actualmente tiene #current# caracteres. El máximo permitido es #max#.";this.texts_es[2]="Debe especificar un filtro de más de tres letras.";this.texts_es[3]="El login o nombre de usuario sólo admite letras, números, guiones, y guiones bajos.\nLa longitud mínima es de "+this.LOGIN_MIN_LONG+" caracteres.";this.texts_es[4]="El nombre de dominio no puede tener menos de tres caracteres.\n No debe contener la letra ñ ni vocales acentuadas.";this.texts_es[5]="El password o clave de acceso sólo admite letras, números, guiones, y guiones bajos.\nLa longitud mínima es de "+this.PASSWORD_MIN_LONG+" caracteres.";this.texts_es[6]="Debe escribir una dirección de correo válida";this.texts_es[7]=sInvalidDefault_es;this.texts_es[8]=sInvalidDefault_es;this.texts_es[9]=sInvalidDefault_es;this.texts_es[10]="Formato de fecha incorrecto. Formato correcto: dd/mm/aaaa";this.texts_es[11]=sInvalidDefault_es;this.texts_es[12]="NIF incorrecto. No debe contener ni guiones ni espacios.\n\nEj. 99999999P";this.texts_es[13]="CIF incorrecto. No debe contener ni guiones ni espacios.\n\nEj. B99999999";this.texts_es[14]="NIF / CIF incorrecto. No debe contener ni guiones ni espacios.\n\nEj. B99999999";this.texts_es[15]="Tarjeta de residencia incorrecta.  No debe contener ni guiones ni espacios. Ej. X00000000P";this.texts_es[16]="La matrícula debe ser de la forma: 1111BBB o AA1111AA";this.texts_es[17]="Debe escribir un número entero";this.texts_es[18]="Debe escribir un número decimal XX,XX";this.texts_es[19]="Código postal incorrecto";this.texts_es[20]="Número incorrecto.\nDebe ser de la forma: 991112233 y contener 9 dígitos.";this.texts_es[21]="Directorio incorrecto. Sólo se pueden introducir caracteres en minúsculas, números y el carácter subrayado.";this.texts_es[22]=sInvalidDefault_es;this.texts_es[23]="Fecha incorrecta";this.texts_es[24]="Cuenta bancaria incorrecta";this.texts_es[25]="El valor no coincide con su duplicado";this.texts_es[26]="-> Existen campos obligatorios sin rellenar.\n";sInvalidDefault_ca="Format invàlid. Per favor, revise les dades introduides";this.texts_ca=new Array();this.texts_ca[0]="Per favor, cal introduir un valor al camp";this.texts_ca[1]="El text introduit es massa llarg. Actualment te #current# caracters. El màxim permés es #max#.";this.texts_ca[2]="Cal especificar un filtre de mes de 3 lletres.";this.texts_ca[3]="El login sols admet lletres, nombres, guions, y guions baixos.\nLa longitud mínima es de "+this.LOGIN_MIN_LONG+" caracters.";this.texts_ca[4]="El nom de domini no pot tenir menys de 3 caracters.\n No pot contindre la lletra ñ ni vocals acentuades.";this.texts_ca[5]="El password sols admet lletres, nombres, guions, y guions baixos.\nLa longitud mínima es de "+this.PASSWORD_MIN_LONG+" caracters.";this.texts_ca[6]="Deu escriure una adressa de email correcta";this.texts_ca[7]=sInvalidDefault_ca;this.texts_ca[8]=sInvalidDefault_ca;this.texts_ca[9]=sInvalidDefault_ca;this.texts_ca[10]="Format de la data incorrecte. Format correcte: dd/mm/aaaa";this.texts_ca[11]=sInvalidDefault_ca;this.texts_ca[12]="NIF incorrecte. No pot contindre ni guions ni espais.\n\nEj. 99999999P";this.texts_ca[13]="CIF incorrecte. No pot contindre ni guions ni espais.\n\nEj. B99999999";this.texts_ca[14]="NIF / CIF incorrecte. No pot contindre ni guions ni espais.\n\nEj. B99999999";this.texts_ca[15]="Tarjeta de residencia incorrecta. No pot contindre ni guions ni espais. Ej. X00000000P";this.texts_ca[16]="La matrícula deu ser de la forma: 1111BBB o AA1111AA";this.texts_ca[17]="Deu escriure un nombre senser";this.texts_ca[18]="Deu escriure un nombre decimal XX,XX";this.texts_ca[19]="Codi postal incorrecte";this.texts_ca[20]="Nombre incorrecte.\nDeu ser de la forma: 991112233 y contindre 9 dígits.";this.texts_ca[21]="Directori incorrecte. Sóls es poden introduir caracters en minúscules, nombres y el subratllat.";this.texts_ca[22]=sInvalidDefault_ca;this.texts_ca[23]="Data incorrecta";this.texts_ca[24]="Compte bancari incorrecte";this.texts_ca[25]="El valor no hi coincideix amb el duplicat";this.texts_ca[26]="-> Existeixen camps obligatoris sense plenar.\n";sInvalidDefault_en="Invalid format, please review input values";this.texts_en=new Array();this.texts_en[0]="Text field required";this.texts_en[1]="Text too long. You have typed #current# letters. Maximum letters allowed is #max# chars.";this.texts_en[2]="At least must type 3 chars.";this.texts_en[3]="El login sols admet lletres, nombres, guions, y guions baixos.\nLa longitud mínima es de "+this.LOGIN_MIN_LONG+" caracters.";this.texts_en[4]="El nom de domini no pot tenir menys de 3 caracters.\n No pot contindre la lletra ñ ni vocals acentuades.";this.texts_en[5]="El password sols admet lletres, nombres, guions, y guions baixos.\nLa longitud mínima es de "+this.PASSWORD_MIN_LONG+" caracters.";this.texts_en[6]="Deu escriure una adressa de correu correcta";this.texts_en[7]=sInvalidDefault_en;this.texts_en[8]=sInvalidDefault_en;this.texts_en[9]=sInvalidDefault_en;this.texts_en[10]="Format de la data incorrecte. Format correcte: dd/mm/aaaa";this.texts_en[11]=sInvalidDefault_en;this.texts_en[12]="NIF incorrecte. No pot contindre ni guions ni espais.\n\nEj. 99999999P";this.texts_en[13]="CIF incorrecte. No pot contindre ni guions ni espais.\n\nEj. B99999999";this.texts_en[14]="NIF / CIF incorrecte. No pot contindre ni guions ni espais.\n\nEj. B99999999";this.texts_en[15]="Tarjeta de residencia incorrecta. No pot contindre ni guions ni espais. Ej. X00000000P";this.texts_en[16]="La matrícula deu ser de la forma: 1111BBB o AA1111AA";this.texts_en[17]="Deu escriure un nombre senser";this.texts_en[18]="Deu escriure un nombre decimal XX,XX";this.texts_en[19]="Codi postal incorrecte";this.texts_en[20]="Nombre incorrecte.\nDeu ser de la forma: 991112233 y contindre 9 dígits.";this.texts_en[21]="Directori incorrecte. Sóls es poden introduir caracters en minúscules, nombres y el subratllat.";this.texts_en[22]=sInvalidDefault_en;this.texts_en[23]="Data incorrecta";this.texts_en[24]="Compte bancari incorrecte";this.texts_en[25]="El valor no hi coincideix amb el duplicat";this.texts_en[26]="-> Existeixen camps obligatoris sense plenar.\n";this.getText=function(sCode)
{switch(this.sLng){case'es':{switch(sCode){case'MandatoryField':return this.texts_es[0];break;case'MaxLength':return this.texts_es[1];break;case'InvalidFormat':return sInvalidDefault_es;break;case'SEARCH_BOX':return this.texts_es[2];break;case'LOGIN':return this.texts_es[3];break;case'NOMBREDOMINIO':return this.texts_es[4];break;case'PASSWORD':return this.texts_es[5];break;case'EMAIL':return this.texts_es[6];break;case'URL':return this.texts_es[7];break;case'DIRECCIONWEB':return this.texts_es[8];break;case'MONEDA':return this.texts_es[9];break;case'FECHA':return this.texts_es[10];break;case'HORA':return this.texts_es[11];break;case'NIF':return this.texts_es[12];break;case'CIF':return this.texts_es[13];break;case'NIF_CIF':return this.texts_es[14];break;case'TARJ_RESID':return this.texts_es[15];break;case'MATRICULA':return this.texts_es[16];break;case'ENTERO':return this.texts_es[17];break;case'FLOTANTE':return this.texts_es[18];break;case'POSTCODE':return this.texts_es[19];break;case'TELEFONO':return this.texts_es[20];break;case'WEBDIR':return this.texts_es[21];break;case'STRING':return this.texts_es[22];break;case'threefieldsdate':return this.texts_es[23];break;case'bankAccount':return this.texts_es[24];break;case'compareWith':return this.texts_es[25];break;case'errorMandatoryPresent':return this.texts_es[26];break;}}break;case'ca':{switch(sCode){case'MandatoryField':return this.texts_ca[0];break;case'MaxLength':return this.texts_ca[1];break;case'InvalidFormat':return sInvalidDefault_ca;break;case'SEARCH_BOX':return this.texts_ca[2];break;case'LOGIN':return this.texts_ca[3];break;case'NOMBREDOMINIO':return this.texts_ca[4];break;case'PASSWORD':return this.texts_ca[5];break;case'EMAIL':return this.texts_ca[6];break;case'URL':return this.texts_ca[7];break;case'DIRECCIONWEB':return this.texts_ca[8];break;case'MONEDA':return this.texts_ca[9];break;case'FECHA':return this.texts_ca[10];break;case'HORA':return this.texts_ca[11];break;case'NIF':return this.texts_ca[12];break;case'CIF':return this.texts_ca[13];break;case'NIF_CIF':return this.texts_ca[14];break;case'TARJ_RESID':return this.texts_ca[15];break;case'MATRICULA':return this.texts_ca[16];break;case'ENTERO':return this.texts_ca[17];break;case'FLOTANTE':return this.texts_ca[18];break;case'POSTCODE':return this.texts_ca[19];break;case'TELEFONO':return this.texts_ca[20];break;case'WEBDIR':return this.texts_ca[21];break;case'STRING':return this.texts_ca[22];break;case'threefieldsdate':return this.texts_ca[23];break;case'bankAccount':return this.texts_ca[24];break;case'compareWith':return this.texts_ca[25];break;case'errorMandatoryPresent':return this.texts_ca[26];break;}}break;case'en':{switch(sCode){case'MandatoryField':return this.texts_en[0];break;case'MaxLength':return this.texts_en[1];break;case'InvalidFormat':return sInvalidDefault_en;break;case'SEARCH_BOX':return this.texts_en[2];break;case'LOGIN':return this.texts_en[3];break;case'NOMBREDOMINIO':return this.texts_en[4];break;case'PASSWORD':return this.texts_en[5];break;case'EMAIL':return this.texts_en[6];break;case'URL':return this.texts_en[7];break;case'DIRECCIONWEB':return this.texts_en[8];break;case'MONEDA':return this.texts_en[9];break;case'FECHA':return this.texts_en[10];break;case'HORA':return this.texts_en[11];break;case'NIF':return this.texts_en[12];break;case'CIF':return this.texts_en[13];break;case'NIF_CIF':return this.texts_en[14];break;case'TARJ_RESID':return this.texts_en[15];break;case'MATRICULA':return this.texts_en[16];break;case'ENTERO':return this.texts_en[17];break;case'FLOTANTE':return this.texts_en[18];break;case'POSTCODE':return this.texts_en[19];break;case'TELEFONO':return this.texts_en[20];break;case'WEBDIR':return this.texts_en[21];break;case'STRING':return this.texts_en[22];break;case'threefieldsdate':return this.texts_en[23];break;case'bankAccount':return this.texts_en[24];break;case'compareWith':return this.texts_en[25];break;case'errorMandatoryPresent':return this.texts_en[26];break;}}break;}}
this.validateForm=function(formulario,pos_id,isRecursive,bJustResult)
{this.bJustResult=bJustResult;this.errorObjElements=new Array();this.errorFormatMsg=new Array();if(pos_id)pos_id=''+pos_id;for(var i=0;i<formulario.elements.length;i++)
{var elem=formulario.elements[i];var bvalidate=true;if(!elem.name){bvalidate=false;}else{var iLPos=(pos_id!=null&&elem.name.lastIndexOf('_'+pos_id)>=0)?elem.name.length-(pos_id.length+1):0;if(pos_id&&(elem.name.lastIndexOf('_'+pos_id)!=iLPos)){bvalidate=false;}}
if(bvalidate){if(elem.getAttribute("required"))
{var msgMandatoryField=elem.getAttribute("msgRequired");if(msgMandatoryField==null){msgMandatoryField=this.getText('MandatoryField');}
elem.style.backgroundColor='';switch(elem.type)
{case'':case'hidden':if(elem.value=='')
{this.ShowErrorMessage(msgMandatoryField,null);if(!this.groupErrorMsg)return false;}
break;case'file':if(elem.value=='')
{this.ShowErrorMessage(msgMandatoryField,null);if(!this.groupErrorMsg)return false;}
break;case'text':if(this.trimAll(elem.value)==''){this.ShowErrorMessage(msgMandatoryField,elem);if(!this.groupErrorMsg)return false;}
if(elem.defaultVal&&(elem.value==elem.defaultVal))
{this.ShowErrorMessage(msgMandatoryField,elem);if(!this.groupErrorMsg)return false;}
break;case'password':if(elem.value==''){this.ShowErrorMessage(msgMandatoryField,elem);if(!this.groupErrorMsg)return false;}
if(elem.defaultVal&&(elem.value==elem.defaultVal))
{this.ShowErrorMessage(msgMandatoryField,elem);if(!this.groupErrorMsg)return false;}
break;case'textarea':if(elem.value=='')
{this.ShowErrorMessage(msgMandatoryField,elem);if(!this.groupErrorMsg)return false;}
break;case'select-one':if(elem.value=='')
{this.ShowErrorMessage(msgMandatoryField,elem);if(!this.groupErrorMsg)return false;}
break;case'checkbox':if(!elem.checked)
{this.ShowErrorMessage(msgMandatoryField,elem);if(!this.groupErrorMsg)return false;}
break;case'radio':var seleccionado=false;var j=0;while(formulario.elements[i+j].type=='radio'&&elem.name==formulario.elements[i+j].name)
{if(formulario.elements[i+j].checked)seleccionado=true;if(i+j-1>=formulario.elements.length)break;j++;}
j=0;while(formulario.elements[i-j].type=='radio'&&elem.name==formulario.elements[i-j].name)
{if(formulario.elements[i-j].checked)seleccionado=true;if(i-j<=0)break;j++;}
if(!seleccionado)
{this.ShowErrorMessage(msgMandatoryField,elem);if(!this.groupErrorMsg)return false;}
break;}}
if(elem.getAttribute("maxTextLength"))
{var msgMaxLength=elem.getAttribute("msgMaxLength");if(msgMaxLength==null){msgMaxLength=this.getText('MaxLength');}
if(elem.value.length>elem.getAttribute("maxTextLength"))
{msgMaxLength=msgMaxLength.substring(0,msgMaxLength.indexOf('#current#'))+elem.value.length+msgMaxLength.substring(msgMaxLength.indexOf('#current#')+9);msgMaxLength=msgMaxLength.substring(0,msgMaxLength.indexOf('#max#'))+elem.getAttribute("maxTextLength")+msgMaxLength.substring(msgMaxLength.indexOf('#max#')+5);this.ShowErrorMessage(msgMaxLength,elem);if(!this.groupErrorMsg)return false;}}
var msgInvalidFormat=elem.getAttribute("msgInvalid");if(msgInvalidFormat!=null)msgInvalidFormat=this.getText('InvalidFormat').replace(/\\n/g,"\n");var bForzeError=false;switch(elem.type)
{case'':case'text':case'password':if(elem.getAttribute("expresionRegular")!=null&&elem.value!=''){var expresionRegular=elem.getAttribute("expresionRegular");var valor=elem.value;var re;switch(expresionRegular)
{case'SEARCH_BOX':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('SEARCH_BOX');}
bForzeError=(valor.length<3);re=null;break;case'LOGIN':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('LOGIN');}
bForzeError=(valor.length<this.LOGIN_MIN_LONG);re=new RegExp(this.LOGIN);break;case'NOMBREDOMINIO':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('NOMBREDOMINIO');}
re=new RegExp(this.NOMBREDOMINIO);break;case'PASSWORD':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('PASSWORD');}
bForzeError=(valor.length<this.PASSWORD_MIN_LONG);re=new RegExp(this.PASSWORD);break;case'EMAIL':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('EMAIL');}
re=new RegExp(this.EMAIL);break;case'URL':re=new RegExp(this.URL);break;case'DIRECCIONWEB':re=new RegExp(this.DIRECCIONWEB);break;case'MONEDA':case'MONEY':re=new RegExp(this.MONEDA);break;case'FECHA':case'DATE':re=new RegExp(this.FECHA);if(msgInvalidFormat==null)msgInvalidFormat=this.getText('FECHA');bForzeError=!this.chkdate(elem,null);break;case'HORA':case'HOUR':re=new RegExp(this.HORA);bForzeError=!this.chkHora(elem);break;case'NIF':if(msgInvalidFormat==null)msgInvalidFormat=this.getText('NIF');re=null;bForzeError=!this.NIFValidator.checkNIF(valor);break;case'CIF':if(msgInvalidFormat==null)msgInvalidFormat=this.getText('CIF');re=null;bForzeError=!this.NIFValidator.checkCIF(valor);break;case'NIF_CIF':if(msgInvalidFormat==null)msgInvalidFormat=this.getText('NIF_CIF');re=null;bForzeError=!this.NIFValidator.checkAll(valor);break;case'TARJ_RESID':if(msgInvalidFormat==null)msgInvalidFormat=this.getText('TARJ_RESID');re=null;bForzeError=!this.NIFValidator.checkTR(valor);break;case'TARJ_RESID_NIF':if((valor.charAt(0).toUpperCase()!="X")&&(valor.charAt(0).toUpperCase()!="Y")&&(valor.charAt(0).toUpperCase()!="Z")){if(msgInvalidFormat==null)msgInvalidFormat=this.getText('NIF');bForzeError=!this.NIFValidator.checkNIF(valor);}else{if(msgInvalidFormat==null)msgInvalidFormat=this.getText('TARJ_RESID');bForzeError=!this.NIFValidator.checkTR(valor);}
re=null;break;case'MATRICULA':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('MATRICULA');}
re=new RegExp(this.MATRICULA);break;case'DECIMAL':case'ENTERO':case'INT':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('ENTERO');}
re=new RegExp(this.ENTERO);break;case'FLOTANTE':case'FLOAT':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('FLOTANTE');}
re=new RegExp(this.FLOAT);break;case'FLOAT2':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('FLOTANTE');}
re=new RegExp(this.FLOAT2);break;case'POSTCODE':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('POSTCODE');}
re=new RegExp(this.POSTCODE);break;case'TELEFONO':case'PHONE':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('TELEFONO');}
re=new RegExp(this.TELEFONO);break;case'WEBDIR':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('WEBDIR');}
re=new RegExp(this.WEBDIR);break;case'STRING':re=null;break;default:re=new RegExp(expresionRegular);}
var customMsg=elem.getAttribute("errorMessage");if(customMsg&&customMsg!='')msgInvalidFormat=customMsg;if(msgInvalidFormat==null)msgInvalidFormat=this.getText('InvalidFormat');if(bForzeError||(re&&!re.test(valor))){this.ShowErrorMessage(msgInvalidFormat,elem,true);if(!this.groupErrorMsg)return false;}}}
if(elem.getAttribute("threefieldsdate")!=null&&elem.value!=''){if(msgInvalidFormat==null){msgInvalidFormat=this.getText('threefieldsdate');}
var threeFieldsValue=elem.getAttribute("threefieldsdate_"+this.pos_id);var day,month,year;var fullDate;var aFields=threeFieldsValue.split(",");if(aFields.length==3){day=document.getElementById(aFields[0]);month=document.getElementById(aFields[1]);year=document.getElementById(aFields[2]);fullDate=day.value+"/"+month.value+"/"+year.value;if(fullDate!=null){if(!chkdate(null,fullDate)){this.ShowErrorMessage(msgInvalidFormat,day);if(!this.groupErrorMsg)return false;}}}}
if(elem.getAttribute("bankAccount")!=null&&elem.value!=''){if(msgInvalidFormat==null){msgInvalidFormat=this.getText('bankAccount');}
var accountValues=elem.getAttribute("bankAccount_"+this.pos_id)
var entidad,oficina,cuenta,digitoControl;var aFields=accountValues.split(",");if(aFields.length==4){entidad=document.getElementById(aFields[0]);oficina=document.getElementById(aFields[1]);digitoControl=document.getElementById(aFields[2]);cuenta=document.getElementById(aFields[3]);if(entidad.value!=null){if(!checkDC(entidad.value+oficina.value,cuenta.value,digitoControl.value)){this.ShowErrorMessage(msgInvalidFormat,entidad);if(!this.groupErrorMsg)return false;}}}}
if(elem.getAttribute("compareWith"))
{var elem2=formulario.elements[elem.getAttribute("compareWith")];if(elem.value!=elem2.value){var msgNotEqual=elem.getAttribute("msgNotEqual")
if(msgNotEqual==null){msgNotEqual=this.getText('compareWith');}
this.ShowErrorMessage(msgNotEqual,elem);if(!this.groupErrorMsg)return false;}}}}
if(!isRecursive)
{var bFramesOk=true;if(this.check_frames)
{var nframes=window.frames.length;var oFrame;for(var i=0;i<nframes;i++){oFrame=window.frames[i];if(oFrame.document.forms[0]){var oFrmVal=new WBEFormValidator();var bFrameOk=oFrmVal.validateForm(oFrame.document.forms[0],'',true,true);this.bJustResult=false;if(!bFrameOk)
this.ShowErrorMessage(msgMandatoryField,oFrame.frameElement,false)
bFramesOk=bFramesOk&&bFrameOk;}}}}
if(this.groupErrorMsg)return this.showGroupedErrorMsgs();return true;}
this.validateFormWithPrefix=function(formulario,prefix)
{this.errorObjElements=new Array();this.errorFormatMsg=new Array();if(prefix)prefix=''+prefix;for(var i=0;i<formulario.elements.length;i++)
{var elem=formulario.elements[i];var bvalidate=true;if(!elem.name){bvalidate=false;}else{if(prefix&&prefix!=''&&(elem.name.indexOf(prefix)!=0)){bvalidate=false;}}
if(bvalidate){if(elem.getAttribute("required"))
{var msgMandatoryField=elem.getAttribute("msgRequired");if(msgMandatoryField==null){msgMandatoryField=this.getText('MandatoryField');}
elem.style.backgroundColor='';switch(elem.type)
{case'':case'hidden':if(elem.value=='')
{this.ShowErrorMessage(msgMandatoryField,null);if(!this.groupErrorMsg)return false;}
break;case'file':if(elem.value=='')
{this.ShowErrorMessage(msgMandatoryField,null);if(!this.groupErrorMsg)return false;}
break;case'text':case'password':if(elem.value==''){this.ShowErrorMessage(msgMandatoryField,elem);if(!this.groupErrorMsg)return false;}
if(elem.defaultVal&&(elem.value==elem.defaultVal))
{this.ShowErrorMessage(msgMandatoryField,elem);if(!this.groupErrorMsg)return false;}
break;case'textarea':if(elem.value=='')
{this.ShowErrorMessage(msgMandatoryField,elem);if(!this.groupErrorMsg)return false;}
break;case'select-one':if(elem.value=='')
{this.ShowErrorMessage(msgMandatoryField,elem);if(!this.groupErrorMsg)return false;}
break;case'checkbox':if(!elem.checked)
{this.ShowErrorMessage(msgMandatoryField,elem);if(!this.groupErrorMsg)return false;}
break;case'radio':var seleccionado=false;var j=0;while(formulario.elements[i+j].type=='radio'&&elem.name==formulario.elements[i+j].name)
{if(formulario.elements[i+j].checked)seleccionado=true;if(i+j-1>=formulario.elements.length)break;j++;}
j=0;while(formulario.elements[i-j].type=='radio'&&elem.name==formulario.elements[i-j].name)
{if(formulario.elements[i-j].checked)seleccionado=true;if(i-j<=0)break;j++;}
if(!seleccionado)
{this.ShowErrorMessage(msgMandatoryField,elem);if(!this.groupErrorMsg)return false;}
break;}}
if(elem.getAttribute("maxTextLength"))
{var msgMaxLength=elem.getAttribute("msgMaxLength");if(msgMaxLength==null){msgMaxLength=this.getText('MaxLength');}
if(elem.value.length>elem.getAttribute("maxTextLength"))
{msgMaxLength=msgMaxLength.substring(0,msgMaxLength.indexOf('#current#'))+elem.value.length+msgMaxLength.substring(msgMaxLength.indexOf('#current#')+9);msgMaxLength=msgMaxLength.substring(0,msgMaxLength.indexOf('#max#'))+elem.getAttribute("maxTextLength")+msgMaxLength.substring(msgMaxLength.indexOf('#max#')+5);this.ShowErrorMessage(msgMaxLength,elem);if(!this.groupErrorMsg)return false;}}
var msgInvalidFormat=elem.getAttribute("msgInvalid");if(msgInvalidFormat!=null)msgInvalidFormat=this.getText('InvalidFormat').replace(/\\n/g,"\n");var bForzeError=false;switch(elem.type)
{case'':case'text':case'password':if(elem.getAttribute("expresionRegular")!=null&&elem.value!=''){var expresionRegular=elem.getAttribute("expresionRegular");var valor=elem.value;var re;switch(expresionRegular)
{case'SEARCH_BOX':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('SEARCH_BOX');}
bForzeError=(valor.length<3);re=null;break;case'LOGIN':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('LOGIN');}
bForzeError=(valor.length<this.LOGIN_MIN_LONG);re=new RegExp(this.LOGIN);break;case'NOMBREDOMINIO':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('NOMBREDOMINIO');}
re=new RegExp(this.NOMBREDOMINIO);break;case'PASSWORD':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('PASSWORD');}
bForzeError=(valor.length<this.PASSWORD_MIN_LONG);re=new RegExp(this.PASSWORD);break;case'EMAIL':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('EMAIL');}
re=new RegExp(this.EMAIL);break;case'URL':re=new RegExp(this.URL);break;case'MONEDA':case'MONEY':re=new RegExp(this.MONEDA);break;case'FECHA':case'DATE':re=new RegExp(this.FECHA);if(msgInvalidFormat==null)msgInvalidFormat=this.getText('FECHA');bForzeError=!this.chkdate(elem,null);break;case'HORA':case'HOUR':re=new RegExp(this.HORA);bForzeError=!this.chkHora(elem);break;case'NIF':if(msgInvalidFormat==null)msgInvalidFormat=this.getText('NIF');re=null;bForzeError=!this.NIFValidator.checkNIF(valor);break;case'CIF':if(msgInvalidFormat==null)msgInvalidFormat=this.getText('CIF');re=null;bForzeError=!this.NIFValidator.checkCIF(valor);break;case'NIF_CIF':if(msgInvalidFormat==null)msgInvalidFormat=this.getText('NIF_CIF');re=null;bForzeError=!this.NIFValidator.checkAll(valor);break;case'TARJ_RESID':if(msgInvalidFormat==null)msgInvalidFormat=this.getText('TARJ_RESID');re=null;bForzeError=!this.NIFValidator.checkTR(valor);break;case'TARJ_RESID_NIF':if((valor.charAt(0).toUpperCase()!="X")&&(valor.charAt(0).toUpperCase()!="Y")&&(valor.charAt(0).toUpperCase()!="Z")){if(msgInvalidFormat==null)msgInvalidFormat=this.getText('NIF');bForzeError=!this.NIFValidator.checkNIF(valor);}else{if(msgInvalidFormat==null)msgInvalidFormat=this.getText('TARJ_RESID');bForzeError=!this.NIFValidator.checkTR(valor);}
re=null;break;case'MATRICULA':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('MATRICULA');}
re=new RegExp(this.MATRICULA);break;case'ENTERO':case'INT':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('ENTERO');}
re=new RegExp(this.ENTERO);break;case'FLOTANTE':case'FLOAT':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('FLOTANTE');}
re=new RegExp(this.FLOAT);break;case'POSTCODE':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('POSTCODE');}
re=new RegExp(this.POSTCODE);break;case'TELEFONO':case'PHONE':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('TELEFONO');}
re=new RegExp(this.TELEFONO);break;case'WEBDIR':if(msgInvalidFormat==null){msgInvalidFormat=this.getText('WEBDIR');}
re=new RegExp(this.WEBDIR);break;case'STRING':re=null;break;default:re=new RegExp(expresionRegular);}
var customMsg=elem.getAttribute("errorMessage");if(customMsg&&customMsg!='')msgInvalidFormat=customMsg;if(msgInvalidFormat==null)msgInvalidFormat=this.getText('InvalidFormat');if(bForzeError||(re&&!valor.match(re))){this.ShowErrorMessage(msgInvalidFormat,elem,true);if(!this.groupErrorMsg)return false;}}}
if(elem.getAttribute("threefieldsdate")!=null&&elem.value!=''){if(msgInvalidFormat==null){msgInvalidFormat=this.getText('threefieldsdate');}
var threeFieldsValue=elem.getAttribute("threefieldsdate_"+this.pos_id);var day,month,year;var fullDate;var aFields=threeFieldsValue.split(",");if(aFields.length==3){day=document.getElementById(aFields[0]);month=document.getElementById(aFields[1]);year=document.getElementById(aFields[2]);fullDate=day.value+"/"+month.value+"/"+year.value;if(fullDate!=null){if(!chkdate(null,fullDate)){this.ShowErrorMessage(msgInvalidFormat,day);if(!this.groupErrorMsg)return false;}}}}
if(elem.getAttribute("bankAccount")!=null&&elem.value!=''){if(msgInvalidFormat==null){msgInvalidFormat=this.getText('bankAccount');}
var accountValues=elem.getAttribute("bankAccount_"+this.pos_id)
var entidad,oficina,cuenta,digitoControl;var aFields=accountValues.split(",");if(aFields.length==4){entidad=document.getElementById(aFields[0]);oficina=document.getElementById(aFields[1]);digitoControl=document.getElementById(aFields[2]);cuenta=document.getElementById(aFields[3]);if(entidad.value!=null){if(!checkDC(entidad.value+oficina.value,cuenta.value,digitoControl.value)){this.ShowErrorMessage(msgInvalidFormat,entidad);if(!this.groupErrorMsg)return false;}}}}
if(elem.getAttribute("compareWith"))
{var elem2=formulario.elements[elem.getAttribute("compareWith")];if(elem.value!=elem2.value){var msgNotEqual=elem.getAttribute("msgNotEqual")
if(msgNotEqual==null){msgNotEqual=this.getText('compareWith');}
this.ShowErrorMessage(msgNotEqual,elem);if(!this.groupErrorMsg)return false;}}}}
if(this.groupErrorMsg)return this.showGroupedErrorMsgs();return true;}
this.SetFieldErrorStyle=function(_field,i){if(_field!=null&&_field.style.display!="none"){if((!i)||(i==0))_field.focus();_field.style.backgroundColor='#ffffcc';}}
this.ShowErrorMessage=function(msgMandatoryField,oField,bFormatErrorMsg){if(bFormatErrorMsg==undefined)bFormatErrorMsg=this.showAllErrorMsg;if(this.onErrorHandler!=null)this.onErrorHandler(oField);if(this.oErrorLayer==null){if(this.groupErrorMsg){this.errorObjElements[this.errorObjElements.length]=oField;if(!bFormatErrorMsg)
this.errorMandatoryPresent=true;else
if(bFormatErrorMsg)this.errorFormatMsg[this.errorFormatMsg.length]=msgMandatoryField+'\n';}else{if((typeof this.bJustResult=='undefined')||(this.bJustResult==false))this.alertMsg(msgMandatoryField);this.SetFieldErrorStyle(oField);}}else{oErrorLayer.innerHTML='<p><b>'+msgMandatoryField+'</b></p>';oErrorLayer.style.display='';}}
this.showGroupedErrorMsgs=function(){var sMsg='';if(this.errorMandatoryPresent)sMsg+=this.getText('errorMandatoryPresent');for(var i=0;i<this.errorFormatMsg.length;i++){sMsg+='-> '+this.errorFormatMsg[i];}
if(sMsg!=''){for(var i=0;i<this.errorObjElements.length;i++){oField=this.errorObjElements[i];if((typeof this.bJustResult=='undefined')||(this.bJustResult==false))
this.SetFieldErrorStyle(oField,i);}
if((typeof this.bJustResult=='undefined')||(this.bJustResult==false))this.alertMsg(sMsg);return false;}
return true;}
this.alertMsg=function(sMsg){alert(sMsg);}
this.chkdate=function(objName,sValue){var strDatestyle="eu";var strDate;var strDateArray;var strDay;var strMonth;var strYear;var intday;var intMonth;var intYear;var booFound=false;var datefield=objName;var strSeparatorArray=new Array("-"," ","/",".");var intElementNr;var err=0;var strMonthArray=new Array(12);strMonthArray[0]="/01/";strMonthArray[1]="/2/";strMonthArray[2]="/3/";strMonthArray[3]="/4/";strMonthArray[4]="/5/";strMonthArray[5]="/6/";strMonthArray[6]="/7/";strMonthArray[7]="/8/";strMonthArray[8]="/9/";strMonthArray[9]="/10/";strMonthArray[10]="/11/";strMonthArray[11]="/12/";if(datefield!=null){strDate=datefield.value;}
if(sValue!=null){strDate=sValue;}
if(strDate.length<6){return false;}
for(intElementNr=0;intElementNr<strSeparatorArray.length;intElementNr++){if(strDate.indexOf(strSeparatorArray[intElementNr])!=-1){strDateArray=strDate.split(strSeparatorArray[intElementNr]);if(strDateArray.length!=3){err=1;return false;}
else{strDay=strDateArray[0];strMonth=strDateArray[1];strYear=strDateArray[2];}
booFound=true;}}
if(booFound==false){if(strDate.length>5){strDay=strDate.substr(0,2);strMonth=strDate.substr(2,2);strYear=strDate.substr(4);}}
if(strYear.length==2){strYear='20'+strYear;}
if(strDatestyle=="US"){strTemp=strDay;strDay=strMonth;strMonth=strTemp;}
intday=parseInt(strDay,10);if(isNaN(intday)){err=2;return false;}
intMonth=parseInt(strMonth,10);if(isNaN(intMonth)){for(i=0;i<12;i++){if(strMonth.toUpperCase()==strMonthArray[i].toUpperCase()){intMonth=i+1;strMonth=strMonthArray[i];i=12;}}
if(isNaN(intMonth)){err=3;return false;}}
intYear=parseInt(strYear,10);if(isNaN(intYear)){err=4;return false;}
if(intMonth>12||intMonth<1){err=5;return false;}
if((intMonth==1||intMonth==3||intMonth==5||intMonth==7||intMonth==8||intMonth==10||intMonth==12)&&(intday>31||intday<1)){err=6;return false;}
if((intMonth==4||intMonth==6||intMonth==9||intMonth==11)&&(intday>30||intday<1)){err=7;return false;}
if(intMonth==2){if(intday<1){err=8;return false;}
if(this.LeapYear(intYear)==true){if(intday>29){err=9;return false;}}
else{if(intday>28){err=10;return false;}}}
return true;}
this.LeapYear=function(intYear){if(intYear%100==0){if(intYear%400==0){return true;}}
else{if((intYear%4)==0){return true;}}
return false;}
this.chkHora=function(lahora){var arrHora=(lahora.value).split(":");if(arrHora.length!=2){return false;}
if(parseInt(arrHora[0])<0&&parseInt(arrHora[0])>23){return false;}
if(parseInt(arrHora[1])<0&&parseInt(arrHora[1])>59){return false;}
return true;}
this.checkDC=function(cc1,cc2,dc){return true;if(!(cc1.match(/^\d{8}$/)&&cc2.match(/^\d{10}$/)&&dc.match(/^\d{2}$/)))return false;var arrWeights=new Array(1,2,4,8,5,10,9,7,3,6);var dc1=0,dc2=0;for(i=7;i>=0;i--)dc1+=arrWeights[i+2]*cc1.charAt(i);dc1=11-(dc1%11);if(11==dc1)dc1=0;if(10==dc1)dc1=1;for(i=9;i>=0;i--)dc2+=arrWeights[i]*cc2.charAt(i);dc2=11-(dc2%11);if(11==dc2)dc2=0;if(10==dc2)dc2=1;return(10*dc1+dc2==dc);}
this.leftTrim=function(stringToTrim){return stringToTrim.replace(/^\s+/,"");};this.rightTrim=function(stringToTrim){return stringToTrim.replace(/\s+$/,"");};this.trimAll=function(stringToTrim){return stringToTrim.replace(/^\s+|\s+$/g,"");};this.checkMandatoryText=function(elem,error_elem,error_msg){if(elem.value==''){error_elem.innerHTML+=error_msg;return false;}
return true;};this.checkMandatorySelect=function(elem,error_elem,error_msg){if(elem.selectedIndex==-1){error_elem.innerHTML+=error_msg;return false;}
return true;};this.checkMandatoryOpt=function(elem,error_elem,error_msg){var bOK=false;if(elem.value){bOK=elem.checked;}else{for(var i=0;i<elem.length;i++){if(elem[i].checked){bOK=true;break;}}}
if(!bOK){error_elem.innerHTML+=error_msg;return false;}
return true;};this.checkMinLengthText=function(elem,len,error_elem,error_msg){if(this.trimAll(elem.value).length<len){error_elem.innerHTML+=error_msg;return false;}
return true;};this.checkMaxLengthText=function(elem,len,error_elem,error_msg){if(elem.value.length>len){error_elem.innerHTML+=error_msg;return false;}
return true;};this.checkMinLengthSelect=function(elem,len,error_elem,error_msg){var sels=0;for(var i=0;i<elem.options.length;i++){if(elem.options[i].selected)sels++;}
if(sels<len){error_elem.innerHTML+=error_msg;return false;}
return true;};this.checkMaxLengthSelect=function(elem,len,error_elem,error_msg){var sels=0;for(var i=0;i<elem.options.length;i++){if(elem.options[i].selected)sels++;}
if(sels>len){error_elem.innerHTML+=error_msg;return false;}
return true;};this.checkMinLengthOpt=function(elem,len,error_elem,error_msg){var sels=0;if(elem.value){if(elem.checked)sels++;}else{for(var i=0;i<elem.length;i++){if(elem[i].checked){sels++;}}}
if(sels<len){error_elem.innerHTML+=error_msg;return false;}
return true;};this.checkMaxLengthOpt=function(elem,len,error_elem,error_msg){var sels=0;if(elem.value){if(elem.checked)sels++;}else{for(var i=0;i<elem.length;i++){if(elem[i].checked){sels++;}}}
if(sels>len){error_elem.innerHTML+=error_msg;return false;}
return true;};this.getOptValue=function(elem){var sResult='';if(elem.value){if(elem.checked)sResult=elem.value;}else{for(var i=0;i<elem.length;i++){if(elem[i].checked){if(sResult.length!=0)sResult+=",";sResult+=elem[i].value;}}}
return sResult;};this.getMultiSelectValue=function(elem){var sResult='';for(var i=0;i<elem.options.length;i++){if(elem.options[i].selected){if(sResult.length!=0)sResult+=",";sResult+=elem[i].value;}}
return sResult;};this.changeIds=function changeIds(elem,pattern,text){var x=elem.childNodes;if(x){for(var i=0;i<x.length;i++){changeIds(x[i],pattern,text);if(x[i].id){x[i].id=x[i].id.replace(pattern,text);}
if(x[i].attributes){for(var j=0;j<x[i].attributes.length;j++){if((x[i].attributes[j].nodeName.toLowerCase()=='for')||(x[i].attributes[j].nodeName.toLowerCase()=='href')||(x[i].attributes[j].nodeName.toLowerCase()=='value')){x[i].attributes[j].nodeValue=x[i].attributes[j].nodeValue.replace(pattern,text);}}}}}};this.showMsgs=function(sPosId,asMsgs){var elem;var sText;elem=document.getElementById('messages_ok_'+sPosId);elem.innerHTML='';elem.style.display='';sText='<ul>';for(var i=0;i<asMsgs.length;i++){if(asMsgs[i].length>0){sText+='<li>'+asMsgs[i]+'</li>';}}
sText+='</ul>';elem.innerHTML=sText;};this.showErrors=function(sPosId,asMsgs){var elem;var sText;elem=document.getElementById('messages_error_'+sPosId);elem.innerHTML='';elem.style.display='';sText='<ul>';for(var i=0;i<asMsgs.length;i++){if(asMsgs[i].length>0){sText+='<li>'+asMsgs[i]+'</li>';}}
sText+='</ul>';elem.innerHTML=sText;};this.hideMsgs=function(sPosId){var elem;elem=document.getElementById('messages_ok_'+sPosId);elem.innerHTML='';elem.style.display='none';};this.hideErrors=function(sPosId){var elem;elem=document.getElementById('messages_error_'+sPosId);elem.innerHTML='';elem.style.display='none';};};function NIF_CIFValidator(){this.NIF_Letters="TRWAGMYFPDXBNJZSQVHLCKET";this.NIF_regExp="^\\d{8}[a-zA-Z]{1}$";this.CIF_regExp="^[a-zA-Z]{1}\\d{7}[a-jA-J0-9]{1}$";this.checkAll=function(value){if(this.checkCIF(value)){return true;}else if(this.checkTR(value)){return true;}else if(this.checkNIF(value)){return true;}else{return false;}}
this.checkNIF=function(nif){if((nif.length!=8)&&(nif.length!=9))return false;if(nif.length==8)nif='0'+nif;var regExp=new RegExp(this.NIF_regExp);if(!nif.match(regExp))return false;var let=nif.charAt(nif.length-1);var dni=nif.substring(0,nif.length-1)
var letra=this.NIF_Letters.charAt(dni%23);return(letra==let.toUpperCase());}
this.checkTR=function(tr){if((tr.length!=10)&&(tr.length!=9))return false;if((tr.charAt(0).toUpperCase()!="X")&&(tr.charAt(0).toUpperCase()!="Y")&&(tr.charAt(0).toUpperCase()!="Z"))return false;var leftNum='0';if(tr.charAt(0).toUpperCase()=="Y")leftNum='1';if(tr.length==9){return this.checkNIF(leftNum+tr.substring(1,tr.length));}else{return this.checkNIF(tr.substring(1,tr.length));}}
this.checkCIF=function(cif){var v1=new Array(0,2,4,6,8,1,3,5,7,9);var tempStr=cif.toUpperCase();var temp=0;var temp1;var dc;var regExp=new RegExp(this.CIF_regExp);if(!tempStr.match(regExp))return false;if(!/^[ABCDEFGHKLMNPQS]/.test(tempStr))return false;for(i=2;i<=6;i+=2){temp=temp+v1[parseInt(cif.substr(i-1,1))];temp=temp+parseInt(cif.substr(i,1));};temp=temp+v1[parseInt(cif.substr(7,1))];temp=(10-(temp%10));if(temp==10)temp=0;dc=cif.toUpperCase().charAt(8);return(dc==temp)||(temp==1&&dc=='A')||(temp==2&&dc=='B')||(temp==3&&dc=='C')||(temp==4&&dc=='D')||(temp==5&&dc=='E')||(temp==6&&dc=='F')||(temp==7&&dc=='G')||(temp==8&&dc=='H')||(temp==9&&dc=='I')||(temp==0&&dc=='J');}}