﻿function trapBackButton(){var b="1",a;a=b!=document.all.item("backButtonFlag").value;document.all.item("backButtonFlag").value=2;document.all.item("backButtonFlag").value=2;if(a)window.location.href="ErrorPage.aspx?ErrorGuid=2E87DA1D-3763-F990-E905-1F4A0352D26A"}function Init(){CheckMessages();SetUpDirtyCheck();if(document.all.item("backButtonFlag")!=null&&document.all.item("backButtonFlag").value<=2)trapBackButton()}function CheckMessages(){var a;for(i=0;i<document.forms.length;i++)try{if(document.forms[i].message!=null&&document.forms[i].message.value!=""){alert(document.forms[i].message.value);document.forms[i].message.value=""}if(document.forms[i].errorMessage!=null&&document.forms[i].errorMessage.value!=""){alert(document.forms[i].errorMessage.value);document.forms[i].errorMessage.value="";a=true}}catch(b){}if(a)history.back()}function ConfirmDelete(){if(confirm("Are you sure"))return true;else return false}function AddMeToTeam(d,e){document.body.style.cursor="wait";var a={};a.funcName="addUserToPartnerTeam";a.async=false;var b=service.MSTeam.callService(a,e,d);document.body.style.cursor="auto";if(b.error)alert("An error occured:\n\n"+b.errorDetail.string);else{var c=b.raw.selectSingleNode("//Message").text;if(c.length==0)alert(service.successMessage);else alert(c)}}function InitMSTeamService(){var a;try{a=service}catch(b){}if(a!=null)a.useService(location.protocol+"//"+location.host+"/EdisonWS/Team.asmx?WSDL","MSTeam")}function showTable(a,c){var b="none";if(a.rows[1].style.display=="none"){b="";c.src="images/collapse.gif"}else c.src="images/expand.gif";for(i=1;i<a.rows.length;i++)a.rows[i].style.display=b}function LaunchCalendar(b){d=new Date;var e="dialogHeight:290px; dialogWidth:280px; Center: Yes; Help: No; Status: No;",c="",a=null;a=window.showModalDialog("calendarframe.aspx?ihcInd="+d.getDate+"&DefaultDate="+b.value,c,e);if(a!=null)b.value=a}function getCorrectForm(){for(i=0;i<document.forms.length;i++)if(document.forms[i].method.toUpperCase()=="POST")return document.forms[i];return null}function SetUpDirtyCheck(){if(document.all.item("dirty")==null||document.all.item("dirty").value=="")return;if(document.all.item("dirty").value=="p")setDirtyForm();var a=getCorrectForm();window.attachEvent("onbeforeunload",warnForDirty);a.attachEvent("onsubmit",formSubmitCancelDirtyCheck);if(typeof excludeFromDirtyCheckControlIds!="undefined")for(i=0;i<excludeFromDirtyCheckControlIds.length;i++){var b=document.getElementById(excludeFromDirtyCheckControlIds[i]);if(b!=null)b.setAttribute("excludeFromDirtyCheck","true")}for(i=0;i<a.elements.length;i++){if(a.item(i).type=="radio"&&a.item(i).onclick!=null&&a.item(i).onclick.toString().indexOf("__doPostBack")!=-1){var c=new Function("formSubmitCancelDirtyCheck(); "+a.item(i).attributes["onclick"].value);a.item(i).onclick=c}if(a.item(i).attributes["excludeFromDirtyCheck"]!=null&&a.item(i).attributes["excludeFromDirtyCheck"].value=="true")continue;if(a.item(i).onchange==null)a.item(i).attachEvent("onchange",setDirtyForm);else if(a.item(i).onchange.toString().indexOf("__doPostBack")==-1)a.item(i).attachEvent("onchange",setDirtyForm)}}function formSubmitCancelDirtyCheck(a){try{if(a==true&&document.all.item("dirty").value=="true")document.all.item("dirty").value="p";else document.all.item("dirty").value="x"}catch(b){document.all.item("dirty").value="x"}}function isDirtyCheck(){if(document.all["dirty"]!=null)return document.all["dirty"].value=="true";return false}function confirmIfDirty(b){if(typeof Page_IsValid!="undefined"&&Page_IsValid!=null)Page_IsValid=true;if(isDirtyCheck())if(confirm(b)){var a=getCorrectForm();if(typeof a!="undefined")a.dirty.value="false";return true}else return false;return true}function setDirtyForm(){document.all.item("dirty").value="true"}function warnForDirty(){try{var a=getCorrectForm();if(a.dirty.value=="true"&&(typeof a.__EVENTTARGET!="object"||a.__EVENTTARGET.value==""))event.returnValue=a.dirty.errorMessage}catch(b){}}function toggleAll(c){var b=document.forms(1),a=b.getElementsByTagName("input"),d=b.chkToggle.checked;for(i=0;i<a.length;i++)if(a[i].type=="checkbox")if(a[i].getAttribute("ClientName")==c&&a[i].disabled==false)a[i].checked=d}function GetSelectedIDs(c,d){var a=d.getElementsByTagName("input"),b=[];for(i=0;i<a.length;i++)if(a[i].type=="checkbox")if(a[i].getAttribute("ClientName")==c&&a[i].checked)b.push(a[i].value);return b}function AddIdsToGroup(g,h,f,d){var c=document.forms(1),a=c.getElementsByTagName("input"),b=[];for(i=0;i<a.length;i++)if(a[i].type=="checkbox")if(a[i].getAttribute("ClientName")==g&&a[i].checked)b.push(a[i].value);if(d!=""){var j=document.getElementById(d),e=j.value;if(b.length>e){alert("You have chosen more items than you are allowed.  Please reduce your selection.");return false}}if(b.length==0){alert(f);return false}else{a=c.getElementsByTagName("input");for(i=0;i<a.length;i++)if(a[i].type=="hidden")if(a[i].name==h)a[i].value=b.join("|");return true}}function getValue(f,e,g,d,h,k,c){if(AddIdsToGroup("chkAdd",g,d,k)){var l=event.srcElement,b=document.getElementById(c),j="DomainDialog.aspx?Domain="+f+"&DialogType="+e+"&Title="+h,i="dialogHeight: 180px; dialogWidth: 285px; help: no; resizable: no; status: no; scroll: no;",a=window.showModalDialog(j,b.value,i);if(a==null)return false;else{b.value=a;return true}}else return false}function getSelectedRadioItem(){var a=document.getElementsByTagName("input"),b=[];for(i=0;i<a.length;i++)if(a[i].type=="radio")if(a[i].checked)return a[i].value}function getSelectedDropDownItem(a){var b=document.getElementById(a);return b.selectedIndex}function toggleViewOption(b){var a=document.getElementById(b);if(a.value=="False")a.value="True";else a.value="False";return true}function openObjectBrowser(b,d){var e="ObjectBrowser.aspx?ObjectType="+b+"&ObjectID="+d,c="dialogHeight: 300px; dialogWidth: 400px; help: no; resizable: no; status: no;",a=window.showModalDialog(e,"",c);return a}function openDialogWindow(c,d,b){var a={};a.UrlString=d;returnValue=window.showModalDialog(c,a,b);if(typeof returnValue=="boolean")return returnValue;else{window.navigate(returnValue);return false}}function closeWindow(b){if(confirm(b)){var a=getCorrectForm();if(typeof a!="undefined")a.dirty.value="false";closeWindow();return true}else return false}function closeWindow(){var a=window.self;a.opener=window.self;a.close()}function MaxLengthPaste(){var a=event.srcElement;if(isNaN(a.maxLength))return;event.returnValue=false;var c=a.document.selection.createRange(),d=a.maxLength-a.value.length+c.text.length,b=window.clipboardData.getData("Text").substr(0,d);b=b.replace(/\t/g," ");c.text=b;ShowCount(a)}function MaxLengthDragEnter(){var a=event.srcElement;if(isNaN(a.maxLength))return;var b=event.dataTransfer.getData("Text");if(b.length+a.value.length>a.maxLength-1){event.returnValue=false;event.dataTransfer.dropEffect="none";event.dataTransfer.effectAllowed="none"}}function MaxLengthKeyPress(){var a=event.srcElement;if(isNaN(a.maxLength))return;var b=a.document.selection.createRange();if(b.text.length>=1)event.returnValue=true;else if(a.value.length>a.maxLength-1)event.returnValue=false;ShowCount(a)}function MaxLengthKeyUp(){var a=event.srcElement;ShowCount(a)}function ShowCount(a){var c=document.all[a.Label],b=a.maxLength-a.value.length;if(b<0)b=0;if(typeof c!="undefined")c.innerText=c.message.replace("|x|",b)}function openDialogWindow(d,e,b,c){var a={};a.UrlString=e;returnValue=window.showModalDialog(d,a,b);if(typeof returnValue=="boolean")return returnValue;else if(c){window.navigate(returnValue);return false}else return false}function OpenPrintWindow(a){return openDialogWindow(a,null,"dialogHeight:600px;dialogWidth:800px;center:yes;status:no;resizable:no;help:no;",false)}function ValidatorFocus(){var a;for(a=0;a<Page_Validators.length;a++)if(!Page_Validators[a].isvalid){var b=document.getElementById(Page_Validators[a].controltovalidate);if(b!=null){showErrorBubble(b.id,true);break}else{showErrorBubble(Page_Validators[a].id,true);break}}}function hideBubble(){var a=document.getElementById("errorBubble");if(a!=null)a.style.display="none";var b=document.getElementById("errorShim");if(b!=null)b.style.display="none"}var hideTimeoutId=null;function showErrorBubble(d){var a=document.getElementById(d);if(a==null)return;var c=document.getElementById("errorShim"),b=document.getElementById("errorBubble");if(b==null)return;b.style.setExpression("left","getElementLeft(document.getElementById('"+a.id+"'))");b.style.setExpression("top","getElementTop(document.getElementById('"+a.id+"')) - (document.getElementById('errorBubble').clientHeight + 3)");c.style.setExpression("left","getElementLeft(document.getElementById('"+a.id+"'))");c.style.setExpression("top","getElementTop(document.getElementById('"+a.id+"')) - (document.getElementById('errorBubble').clientHeight + 3)");b.style.display="block";c.style.display="block";c.style.width=b.clientWidth;c.style.height=b.clientHeight;document.recalc(true);if(a.className.indexOf("bubbleController")==-1)a.className+=" bubbleController";try{a.focus()}catch(h){expandCollapsedParents(a);a.focus()}var f=getElementLeft(a),g=getElementTop(a)-100,e="window.scrollTo("+f+", "+g+");";window.setTimeout(e,1);if(hideTimeoutId!=null)window.clearTimeout(hideTimeoutId);hideTimeoutId=window.setTimeout("hideBubble();",7e3)}function getElementTop(c){var b=0,a=c;while(a!=null){b+=a.offsetTop;a=a.offsetParent}return b}function getElementLeft(c){var b=0,a=c;while(a!=null){b+=a.offsetLeft;a=a.offsetParent}return b}function expandCollapsedParents(b){var a=b.parentElement;while(a!=null){if(a.className.match(/\bcollapsed\b/gi))a.previousSibling.firstChild.ExpandCollapse();a=a.parentElement}}function OpenNewWindow(a){window.open(a);bubbleEvent=false}function GetIFrameEmptySource(){return ""}
