function getRefToDivMod(a,b){b||(b=document);if(document.layers)if(b.layers[a])return b.layers[a];else{for(var c=0,d;!d&&c<b.layers.length;c++)d=getRefToDivNest(a,b.layers[c].document);return d}return document.getElementById?b.getElementById(a):document.all?b.all[a]:b[a]}
function openPerfectPopup(a,b,c){var d=window.open("","windowName","width=500,height=400,resizable=1");if(!d)return true;d.document.open();d.document.write("<html><head><title>"+b+"</title></head><body>"+(document.layers?'<layer left="0" top="0" width="'+a+'" id="myID">':'<div style="position:absolute;left:0px;top:0px;width:'+a+'px;" id="myID">')+c+(document.layers?"</layer>":"</div>")+"</body></html>");d.document.close();b=getRefToDivMod("myID",d.document);if(!b)return false;b=b.clip?b.clip.height:
b.offsetHeight;if(!b)return false;d.resizeTo(a+200,b+200);var e=c=0,f=d.document.documentElement,g=d.document.body;if(d.innerWidth)c=d.innerWidth,e=d.innerHeight;else if(f&&f.clientWidth)c=f.clientWidth,e=f.clientHeight;else if(g&&g.clientWidth)c=g.clientWidth,e=g.clientHeight;window.opera&&!document.childNodes&&(c+=16);d.resizeTo(a+=a+200-c,b+=b+200-e);c=screen.availHeight?screen.availHeight:screen.height;d.moveTo(Math.round(((screen.availWidth?screen.availWidth:screen.width)-a)/2),Math.round((c-
b)/2));d.focus&&d.focus();return false}PositionY=PositionX=10;defaultWidth=600;defaultHeight=400;var AutoClose=false;
function popImage(a,b){var c=window.open("","_blank","scrollbars=no,resizable=1,width="+defaultWidth+",height="+defaultHeight+",left="+PositionX+",top="+PositionY);if(!c)return true;c.document.write("<html><head><title>"+b+'</title><script type="text/javascript">\nfunction resizeWinTo() {\nif( !document.images.length ) { document.images[0] = document.layers[0].images[0]; }var oH = document.images[0].height, oW = document.images[0].width;\nif( !oH || window.doneAlready ) { return; }\nwindow.doneAlready = true;\nvar x = window; x.resizeTo( oW + 200, oH + 200 );\nvar myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;\nif( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }\nelse if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }\nelse if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }\nif( window.opera && !document.childNodes ) { myW += 16; }\nx.resizeTo( oW = oW + ( ( oW + 200 ) - myW ), oH = oH + ( (oH + 200 ) - myH ) );\nvar scW = screen.availWidth ? screen.availWidth : screen.width;\nvar scH = screen.availHeight ? screen.availHeight : screen.height;\nif( !window.opera ) { x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2)); }\n}\n<\/script></head><body onload="resizeWinTo();"'+(AutoClose?
' onblur="self.close();"':"")+">"+(document.layers?'<layer left="0" top="0">':'<div style="position:absolute;left:0px;top:0px;">')+"<img src="+a+' alt="Loading image ..." title="" onload="resizeWinTo();">'+(document.layers?"</layer>":"</div>")+"</body></html>");c.document.close();c.focus&&c.focus();return false}function CompruebaCIF(a){var b=a.toUpperCase();if(/^[A-Za-z0-9]{9}$/.test(b)){if(!/^[ABCDEFGHKLMNPQS]/.test(b))return false}else return false;return ValidaCIF(a)}
function ValidaCIF(a){var b=[0,2,4,6,8,1,3,5,7,9],c=0;for(i=2;i<=6;i+=2)c+=b[parseInt(a.substr(i-1,1))],c+=parseInt(a.substr(i,1));c+=b[parseInt(a.substr(7,1))];c=10-c%10;if(c==10){if(a.substr(a.length-1,1)!="J"&&a.substr(a.length-1,1)!="0")return false}else if(a.substr(a.length-1,1)!=c)return false;return true}
function esDni(a){var b,a=a.toUpperCase();a.charAt(0)=="X"&&(a=a.substr(1,a.length));b=a.charAt(a.length-1);if(b<"A"||b>"Z")return false;else b="TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substr(0,a.length-1)%23);return a.charAt(a.length-1)==b?true:false}function ordena(a,b,c){b.action=c;b.pagina.value=a;b.submit()};

