var __OasisZipcodeWidget = function(instanceName, Promocode, show_title) { //propiedades privadas var html_template = ""; var container_id; var instanceName = new String(instanceName); var instance; var default_title = "Check Rates & Availability Now"; //propiedades (publicas) var promocode = new String(Promocode); //funciones Publicas this.Create = function() { instance = this; container_id = document.getElementById( instanceName + "__OasisZipcodeWidget_container"); if(container_id == undefined) { alert("Oasisenergy Widget Error
it was not found on your document!"); } else { RenderHtml(); } } this.Go = function(obj_zipcode, keyEvent) { if (keyEvent != null) { //para IE if (window.event) { if (window.event.keyCode == 13) { RedirectToOasis(obj_zipcode); } } else { //Firefox y otros navegadores if (keyEvent) { if (keyEvent.which == 13) { RedirectToOasis(obj_zipcode); } } } } else { RedirectToOasis(obj_zipcode); } } this.CheckZipcode = function(obj) { if(isNaN(obj.value) || parseInt(obj.value) != obj.value || obj.value.length < 5) { obj.value = "Enter Zipcode"; return false; } return true; } //funciones privadas var RenderHtml = function () { if (this.InstanceName != "" || this.InstanceName != undefined) { html_template += '
'; if (show_title) { html_template += '

' + default_title + '

'; } html_template += ''; html_template += ''; html_template += '
'; container_id.innerHTML = html_template; } } var RedirectToOasis = function(obj_zipcode) { if(instance.CheckZipcode(obj_zipcode)) { document.location.href = 'https://rates.cleanskyenergy.com:8443/Enrollment/Index?zipcode='+ obj_zipcode.value + '&promo_code=' + promocode; } } };