﻿var SITETIMEOUT=60;var MAXSHOWNCOMBOITEMSCOUNT=10;var USERNAMEREGEX=/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/i;var PERSONNAMEREGEX=/^[\w\u00c0-\u00ff\s\-']+$/i;var PHONEREGEX=/^([0-9]{3})?([0-9]{7})([0-9]{1,4})?$/;var NUMBERREGEXP=/^\d+$/;var BLOCKEDPOPUPMESSAGE="To Login to DisclosureNet, please adjust your pop-up blocker\r\nsettings to allow pop-ups from www.disclosurenet.com.\r\n\r\nFor immediate assistance, please contact us at client.support@xpi.com.";var InvalidFieldMark;var COUNTRIES={CANADA:2,UNITEDSTATES:3,AUSTRALIA:17,UNITEDKINGDOM:232};var TITLES={FIELDCANNOTBEEMPTY:"This field can not be empty.",FIELDCANNOTBELESS2:"Value of this field can not be less than 2 characters.",USERNAMEFIELD:"User name must be a valid email address less than 100 characters long.",PHONEFIELD:"The field must contain a valid phone number (7 or 15 digits long).",AREAFIELD:"The field must contain a valid area code (3 digits long).",AREAFIELDCANTBEEMPTY:"The field must contain a valid area code (3 digits long).",AREAFIELDSHOULDBEEMPTY:"Area code is not allowed for phone numbers with more than 7 digits.",EXTENSIONFIELD:"The field must contain a valid extension (up to 5 digits).",FIELDRESTRICTEDSYMBOLSDETECTED:"This field can only contain letters, numbers, spaces, dashes, apostrophes and underscores.",FIELDSHOUDBELESSTHAN:"The field should be less than {0} characters.",INVALIDFIELDS:"There are some fields with errors, please correct them and click {0}."};var Browser=(function(){var ua;var isChrome;var isIE6;var isIE7;var isIE8;var isIE9;ua=navigator.userAgent.toLowerCase();isChrome=ua.indexOf("chrome")> -1;isIE6=typeof IsIE6=="boolean"&&IsIE6||ua.indexOf("msie 6")> -1;isIE7=typeof IsIE7=="boolean"&&IsIE7||ua.indexOf("msie 7")> -1;isIE8=typeof IsIE8=="boolean"&&IsIE8||ua.indexOf("msie 8")> -1;isIE9=typeof IsIE9=="boolean"&&IsIE9||ua.indexOf("msie 9")> -1;return{IsIE6:isIE6,IsIE7:isIE7,IsIE8:isIE8,IsIE9:isIE9,IsIE:isIE6||isIE7||isIE8||isIE9,IsFF: !isChrome&&ua.indexOf("gecko")> -1,IsFF4: !isChrome&&ua.indexOf("rv:2.0")> -1,IsChrome:isChrome};})();var MOUSEBUTTON={LEFT:0,MIDDLE:Browser.IsChrome?0:1,RIGHT:2};var HtmlEncoder=(function(){var el;el=document.createElement("div");return{Encode:function(str){var text;var res;text=document.createTextNode(str);el.appendChild(text);res=el.innerHTML.toString();el.innerHTML="";return res.replace(/\"/g,"&quot;");},Decode:function(str){var res;el.innerHTML=str;res=Browser.IsIE?el.innerText.toString():el.textContent.toString();el.innerHTML="";return res;}};})();var ImageCache=(function(){var cache;var isArray;cache=[];isArray=function(obj){return obj&&typeof obj.length=='number'&&typeof obj.splice=='function';};return{Add:function(sourceUrl){var newLength;if(!sourceUrl){return;}if(isArray(sourceUrl)){for(var i=0,len=sourceUrl.length;i<len;i++){this.Add(sourceUrl[i]);}}else{newLength=cache.push(new Image());cache[newLength-1].src=sourceUrl;}}};})();function HtmlEllipsis(elm,originalText,width,considerMargins){var style;var paddings;var margins;var parsePx;var startWidth;var charNumber;var originalText;var incrementor;var measureFunc;var finishEllipsis;var steps;parsePx=function(px){var re;var match;re=/^(\-?\d+(?:\.\d+)?)(px)?$/;match=px.match(re);return match&&(match[2]||match[1]=="0")?parseFloat(match[1],10):null;};if(Browser.IsFF&&elm.scrollWidth>0&&elm.parentNode.offsetWidth>0){elm.textContent=originalText;if(typeof(width)=="undefined"||width<=10){width=elm.parentNode.offsetWidth;paddings=parsePx(GetElementComputedStyleValue(elm.parentNode,"padding-right"))||0;paddings+=parsePx(GetElementComputedStyleValue(elm.parentNode,"padding-left"))||0;if(considerMargins){margins=parsePx(GetElementComputedStyleValue(elm,"margin-right"))||0;margins+=parsePx(GetElementComputedStyleValue(elm,"margin-left"))||0;width-=margins;}width-=paddings;}steps=0;if(typeof(Ext)!="undefined"){measureFunc=function(){var width;try{width=Ext.util.TextMetrics.measure(elm,elm.textContent).width;}catch(e){finishEllipsis=true;width=0;}return width;};startWidth=measureFunc();if(startWidth>width){originalText=elm.textContent;charNumber=Math.floor(width*(originalText.length)/startWidth)-1;elm.textContent=[originalText.substring(0,charNumber),"..."].join("");incrementor=(measureFunc()>width)? -1:1;finishEllipsis=false;while(!finishEllipsis){if(charNumber<=1){finishEllipsis=true;}else{if(incrementor== -1){charNumber--;elm.textContent=[originalText.substring(0,charNumber),"..."].join("");if(measureFunc()<width){finishEllipsis=true;}}else{charNumber++;elm.textContent=[originalText.substring(0,charNumber),"..."].join("");if(measureFunc()>width){elm.textContent=[originalText.substring(0,charNumber-1),"..."].join("");finishEllipsis=true;}}}steps++;}}}if(elm.title){elm.title=originalText;}}};function SetElementQTip(el,text,title){if(typeof el==="string"){el=document.getElementById(el);}if(el){if(typeof(IgnoreExtJsQtip)!="undefined"&&IgnoreExtJsQtip===true){el.setAttribute("title",text||"");return;}if(typeof(Ext)=="object"){el.setAttribute("ext:qtip",text||"");el.setAttribute("ext:qtitle",title||"");}else{el.setAttribute("title",text||"");}}};function GetElementQTip(el){if(typeof el==="string"){el=document.getElementById(el);}if(typeof(Ext)=="object"){return el.getAttribute("ext:qtip")||"";}else{return el.getAttribute("title")||"";}};function AddCssClass(node,className){var arrClasses;var classAdded;if(node){arrClasses=node.className.split(" ");classAdded=arrClasses.some(function(cls){return cls==className});if(!classAdded){node.className=[node.className,className].join(" ");}}};function RemoveCssClass(node,className){var arrClasses;var classRemoved;if(node){arrClasses=node.className.split(" ");classRemoved=false;className=className.trim();for(var i=0;i<arrClasses.length;i++){if(arrClasses[i]==className){arrClasses.splice(i,1);i--;classRemoved=true;}}if(classRemoved){node.className=arrClasses.join(" ");}}};function HasCssClass(node,className){var arrClasses;var result;result=false;if(node){arrClasses=node.className.split(" ");return arrClasses.some(function(cls){return cls==className});}return false;};function ValidateUserName(input,totalValidation,supressTooltip){var isValid;if(typeof totalValidation=="boolean"&& !totalValidation&&input.value.trim().length==0){return true;}input.className=input.className.replace(/NotValid/g,"").trim();SetElementQTip(input,"");isValid=true;isValid=USERNAMEREGEX.test(input.value.trim());if(input.value.trim().length<1){isValid=false;}if(!isValid){input.className+=" NotValid";if((typeof supressTooltip=="undefined")|| !supressTooltip){SetElementQTip(input,TITLES.USERNAMEFIELD);}}isValid?InvalidFieldMark.Clear(input.parentNode):InvalidFieldMark.Set(input.parentNode);InvalidFieldMark.SetTitle(input.parentNode,isValid?"":TITLES.USERNAMEFIELD);return isValid;};function SetCookie(name,value){var cookies;var cookiePrefix="RememberMe=";cookiePrefix=name+"=";cookies=document.cookie.split(";");for(var i=0;i<cookies.length;i++){cookies[i]=cookies[i].trim();if(cookies[i].indexOf(cookiePrefix)==0){cookies[i]="";}}document.cookie=cookiePrefix+value+"; path=/;"+cookies.join("; ");};String.prototype.trim=function(){var re=/^\s+|\s+$/g;return function(){return this.replace(re,"");};}();function GetElementOffset(element){var left;var top;left=element.offsetLeft;top=element.offsetTop;while(element=element.offsetParent){left+=element.offsetLeft;top+=element.offsetTop;}return{left:left,top:top};};function OpenInCenteredWindow(url,width,height){var options;options="menubar=0 , directories=0 , status=1 , toolbar=0 , resizable=1 , scrollbars=1 , width="+width+" , height="+height;options+=" , screenX=0 , screenY=0 , top="+Math.round((screen.availHeight-height)/2)+" , left="+Math.round((screen.availWidth-width)/2);window.setTimeout("window.open( \""+url+"\" , \"_blank\" , \""+options+"\" )",33);};function OpenDemoVideo(fileName){OpenInCenteredWindow(fileName,810,655);return false;};function OpenApplicationWindow(url){var options;var newWindow;var chromeLauncher;var tempVar;var formFields;var urlField;options="directories=0 , menubar=0 , status=1 , toolbar=0 , resizable=1 , scrollbars=1";options+=" , width="+(screen.availWidth-10)+" , height="+(screen.availHeight-58);options+=" , screenX=0 , screenY=0 , top=0 , left=0";if(!url){url="DisclosureNet.aspx";}newWindow=window.open(url,"_blank",options);if(newWindow){try{newWindow.focus();newWindow.moveTo(0,0);}catch(ex){}}else{alert(BLOCKEDPOPUPMESSAGE);}};function AugmentJsArray(){var config;delete Array.prototype.indexOf;config={forEach:function(fn,thisObj){var scope;scope=thisObj||window;for(var i=0,len=this.length;i<len;i++){fn.call(scope,this[i],i,this);}},every:function(fn,thisObj){var scope;scope=thisObj||window;for(var i=0,len=this.length;i<len;i++){if(!fn.call(scope,this[i],i,this)){return false;}}return true;},some:function(fn,thisObj){var scope;scope=thisObj||window;for(var i=0,len=this.length;i<len;i++){if(fn.call(scope,this[i],i,this)){return true;}}return false;},map:function(fn,thisObj){var scope;var mapped;scope=thisObj||window;mapped=[];for(var i=0,len=this.length;i<len;i++){mapped.push(fn.call(scope,this[i],i,this));}return mapped;},filter:function(fn,thisObj){var scope;var filtered;scope=thisObj||window;filtered=[];for(var i=0,len=this.length;i<len;i++){if(fn.call(scope,this[i],i,this)){filtered.push(this[i]);}}return filtered;},indexOf:function(el,start){var start;start=start||0;for(var i=start,len=this.length;i<len;i++){if(this[i]===el){return i;}}return-1;},lastIndexOf:function(el,start){var start;start=start||this.length;if(start>=this.length){start=this.length;}if(start<0){start=this.length+start;}for(var i=start;i>=0;i++){if(this[i]===el){return i;}}return-1;},indexOfObject:function(fn){for(var i=0,len=this.length;i<len;i++){if(fn.call(this,this[i],i,this)){return i;}}return-1;},lastIndexOfObject:function(fn){for(var i=this.length-1;i>=0;i--){if(fn.call(this,this[i],i,this)){return i;}}return-1;}};for(var indMethod in config){if(typeof(Array.prototype[indMethod])=="undefined"){Array.prototype[indMethod]=config[indMethod];}}};AugmentJsArray();InvalidFieldMark=(function(){var Set;var Clear;var SetTitle;var GetElement;GetElement=function(el){var markEl;el=Ext.get(el);if(el){markEl=el.query(".InvalidFieldMark");if(markEl.length>0){return markEl[0];}}return false;};Set=function(el){var markEl;markEl=GetElement(el);if(markEl===false){markEl=Ext.DomHelper.append(el,{tag:"div",cls:"InvalidFieldMark"});}markEl.style.display="block";markEl.style.visibility="";};Clear=function(el){var markEl;markEl=GetElement(el);if(markEl){markEl.style.display="none";markEl.style.visibility="hidden";}};SetTitle=function(el,title){var markEl;markEl=GetElement(el);if(markEl){SetElementQTip(markEl,title);}};return{Set:Set,Clear:Clear,SetTitle:SetTitle}})();function SetInvalidFieldMark(el){var markEl;el=Ext.get(el);if(el){markEl=el.query(".InvalidFieldMark");if(markEl.length>0){markEl=markEl[0];}else{markEl=Ext.DomHelper.append(el,{tag:"div",cls:"InvalidFieldMark"});}markEl.style.display="block";}};function ClearInvalidFieldMark(el){var markEl;el=Ext.get(el);if(el){markEl=el.query(".InvalidFieldMark");if(markEl.length>0){markEl[0].style.display="none";}}};ProvinceComboOverride={getValue:function(provincesArray,shouldReturnObject){value=Ext.form.ComboBox.prototype.getValue.call(this);if(this.disabled){for(var i=0;i<provincesArray.length;i++){if((provincesArray[i].Value.length>0)&&(provincesArray[i].Key==this.LastSelectedCountry)){for(var j=0;j<provincesArray[i].Value.length;j++){return shouldReturnObject?{Id:provincesArray[i].Value[j].Id,Description:provincesArray[i].Value[j].Description}:provincesArray[i].Value[j].Id;}}}}else if(value==""){for(var i=0;i<provincesArray.length;i++){if((provincesArray[i].Value.length>0)&&(provincesArray[i].Key==this.LastSelectedCountry)){for(var j=0;j<provincesArray[i].Value.length;j++){if(provincesArray[i].Value[j].Description.toLowerCase().indexOf("- unknown")> -1){return shouldReturnObject?{Id:provincesArray[i].Value[j].Id,Description:provincesArray[i].Value[j].Description}:provincesArray[i].Value[j].Id;}}}}}return value;},setValue:function(id,provincesArray){var record;Ext.form.ComboBox.prototype.setValue.call(this,id);record=this.findRecord(this.valueField,id);if((record&&record.data[this.displayField].indexOf("- Unknown")> -1)||this.store.getCount()==0){this.clearValue();this.setDisabled(true);}else if(typeof(record)=="undefined"){this.clearValue();}},GetProvinceText:function(provinceCombo,provincesArray){var id;var text;text="";id=provinceCombo.getValue();for(var i=0;i<provincesArray.length;i++){if((provincesArray[i].Value.length>0)&&(provincesArray[i].Key==provinceCombo.LastSelectedCountry)){for(var j=0;j<provincesArray[i].Value.length;j++){if(provincesArray[i].Value[j].Id.toString()==id){text=provincesArray[i].Value[j].Description;}}}}return text;},RebindProvinces:function(countryId,provinceCombo,provincesArray){var provinces;var src;var defaultProvinceId;var disabled;var countryName;provinces=[];src=[];if(provinceCombo.LastSelectedCountry!=countryId){for(var i=0;i<provincesArray.length;i++){if(provincesArray[i].Key==countryId){provinces=provincesArray[i].Value;break;}}for(var i=0;i<provinces.length;i++){if(provinces[i].Description.toLowerCase().indexOf("- unknown")== -1){src.push([provinces[i].Id,provinces[i].Description]);}}store=new Ext.data.SimpleStore({fields:["Id","Description"],data:src});provinceCombo.bindStore(store,false);provinceCombo.LastSelectedCountry=countryId;disabled=(src.length==0);if(provinces.length>1){if(disabled){for(var i=0;i<provincesArray.length;i++){if(provincesArray[i].Id==countryId){countryName=provincesArray[i].Description;break;}}if(countryName!=""){for(var i=0;i<provinces.length;i++){if(provinces[i].Description==(countryName+" - Unknown")){provinceCombo.setValue(provinces[i].Id);break;}}}}}else{disabled=true;provinceCombo.clearValue();}if(!disabled){provinceCombo.clearValue();}provinceCombo.setDisabled(disabled);}}}
