var csInterface=new CSInterface;function onLoaded(){var a=new CSInterface;b=a.hostEnvironment.appName;"FLPR"!=b&&loadJSX();for(var c=["PHXS"],d=0;d<c.length;d++){var e=c[d];if(0<=b.indexOf(e)&&(e=document.getElementById("btn_"+e)))e.disabled=!1}updateThemeWithAppSkinInfo(a.hostEnvironment.appSkinInfo);a.addEventListener(CSInterface.THEME_COLOR_CHANGED_EVENT,onAppThemeColorChanged)}
function updateThemeWithAppSkinInfo(a){var c=a.panelBackgroundColor.color;document.body.bgColor=toHex(c);var d=(new CSInterface).hostEnvironment.appName;"PHXS"==d&&addRule("ppstyle","button, select, input[type=button], input[type=submit]","border-radius:3px;");if("PHXS"==d||"PPRO"==d||"PRLD"==d){var d="background-image: -webkit-linear-gradient(top, "+toHex(c,40)+" , "+toHex(c,10)+");",e="background-image: -webkit-linear-gradient(top, "+toHex(c,15)+" , "+toHex(c,5)+");",f,g,h,k,l;127<c.red?(f="#000000;",
g="color:"+toHex(c,-70)+";",h="border-color: "+toHex(c,-90)+";",k=toHex(c,54)+";",l="background-image: -webkit-linear-gradient(top, "+toHex(c,-40)+" , "+toHex(c,-50)+");"):(f="#ffffff;",g="color:"+toHex(c,100)+";",h="border-color: "+toHex(c,-45)+";",k=toHex(c,-20)+";",l="background-image: -webkit-linear-gradient(top, "+toHex(c,-20)+" , "+toHex(c,-30)+");");addRule("ppstyle",".default","font-size:"+a.baseFontSize+"px; color:"+f+"; background-color:"+toHex(c)+";");addRule("ppstyle","button, select, input[type=text], input[type=button], input[type=submit]",
h);addRule("ppstyle","button, select, input[type=button], input[type=submit]",d);addRule("ppstyle","button, select, input[type=button], input[type=submit]","-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2);");addRule("ppstyle","button:enabled:active, input[type=button]:enabled:active, input[type=submit]:enabled:active",l);addRule("ppstyle","button:enabled:active, input[type=button]:enabled:active, input[type=submit]:enabled:active","-webkit-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);");
addRule("ppstyle","[disabled]",e);addRule("ppstyle","[disabled]",g);addRule("ppstyle","input[type=text]","padding:1px 3px;");addRule("ppstyle","input[type=text]","background-color: "+k)+";";addRule("ppstyle","input[type=text]:focus","background-color: #ffffff;");addRule("ppstyle","input[type=text]:focus","color: #000000;")}else addRule("ppstyle",".default","font-size:"+a.baseFontSize+"px; color:"+reverseColor(c)+"; background-color:"+toHex(c,20)),addRule("ppstyle","button","border-color: "+toHex(panelBgColor,
-50))}function addRule(a,c,d){if(a=document.getElementById(a))a=a.sheet,a.addRule?a.addRule(c,d):a.insertRule&&a.insertRule(c+" { "+d+" }",a.cssRules.length)}function reverseColor(a,c){return toHex({red:Math.abs(255-a.red),green:Math.abs(255-a.green),blue:Math.abs(255-a.blue)},c)}function toHex(a,c){function d(a,c){var d=!isNaN(c)?a+c:a;0>d?d=0:255<d&&(d=255);d=d.toString(16);return 1==d.length?"0"+d:d}var e="";if(a)with(a)e=d(red,c)+d(green,c)+d(blue,c);return"#"+e}
function onAppThemeColorChanged(a){a=JSON.parse(window.__adobe_cep__.getHostEnvironment()).appSkinInfo;updateThemeWithAppSkinInfo(a)}function loadJSX(){var a=new CSInterface,c=a.getSystemPath(SystemPath.EXTENSION)+"/jsx/";a.evalScript('$._ext.evalFiles("'+c+'")')}function evalScript(a,c){(new CSInterface).evalScript(a,c)}
function onClickButton(a){"FLPR"==a?evalScript('fl.createDocument(); fl.getDocumentDOM().addNewText({left:100, top:100, right:300, bottom:300} , "Hello Flash!" ); '):evalScript("$._ext_"+a+".run()")}function openUrl(a){csInterface.openURLInDefaultBrowser(a)};
