function toBool(b){return("false"===b)?false:true}function trim(b){return b.replace(/^\s*|\s*$/g,"")}function proc_open(c){var e="0";var g=document.getElementById("text_url").value;var b=chrome.i18n.getMessage("msg_openwithcookies");var f=document.getElementById("btn_openie0");var d=document.getElementById("btn_openie1");if(f){f.disabled=true}if(d){d.disabled=true}chrome.extension.sendRequest({type:"set",key:"openbyie_openielastbtn",value:c},function(h){});chrome.extension.sendRequest({type:"openbyie",param1:e,param2:"",param3:escape(g),param4:"",param5:"",param6:c,param7:escape(b)},function(i){if(i.error){alert(chrome.i18n.getMessage("msg_error"));if(f){f.disabled=false}if(d){d.disabled=false}}else{if(i.resultstring!=""){alert(i.resultstring);if(f){f.disabled=false}if(d){d.disabled=false}}else{var h=document.getElementById("chk_autoclose");if(h&&h.checked){window.close()}else{setTimeout(function(){if(f){f.disabled=false}if(d){d.disabled=false}},1300)}}}})}function getValue(c,b,d){b=b.toLowerCase();d=d.toLowerCase();ss=c.toLowerCase();p1=ss.indexOf(b);if(p1<0){return}s1=c.substr(p1+b.length,c.length);ss=s1.toLowerCase();p1=ss.indexOf(d);if(p1<0){return}s1=s1.substr(0,p1);return s1}function proc_setlang(){var b=document.getElementsByTagName("*");var f,e,c;for(var d=0;d<b.length;d++){if(b[d].id=="i18n"){f=b[d].title;b[d].title="";if(!f){continue}if(f.indexOf("$")>=0){while(true){e=getValue(f,"$","$");if(!e||(e=="")){break}c=chrome.i18n.getMessage(e);if(!c){f="";break}f=f.replace("$"+e+"$",c)}}else{f=chrome.i18n.getMessage(f)}if(f){f=f.replace(/(\r\n|\n\r|\r|\n)/g,"<br>");b[d].innerHTML=f}}}}function getparam(c,b){b=b+"=";b=b.toLowerCase();var e=c.toLowerCase().indexOf(b);if(e<0){return""}c=c.substr(e+b.length);var d=c.toLowerCase().indexOf("&");if(d>=0){return c.substr(0,d)}else{return c}}function init(){proc_setlang();try{var d=location.href;if(d==undefined){d=""}var f=unescape(getparam(d,"chromeurl"));var c=trim(f.toLowerCase());if(c.indexOf("http://")==0||c.indexOf("https://")==0||c.indexOf("ftp://")==0||c.indexOf("file://")==0){document.getElementById("text_url").value=f}else{chrome.extension.sendRequest({type:"get",key:"etc_homeurl"},function(g){if(!g){g="chrome://"}document.getElementById("text_url").value=g})}}catch(e){}var b=document.getElementById("btn_openie1");if(b){b.addEventListener("click",function(){proc_open(1)});b.style.display=""}var b=document.getElementById("btn_openie0");if(b){b.addEventListener("click",function(){proc_open(0)});b.style.display=""}chrome.extension.sendRequest({type:"get",key:"openbyie_openielastbtn"},function(h){if(h==null){h=1}var g=document.getElementById("btn_openie"+h);if(g){g.focus()}})}var a=document.getElementById("chk_autoclose");if(a){init()}else{setTimeout(function(){init()},500)};