﻿var MSIE=false,ver=0,indexOfMSIE=navigator.userAgent.indexOf("MSIE");if(indexOfMSIE!=-1){MSIE=true;ver=parseFloat(navigator.userAgent.substring(indexOfMSIE+5,navigator.userAgent.indexOf(";",indexOfMSIE)))}var slInstalled=false;try{var b=null;if(MSIE){b=new ActiveXObject("AgControl.AgControl");slInstalled=true}else{var plugin=navigator.plugins["Silverlight Plug-In"];if(plugin){var version=plugin.description.split(".");if(parseInt(version[0])>=2)slInstalled=true}}}catch(a){}var isFirefox=navigator.userAgent.indexOf("Firefox")>=0,isMac=navigator.appVersion.indexOf("Macintosh")>=0,slSupported=MSIE&&ver>=5&&!isMac||isFirefox,isUpLevel=slSupported&&slInstalled,xmlData=XMLData("pc_design_flowchart_files/data.xml"),g_RowStyleList=["propViewerEvenRow","propViewerOddRow"],strShape="Shape Name:";function getEvent(a){if(!a)return window.event;return a}function getSrcElem(b){var b=getEvent(b),a;if(b.target)a=b.target;else if(b.srcElement)a=b.srcElement;if(a.nodeType==3)a=a.parentNode;return a}if(document.implementation.hasFeature("XPath","3.0")){Element.prototype.selectNodes=function(f){var b=new XPathEvaluator,e=b.createNSResolver(this.ownerDocument==null?this.documentElement:this.ownerDocument.documentElement),d=b.evaluate(f,this,e,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),c=[];for(var a=0;a<d.snapshotLength;a++)c[a]=d.snapshotItem(a);return c};Document.prototype.selectNodes=function(a){return this.documentElement.selectNodes(a)}}function SelectSingleNode(a,b){if(MSIE)return a.selectSingleNode(b);else{var c=new XPathEvaluator,d=c.createNSResolver(a.ownerDocument==null?a.documentElement:a.ownerDocument.documentElement),e=c.evaluate(b,a,d,XPathResult.FIRST_ORDERED_NODE_TYPE,null);return e.singleNodeValue}}function SelectNodes(b,a){return b.selectNodes(a)}function XMLData(b){var a=null;if(isUpLevel){if(MSIE){a=CreateObject("Microsoft.XMLDOM");if(a==null)a=CreateObject("MSXML2.DOMDocument")}else try{a=document.implementation.createDocument("","",null)}catch(c){}if(a!=null){a.async=false;a.load(b);if(MSIE&&a.parseError.errorCode!=0)a=null}}return a}function CreateObject(strObj){var obj=null;eval("try { obj = new ActiveXObject(strObj); } catch (e) {}");return obj}function doVersion(){if(isUpLevel){frmToolbar.divDownLevel.innerHTML="";frmToolbar.divUpLevel.innerHTML=frmWidgets.divData.innerHTML}}function FindShapeXML(g,f){var b=null;if(xmlData!=null){var a=SelectSingleNode(xmlData,"VisioDocument/Pages");if(!a)return null;var d='.//Page[@ID = "'+g+'"]',e=SelectSingleNode(a,d);if(e==null)return null;var c='.//Shape[@ID = "'+f+'"]';b=SelectSingleNode(a,c)}return b}function OnShapeKey(c,b,d){var a=d;if(MSIE)a=window.frmDrawing.event;if(a.keyCode==13&&a.ctrlKey)UpdateProps(c,b);else if(a.keyCode==13)OnShapeClick(c,b,a)}function OnShapeClick(pageID,shapeID,jsEvent,slEvent){if(isUpLevel){var e=jsEvent;if(MSIE)e=frmDrawing.window.event;if(frmToolbar.widgets&&frmToolbar.widgets.Details&&(e!=null&&e.ctrlKey||e==null&&slEvent.Ctrl))UpdateProps(pageID,shapeID);else{var shapeNode=FindShapeXML(pageID,shapeID),hlObj=GetHLAction(shapeNode,pageID,shapeID);if(hlObj!=null)if(hlObj.DoFunction.length>0)eval(hlObj.DoFunction);else if(hlObj.Hyperlink.length>0)if(hlObj.NewWindow)window.open(hlObj.Hyperlink);else top.location.href=hlObj.Hyperlink.substr(0,510);else if(e!=null&&getSrcElem(e)!=null){var elem=e.srcElement,href=elem.origHref;if(href==null)href=elem.href;var target=elem.origTarget;if(target==null)target=elem.target;if(href&&href.length>0){href=HTMLEscape(href);if(target&&target=="_blank")window.open(href);else top.location.href=href.substr(0,510)}}}}return !isUpLevel}function UpdateProps(b,a){var c=FindShapeXML(b,a);FillPropPane(c,frmToolbar.hideDetails)}function UpdatePropsByShapeName(b,a){var c=FindShapeXMLByName(b,a);FillPropPane(c,frmToolbar.hideDetails)}function FillPropPane(d,a){if(d!=null&&a!=null){if(a.style.display=="none")frmToolbar.ToggleWidget(a);var c="",e=d.attributes.getNamedItem("Name");if(e)c+="<span class='p2' style='padding-left:2px;'>"+strShape+" "+HTMLEscape(e.value)+"</span>";var b=CreatePropTable(d);if(b.indexOf("<table")==-1)b="<p class='p2' style='margin-left:1em;margin-top:0em;'>"+b+"</p>";if(b.length>0)c+=b;else c=strNoCustomPropertiesToDisplayText;a.innerHTML=c;a.minHeight=75}}function CreatePropTable(g){var a="",e="<table class='propViewerTABLE' borderColor='#999999' cellPadding='2' width='95%' border='1' summary='This table contains shape details'>";e+="<THEAD class='propViewerTHEAD'><TH>Label</TH><TH>Value</TH></THEAD>";var h="</TABLE>";if(g!=null){var d=SelectSingleNode(g,"Prop"),i=d.length;for(var b=0;b<i;b++){a+="<TR class='"+g_RowStyleList[b%2]+"'>";var c="";oPropLabel=d.item(b).selectSingleNode("Label/textnode()");if(oPropLabel!=null)c=HTMLEscape(oPropLabel.text);else{oPropName=d.item(b).attributes.getNamedItem("Name");if(oPropName)c=HTMLEscape(oPropName.text)}if(c.length>0){a+="<TD class='propViewerTD'>"+c+"</TD>";a+="<TD class='propViewerTD'>";var f="&nbsp;";oPropValue=d.item(b).selectSingleNode("Value/textnode()");if(oPropValue)f=HTMLEscape(oPropValue.text);a+=f+"</TD></TR>"}}if(a!="")a=e+a+h;else a="No Details Available."}return a}function keyHandler(){var a=frmDrawing.window.event;if(a.keyCode==13)a.srcElement.click()}function GoToPage(a){if(viewMgr)viewMgr.loadPage(a);else DefPageLoad(a)}function GoToPageByID(b){var a=PageIndexFromID(b);if(a>=0)GoToPage(a)}function PageIndexFromID(c){if(g_FileList!=null){var e,a,d,b=false;for(a=0;a<g_FileList.length&&!b;a++)if(c==g_FileList[a].PageID)return a}return -1}function PageIndexFromName(e){if(g_FileList!=null){var g,c=e;c=c.toLowerCase();var b,f,d=false;for(b=0;b<g_FileList.length&&!d;b++){var a=g_FileList[b].PageName;a=HTMLUnescape(a);a=a.toLowerCase();if(c==a)return b}}return -1}function PageIndexFromFileName(e){if(g_FileList!=null){var g,c=e;c=c.toLowerCase();var b,f,d=false;for(b=0;b<g_FileList.length&&!d;b++){var a=g_FileList[b].PriImage;a=a.toLowerCase();if(c==a)return b;a=g_FileList[b].SecImage;a=a.toLowerCase();if(c==a)return b}}return -1}function PageIndexFromVisioPageIndex(c){if(g_FileList!=null){var e,a,d,b=false;for(a=0;a<g_FileList.length&&!b;a++)if(c==g_FileList[a].PageIndex)return a}return -1}function FindShapeXML(g,f){var b=null;if(xmlData){var a=SelectSingleNode(xmlData,"VisioDocument/Pages");if(!a)return null;var d='.//Page[@ID = "'+g+'"]',e=SelectSingleNode(a,d);if(!e)return null;var c='.//Shape[@ID = "'+f+'"]';b=SelectSingleNode(a,c)}return b}function FindShapeXMLByName(f,e){var b=null;if(xmlData){var a=SelectSingleNode(xmlData,"VisioDocument/Pages");if(!a)return null;var d='.//Page[@Name $ieq$ "'+EscapeString(f)+'"]',g=SelectSingleNode(a,d);if(!g)return null;var c='.//Shape[@Name $ieq$ "'+EscapeString(e)+'"]';b=SelectSingleNode(a,c)}return b}function Unquote(a){var c=0,b=a.length;if(a.charAt(0)=='"')c=1;if(a.charAt(b-1)=='"')b-=1;return a.substring(c,b)}function ConvertXorYCoordinate(g,e,i,c,h,f){var d=(i-e)/2,b=(h-c)/2,a=1*g;a=a-(e+d);a=a/d;if(f!=0)a=0-a;a=a*b;a=a+(c+b);return a}function showObject(a,b){if(a==null)a=getObj(b);if(a!=null){a.style.display="";a.style.visibility="visible"}return a}function hideObject(a,b){if(a==null)a=getObj(b);if(a!=null){a.style.visibility="hidden";a.style.display="none"}return a}function EscapeString(d){var a="";for(var c=0;c<d.length;c++){var b=d.charAt(c);if(b=="\\")a+="\\\\";else if(b=='"')a+='\\"';else if(b=="'")a+="\\'";else a+=b}return a}function HTMLEscape(d){var a="";for(var c=0;c<d.length;c++){var b=d.charAt(c);if(b=="\\")a+="&#92;";else if(b=='"')a+="&#34;";else if(b=="'")a+="&#39;";else if(b=="<")a+="&#60;";else if(b=="<")a+="&#62;";else if(b=="&")a+="&#38;";else a+=b}return a}function HTMLUnescape(c){var b="",e="&#xx;";for(var a=0;a<c.length-e.length+1;a++)if(c.charAt(a)=="&"&&c.charAt(a+1)=="#"&&c.charAt(a+4)==";"){var d=c.charAt(a+2);d+=c.charAt(a+3);if(d=="34")b+='"';else if(d=="39")b+="'";else if(d=="60")b+="<";else if(d=="62")b+=">";else if(d=="92")b+="\\";else if(d=="38")b+="&";a=a+e.length-1}else b+=c.charAt(a);b+=c.substring(a,c.length);return b}