function Globular(a){this.login="";this.login_name="";this.whois_form="";this.father=a;this.alt_repos=Array();this.alt_logged=Array();this.alt_notlog=Array();this.Funzionzs=Array()}Globular.prototype.readCookie=function(b){var c=document.cookie.indexOf(b);if(c==-1||b==""){return""}var a=document.cookie.indexOf(";",c);if(a==-1){a=document.cookie.length}return unescape(document.cookie.substring(c+b.length+1,a))};Globular.prototype.getCartProducts=function(){var a=this.readCookie("numItems");a=parseInt(a);if(isNaN(a)){a=0}return a};Globular.prototype.checkLogged=function(){if(this.login==""){var a=this.readCookie("USERLOGGED");a=a.replace("<","&lt;");a=a.replace(">","&gt;");a=a.replace("+"," ");if(a){this.login=true;this.login_name=a}else{this.login=false}}return this.login};Globular.prototype.LoadHeader=function(){this.checkLogged();for(var a=0;a<this.alt_repos.length;a++){this.applyAlternative(this.father.getElementById(this.alt_repos[a]),a)}this.CartBox();this.LoginBox()};Globular.prototype.setAlternative=function(a,b,c){this.alt_repos.push(a);this.alt_logged.push(b);this.alt_notlog.push(c)};Globular.prototype.CartBox=function(){if(this.father.getElementById("hdCartNum")){this.father.getElementById("hdCartNum").innerHTML="<strong>"+this.getCartProducts()+"</strong>"}return true};Globular.prototype.applyAlternative=function(b,a){if(b.nodeName=="A"){if(this.login){b.href=this.alt_logged[a]}else{b.href=this.alt_notlog[a]}return}};Globular.prototype.LoginBox=function(){return false};Globular.prototype.LoadWhoisPan=function(h,d,a,e,g){var b=this.father.getElementById(h);b.setAttribute("autocomplete","off");var k=this.father.getElementById(d);k.innerHTML="";if(!b||!k){return}var f=0;var j="";for(var c=0;c<a.length;c++){j=document.createElement("li");if(f){j.setAttribute("class","whois_line");f=0}else{f=1}j.fatha=b;j.tld=a[c];j.currentDomain="";j.onclick=function(){this.fatha.value=this.currentDomain+"."+this.tld;jQuery(this.parentNode).slideUp()};j.setDomain=function(i){this.innerHTML=i+"."+this.tld;this.currentDomain=i};k.appendChild(j)}if(g.length>2){j=document.createElement("li");j.gotolink=e;j.innerHTML=g;j.onclick=function(){window.location=this.gotolink};j.setDomain=function(i){return};k.appendChild(j)}b.tlds=a;b.whoisChild=k;b.onblur=function(){jQuery(this.whoisChild).slideUp()};b.onkeyup=function(){this.value=this.value.toLowerCase();if(this.value.length<3){jQuery(this.whoisChild).slideUp();return}if(this.value.length>62){this.value=this.value.substr(0,62)}jQuery(this.whoisChild).slideDown();for(var l=0;l<this.tlds.length;l++){var m=new RegExp("."+this.tlds[l].replace(".",".")+"$","gi");if(m.test(this.value)){jQuery(this.whoisChild).slideUp();return}}for(var l=0;l<this.whoisChild.childNodes.length;l++){this.whoisChild.childNodes[l].setDomain(this.value.replace(/^\-|[^\w\d\-\.]|(\-\-)+?|\-$|\.$/g,""))}};b.onclick=function(){for(var l=0;l<this.tlds.length;l++){if(this.value.length>4&&this.value.search("."+this.tlds[l])!=-1){this.value=this.value.replace("."+this.tlds[l],"")}}};jQuery(k).slideUp()};Globular.prototype.InstallWhoisForm=function(c,b,a){this.whois_form=this.father.getElementById(c);this.whois_destination=Array(b,a)};Globular.prototype.whoisPost=function(a){if(!this.whois_form){return}switch(a){case"reg":default:this.whois_form.action=this.whois_destination[0];break;case"tra":this.whois_form.action=this.whois_destination[1];break}this.whois_form.submit();return false};Globular.prototype.setAsync=function(b){var a=this.father.getElementById(b);a.enroute=false;a.onsubmit=function(){if(this.enroute){return false}this.addMessage=function(c){jQuery(".footer_feedback",this).html(c);jQuery(".footer_feedback",this).slideDown()};$.ajax({url:this.action,dataType:"text",destination:this,data:jQuery(this).serialize(),success:function(c){this.destination.enroute=false;this.destination.addMessage(c)},type:"post"});this.enroute=true;return false}};Globular.prototype.addFunz=function(a){this.Funzionzs.push(a)};Globular.prototype.execFunz=function(){for(var a=0;a<this.Funzionzs.length;a++){this.Funzionzs[a]()}};
