Forum Moderators: open
var option = new function() {this.name = '';}
function power_keys() {ondemand('power_keys','power_keys_init');}
function ondemand(s,f,p1,p2)
{//alert(s+'\n'+f+'\n'+p1+'\n'+p2);
if (typeof f=='string' && eval('typeof ' + f)!='function')
{
var js=document.createElement('script');
js.src='scripts/'+s+'.js';
js.type='application/javascript';
var newtext = document.createTextNode('\n');
if (document.body.style.scrollbar3dLightColor==undefined && document.body.style.textOverflow==undefined)
{
document.getElementsByTagName('head')[0].insertBefore(js,document.getElementsByTagName('script')[1]);
document.getElementsByTagName('head')[0].insertBefore(newtext,document.getElementsByTagName('script')[2]);
}
else {document.getElementsByTagName('head')[0].appendChild(js);}
option.f = f;
option.poll = 0;
option.interval = setInterval(ondemand_poll,200);
}
else {eval(f+'(\''+p1+'\',\''+p2+'\')');}
}
function ondemand_poll()
{//alert(option.f+'\n'+option.poll+'\n'+option.interval);
var f = option.f;
if (typeof f=='string' && eval('typeof ' + f)=='function')
{
clearInterval(option.interval);
eval(f+'()');var b = 1;
}
else
{
if (option.poll>=50)
{
window.clearInterval(option.interval);
}
}
option.poll++;
}
function ondemand(url,f)
{//alert(url+'\n\n'+f);
if (typeof f=='function') {eval(f+'();');}
else
{
var js=document.createElement('script')
js.setAttribute("type","text/javascript")
js.setAttribute("src",'scripts/'+url+'.js')
document.getElementsByTagName('head')[0].appendChild(js);
setTimeout(function() {ondemand_poll(f,0);},'100');
}
}
function ondemand_poll(f,i)
{//alert(url+'\n\n'+f);
if (i<100) {setTimeout(function() {if (eval('typeof ' + f)=='function') {eval(f+'();');} else {i++; ondemand_poll(f,i);}},'100');}
else {alert('Error: could not load \''+f+'\', please check your internet connection.');}
}