function scWin(b){this.create=function(g){if(this.win!=null){return false}if(typeof curvyCorners=="undefined"&&b.rounded==true&&(b.titleColorBorder!=null||b.titleBackground!=null||Prototype.Browser.IE)){this.params.rounded=false;alert("Es necesaria la librería curvycorners.js")}if(this.params.draganddrop==true&&(typeof Effect=="undefined"||typeof Draggable=="undefined")){this.params.draganddrop=false;alert("Es necesaria la librería dragdrop y effects")}b=this.params;var c=document.body;while(Object.isElement($(c))){c="scWin_"+new Date().getTime()}this.win=new Element("div",{id:c,style:"position: absolute; z-index:"+b.zindex+";"});this.win.setOpacity(0);if(b.modal){this.createModal()}var f=new Element("div",{id:c+"_content"});if(b.width){this.win.setStyle("width: "+b.width+"px;");f.setStyle("width: "+b.width+"px;")}if(b.height){this.win.setStyle("height: "+b.height+"px;");f.setStyle("height: "+b.height+"px;")}this.win.insert(f);if(b.title!=null){this.title=new Element("div",{"class":"scWinTitle",style:"padding: 0px "+(b.corner/2)+"px 0px "+(b.corner/2)+"px;"});this.title.setStyle(b.titleStyle);f.insert(this.title);this.setTitle(this.params.title)}var j=new Element("div",{style:"width:100%;"});f.insert(j);var l=new Element("div",{"class":"scWinContent",style:"overflow: auto; width: 1px; height: 1px;"});l.setStyle(b.bodyStyle);j.insert(l);$(document.body).insert(this.win);this.setBody(this.body);if(b.title!=null){var i=parseFloat($H(this.title.getDimensions()).get("height"));var e=parseFloat($H(j.getDimensions()).get("width"));if(!Prototype.Browser.IE){e-=b.corner}this.title.setStyle("width: "+e+"px;");j.setStyle("height: "+(b.height-i)+"px;")}else{j.setStyle("height: 100%;")}var k=parseFloat($H(j.getDimensions()).get("width"));var d=parseFloat($H(j.getDimensions()).get("height"));if(Prototype.Browser.WebKit){if(d<b.height){k+=-7}else{k+=10}}else{k+=-10}l.setStyle("margin: 5px 5px; width: "+k+"px; height: "+(d-(b.corner/2)-5)+"px;");if(b.shadow>0){this.shadow(f,b.shadow,b.shadowColor)}if(b.titleColorBorder==null&&b.titleBackground==null){f.setStyle("background: "+b.background);f.setStyle("border: "+b.border+"px solid "+b.colorBorder)}else{if(b.titleBackground!=null){this.title.setStyle("background: "+b.titleBackground);j.setStyle("background: "+b.background)}else{f.setStyle("background: "+b.background)}if(b.titleColorBorder!=null){this.title.setStyle("border: "+b.border+"px solid "+b.titleColorBorder);this.title.setStyle("border-bottom: 0px");j.setStyle("border: "+b.border+"px solid "+b.colorBorder);j.setStyle("border-top: 0px")}else{f.setStyle("border: "+b.border+"px solid "+b.colorBorder)}}if(b.rounded){if(b.titleColorBorder!=null||b.titleBackground!=null){curvyCorners({tl:{radius:b.corner},tr:{radius:b.corner},antiAlias:true},this.title);curvyCorners({bl:{radius:b.corner},br:{radius:b.corner},antiAlias:true},j)}else{if(Prototype.Browser.IE){curvyCorners({tl:{radius:b.corner},tr:{radius:b.corner},bl:{radius:b.corner},br:{radius:b.corner},antiAlias:true},f)}else{f.setStyle("-webkit-border-radius: "+b.corner+"px; -moz-border-radius: "+b.corner+"px;")}}this.win.select('div[id="'+f.id+'_shadow"]').each(function(h){if(Prototype.Browser.IE){curvyCorners({tl:{radius:b.corner},tr:{radius:b.corner},bl:{radius:b.corner},br:{radius:b.corner},antiAlias:true},h)}else{h.setStyle("-webkit-border-radius: "+b.corner+"px; -moz-border-radius: "+b.corner+"px;")}})}if(b.alwaysCenter||g){this.center()}};this.show=function(f){if(this.win==null){this.create(f)}else{this.win.setStyle("display: block");if(f){this.center()}}b=this.params;this.win.setOpacity(0);this.win.setStyle("display: block");if(this.blockWin!=null){this.blockWin.setStyle("display: block");this.blockWin.setOpacity(0.4)}if(Prototype.Browser.IE){selectObj=new Array();var c=this.win.select("select");$$("select").each(function(h){var g=true;if(g){c.each(function(j){if(h==j){g=false}})}if(g){selectObj[selectObj.length]=h.id;var i=scWinCounter.get(h.id);if(i==null){scWinCounter.set(h.id,1)}else{scWinCounter.set(h.id,i+1)}h.setStyle("visibility: hidden;")}});this.selectObj=selectObj}if(b.effects){var e=this.win;new PeriodicalExecuter(function(h){var g=(e.getOpacity())+0.05+b.shadow;e.setOpacity(g);if(g>=1){e.setOpacity(1);h.stop();if(typeof Draggable=="function"&&typeof this.title!="undefined"&&b.draganddrop){new Draggable(e,{handle:this.title})}if(b.onShow!=null){b.onShow()}}},0.005)}else{this.win.setOpacity(1);if(typeof Draggable=="function"&&typeof this.title!="undefined"&&b.draganddrop){new Draggable(this.win,{handle:this.title})}if(b.onShow!=null){b.onShow()}}if(this.params.shadow>0&&Prototype.Browser.WebKit){var d=(this.win.select('[id="'+this.win.id+'_content"]')[0]);this.shadow(d,this.params.shadow,this.params.shadowColor)}};this.showCenter=function(){this.show(true)};this.close=function(){if(this.win==null){return false}var f=this;var g=this.params;var e=this.win;var d=this.blockWin;if(g.onClose!=null){var c=g.onClose();if(typeof c=="undefined"){c=true}if(!c){return false}}if(g.effects){e.setOpacity(1);new PeriodicalExecuter(function(i){var h=(e.getOpacity())-0.05-g.shadow;e.setOpacity(h);if(h<=0){i.stop();i.top=e.getStyle("top");e.setStyle("top: -"+e.getStyle("height"));e.setStyle("display: none");if(d!=null){d.setStyle("display: none")}}},0.005)}else{f.top=e.getStyle("top");e.setStyle("top: -"+(parseFloat(e.getStyle("height").replace("px",""))*10)+"px");e.setStyle("display: none");if(d!=null){d.setStyle("display: none")}}if(Prototype.Browser.IE){this.selectObj.each(function(h){var i=scWinCounter.get(h);if(i!=null){i--;if(i<=0){$(h).setStyle("visibility: visible;");scWinCounter.unset(h)}else{scWinCounter.set(h,i)}}})}};this.destroy=function(){if(this.win==null){return false}this.body.setStyle("display: "+this.bodyDisplay);$(document.body).insert(this.body);this.win.remove();this.win.close();if(this.blockWin!=null){this.blockWin.close()}this.win=null;this.blockWin=null};this.center=function(i){if(typeof i=="undefined"){i=this;if(b.alwaysCenter){new PeriodicalExecuter(function(j){if(i.win==null){j.stop();return false}i.center(i)},1)}}if(i.win==null||i.win.getStyle("display")=="none"){return}var f=screen.availWidth;var c=screen.availHeight;var e=i.win.getWidth();var d=i.win.getHeight();var h=(c/2)-(d/2)+Element.cumulativeScrollOffset(document.body)[1]-40;if(h<0){h=0}var g=(f/2)-(e/2)+Element.cumulativeScrollOffset(document.body)[0];i.win.setStyle("position: absolute; left: "+Math.round(g)+"px; top: "+Math.round(h)+"px;")};this.setTitle=function(g){if(g==null){return false}var e=this.win.select('div[class="scWinTitle"]');if(e.lenght==0){return false}this.params.title=g;var f="";if(b.draganddrop&&typeof Draggable=="function"){f="cursor: move;"}var d="<div style='float: left; "+f+"'>"+g+"</div>";if(b.close){d+="<div class='scCloseButton' style='float: right; font-family: Arial; font-weight: bold; cursor: pointer;'>";d+=(this.params.closeImg!=null?"<img src='"+this.params.closeImg+"' border=0/>":"x");d+="</div>"}d+="<div style='clear: both;'></div>";e=e[0];e.innerHTML=d;var c=this;e.select('[class="scCloseButton"]').each(function(h){Event.observe(h,"click",function(){c.close()})})};this.setBody=function(c){if(c==null){return false}this.body=c;if(this.bodyObj!=null){$(document.body).insert(this.bodyObj);this.bodyObj=null}if(this.win==null){return false}var d=this.win.select('div[class="scWinContent"]');d=d[d.length-1];switch(typeof this.body){case"string":if(this.body.substr(0,1)=="$"&&typeof $(this.body.substr(1))=="object"){this.setBody($(this.body.substr(1)));return true}d.innerHTML=c;break;case"object":this.bodyDisplay=this.body.getStyle("display");if(typeof this.body.innerHTML=="string"){d.insert(this.body);this.body.setStyle("display: block")}else{if(typeof this.body.value=="string"){d.insert(this.body);this.body.setStyle("display: block")}}break;default:this.body="";d.innerHTML=""}};this.createModal=function(e){if(typeof e=="undefined"){e=this}var d=document.body.scrollWidth;if(d<document.body.clientWidth){d=document.body.clientWidth}var c=document.body.scrollHeight;if(c<document.body.clientHeight){c=document.body.clientHeight}if(Prototype.Browser.Gecko){d+=Element.cumulativeScrollOffset(document.body)[0];c+=Element.cumulativeScrollOffset(document.body)[1]}if(e.blockWin!=null){e.blockWin.setStyle("position: absolute; top: 0px; left: 0px; background: "+this.params.backgroundFondo+"; width: "+d+"px; height: "+c+"px;");e.blockWin.setOpacity(0.4)}else{e.blockWin=new Element("div",{"class":"scWinBlock",style:"position: absolute; top: 0px; left: 0px; background: "+this.params.backgroundFondo+"; width: "+d+"px; height: "+c+"px; z-index:"+(b.zindex-1)+";"});e.blockWin.setOpacity(0.4);e.blockWin.setStyle("display: none");$(document.body).insert(e.blockWin);new PeriodicalExecuter(function(f){if(e.win==null){f.stop();return false}e.createModal(e)},1)}};this.insertRule=function(d,f){var e=document.styleSheets[0];var c=(typeof e.rules!="undefined"?e.rules.length:e.cssRules.length);if(typeof e.addRule!="undefined"){e.addRule(d,f,c)}if(typeof e.insertRule!="undefined"){e.insertRule(d+"{"+f+"}",c)}};this.setParams=function(d){var c=this.params;Object.keys(d).each(function(e){c[e]=d[e]});this.params=c};this.shadow=function(g,f,c,d){if(typeof f=="undefined"){f=5}if(typeof d=="undefined"){d=0.5}if(typeof c=="undefined"){c="#665F5F"}if(typeof g=="string"){g=$(g)}if($(g.id+"_shadow")==null){var e=new Element("div",{id:g.id+"_shadow",style:"position: absolute; background-color: "+c+"; margin: "+f+"px 0px 0px "+f+"px; z-index: 0"})}else{var e=$(g.id+"_shadow")}Element.insert(g,{after:e});g.setStyle("position: relative; z-index: 1");Element.clonePosition(e,g);e.setOpacity(d);Event.observe(window,"load",function(){Element.clonePosition(e,g);e.setOpacity(d)})};var a={width:null,height:null,paddingBody:null,modal:false,alwaysCenter:false,close:true,closeImg:null,draganddrop:false,backgroundFondo:"#cccccc",background:"#ffffff",colorBorder:"#cccccc",rounded:false,corner:(b.rounded?15:0),border:2,shadow:0,shadowColor:"#000000",effects:false,title:null,titleBackground:null,titleColorBorder:null,titleStyle:"font-size: 14px; color: black; font-weight: bold;",bodyStyle:"font-size: 14px; color: black;",zindex:1000,onShow:null,onClose:null};if(typeof b=="undefined"){b={}}Object.keys(a).each(function(c){if(typeof b[c]=="undefined"){b[c]=a[c]}});this.params=b;this.blockWin=null;this.win=null;this.body=null;this.bodyDisplay="none";this.selectObj=null;if(typeof Prototype=="undefined"){alert("Es necesaria la librería prototype")}}function scAlert(c,e){this.setParams=function(g){var f=this.params;Object.keys(g).each(function(h){f[h]=g[h]});this.params=f;this.winP.setParams(this.params)};this.setBody=function(g){getContent=function(h){switch(typeof h){case"string":if(h.substr(0,1)=="$"&&typeof $(h.substr(1))=="object"){return this.getContent($(h.substr(1)))}return h;break;case"object":if(typeof h.innerHTML=="string"){return h.innerHTML}else{if(typeof h.value=="string"){h.innerHTML=body.value}}break}return""};var f="";if(this.params.icon!=null){f+="<img src='"+this.params.icon+"' style='float: left; margin: 0 10px 0 10px;'/>"}f+=getContent(g);f+="<br/><br/><div style='text-align: right; margin-right: 5px'><input class='scAlert_Button' type='button' value='"+this.params.textButton+"'/></div>";return f};this.close=function(){this.winP.close()};var b={title:"Alerta",width:300,height:130,modal:true,rounded:true,shadow:15,alwaysCenter:true,zindex:2000,textButton:"Aceptar",icon:null};e=(typeof e=="undefined"?{}:e);Object.keys(b).each(function(f){if(typeof e[f]=="undefined"){e[f]=b[f]}});if(typeof curvyCorners=="undefined"&&e.rounded==true&&(e.titleColorBorder!=null||e.titleBackground!=null||Prototype.Browser.IE)){e.rounded=false;e.shadow=0}if(e.draganddrop==true&&(typeof Effect=="undefined"||typeof Draggable=="undefined")){e.draganddrop=false}this.params=e;this.winP=new scWin(this.params);this.winP.setBody(this.setBody(c));this.winP.showCenter();var a=this.winP.win.select('input[class="scAlert_Button"]');a[a.length-1].focus();var d=this.winP;a.each(function(f){Event.observe(f,"click",function(){d.close()})})}function scConfirm(c,e){this.setParams=function(g){var f=this.params;Object.keys(g).each(function(h){f[h]=g[h]});this.params=f;this.winP.setParams(this.params)};this.setBody=function(g){getContent=function(h){switch(typeof h){case"string":if(h.substr(0,1)=="$"&&typeof $(h.substr(1))=="object"){return this.getContent($(h.substr(1)))}return h;break;case"object":if(typeof h.innerHTML=="string"){return h.innerHTML}else{if(typeof h.value=="string"){h.innerHTML=body.value}}break}return""};var f="";if(this.params.icon!=null){f+="<img src='"+this.params.icon+"' style='float: left; margin: 0 10px 0 10px;'/>"}f+=getContent(g);f+="<br/><br/><div style='text-align: right; margin-right: 5px'>";f+="<input class='scDialog_ButtonSi' type='button' value='"+this.params.textButtonSi+"' style='margin-right: 10px;'/>";f+="<input class='scDialog_ButtonNo' type='button' value='"+this.params.textButtonNo+"'/>";f+="</div>";return f};this.close=function(){this.winP.close()};var b={title:"Pregunta",width:300,height:130,modal:true,rounded:true,shadow:15,alwaysCenter:true,textButtonSi:"Si",textButtonNo:"No",zindex:2000,defaultValue:false,icon:null,onButtonSi:null,onButtonNo:null};e=(typeof e=="undefined"?{}:e);Object.keys(b).each(function(f){if(typeof e[f]=="undefined"){e[f]=b[f]}});if(typeof curvyCorners=="undefined"&&e.rounded==true&&(e.titleColorBorder!=null||e.titleBackground!=null||Prototype.Browser.IE)){e.rounded=false;e.shadow=0}if(e.draganddrop==true&&(typeof Effect=="undefined"||typeof Draggable=="undefined")){e.draganddrop=false}this.params=e;if(e.onButtonNo!=null){e.onClose=e.onButtonNo}this.winP=new scWin(this.params);this.winP.setBody(this.setBody(c));this.winP.showCenter();var d=this;var a=this.winP.win.select('input[class="scDialog_Button'+(d.params.defaultValue?"Si":"No")+'"]');a[a.length-1].focus();this.winP.win.select('input[class="scDialog_ButtonSi"]').each(function(f){Event.observe(f,"click",function(){d.winP.params.onClose=d.params.onButtonSi;d.close()})});this.winP.win.select('input[class="scDialog_ButtonNo"]').each(function(f){Event.observe(f,"click",function(){d.close()})})}function scWait(b){this.setParams=function(d){var c=this.params;Object.keys(d).each(function(e){c[e]=d[e]});this.params=c;this.winP.setParams(this.params)};this.setBody=function(e,d){var c="<div style='position: absolute;'>";if(typeof d!="undefined"&&d!=null){c+="<img src='"+d+"' style='float: left; padding: 0 10px 0 10px;'/>"}c+="<span style='line-height: "+(this.params.height/2)+"px;'>"+e+"</span>";c+="</div>";this.winP.setBody(c)};this.open=function(d,c){this.counterWin++;if(this.counterWin>1){return true}if(typeof d=="undefined"){this.setBody(this.params.texto,this.params.icon)}else{if(typeof c=="undefined"){c=b.icon}this.setBody(d,c)}this.winP.show()};this.close=function(){if(this.counterWin==0){return false}if(this.params.onCloseOne!=null){this.params.onCloseOne()}if(this.counterWin>1){this.counterWin--;return false}this.closeAll()};this.closeAll=function(){this.winP.close();this.counterWin=0};var a={width:200,height:60,modal:true,rounded:true,shadow:15,alwaysCenter:true,texto:"Cargando...",bodyStyle:"font-size: 15px; color: blue; font-weight: bold; padding-top: 5px;",zindex:3000,icon:null,onShow:null,onCloseOne:null,onClose:null};var b=(typeof b=="undefined"?{}:b);if(typeof curvyCorners=="undefined"&&b.rounded==true&&(b.titleColorBorder!=null||b.titleBackground!=null||Prototype.Browser.IE)){b.rounded=false;b.shadow=0}if(b.draganddrop==true&&(typeof Effect=="undefined"||typeof Draggable=="undefined")){b.draganddrop=false}Object.keys(a).each(function(c){if(typeof b[c]=="undefined"){b[c]=a[c]}});b.title=null;this.params=b;this.counterWin=0;this.winP=new scWin(this.params)}var scWinCounter=new Hash();