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 b=a.panelBackgroundColor.color;document.body.bgColor=toHex(b);var c=(new CSInterface).hostEnvironment.appName;"PHXS"==c&&addRule("ppstyle","button, select, input[type=button], input[type=submit]","border-radius:3px;");if("PHXS"==c||"PPRO"==c||"PRLD"==c){var c="background-image: -webkit-linear-gradient(top, "+toHex(b,40)+" , "+toHex(b,10)+");",d="background-image: -webkit-linear-gradient(top, "+toHex(b,15)+" , "+toHex(b,5)+");",e,f,g,h,k;127<b.red?(e="#000000;",
f="color:"+toHex(b,-70)+";",g="border-color: "+toHex(b,-90)+";",h=toHex(b,54)+";",k="background-image: -webkit-linear-gradient(top, "+toHex(b,-40)+" , "+toHex(b,-50)+");"):(e="#ffffff;",f="color:"+toHex(b,100)+";",g="border-color: "+toHex(b,-45)+";",h=toHex(b,-20)+";",k="background-image: -webkit-linear-gradient(top, "+toHex(b,-20)+" , "+toHex(b,-30)+");");addRule("ppstyle",".default","font-size:"+a.baseFontSize+"px; color:"+e+"; background-color:"+toHex(b)+";");addRule("ppstyle","button, select, input[type=text], input[type=button], input[type=submit]",
g);addRule("ppstyle","button, select, input[type=button], input[type=submit]",c);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",k);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]",d);addRule("ppstyle","[disabled]",f);addRule("ppstyle","input[type=text]","padding:1px 3px;");addRule("ppstyle","input[type=text]","background-color: "+h)+";";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(b)+"; background-color:"+toHex(b,20)),addRule("ppstyle","button","border-color: "+toHex(panelBgColor,
-50))}function addRule(a,b,c){if(a=document.getElementById(a))a=a.sheet,a.addRule?a.addRule(b,c):a.insertRule&&a.insertRule(b+" { "+c+" }",a.cssRules.length)}function reverseColor(a,b){return toHex({red:Math.abs(255-a.red),green:Math.abs(255-a.green),blue:Math.abs(255-a.blue)},b)}function toHex(a,b){function c(a,b){var c=!isNaN(b)?a+b:a;0>c?c=0:255<c&&(c=255);c=c.toString(16);return 1==c.length?"0"+c:c}var d="";if(a)with(a)d=c(red,b)+c(green,b)+c(blue,b);return"#"+d}
function onAppThemeColorChanged(a){a=JSON.parse(window.__adobe_cep__.getHostEnvironment()).appSkinInfo;updateThemeWithAppSkinInfo(a)}function loadJSX(){var a=new CSInterface,b=a.getSystemPath(SystemPath.EXTENSION)+"/jsx/";a.evalScript('$._ext.evalFiles("'+b+'")')}function evalScript(a,b){(new CSInterface).evalScript(a,b)}
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()")};
