/* innerhtml.js
 * Copyright Ma Bingyao <andot@ujn.edu.cn>
 * Version: 1.9
 * LastModified: 2006-06-04
 * This library is free.  You can redistribute it and/or modify it.
 * http://www.coolcode.cn/?p=117
 */

var global_html_pool=[];var global_script_pool=[];var global_script_src_pool=[];var global_lock_pool=[];var innerhtml_lock=null;var document_buffer="";function set_innerHTML(_1,_2,_3){if(innerhtml_lock==null){innerhtml_lock=_1;}else{if(typeof (_3)=="undefined"){global_lock_pool[_1+"_html"]=_2;window.setTimeout("set_innerHTML('"+_1+"', global_lock_pool['"+_1+"_html']);",10);return;}else{if(innerhtml_lock!=_1){global_lock_pool[_1+"_html"]=_2;window.setTimeout("set_innerHTML('"+_1+"', global_lock_pool['"+_1+"_html'], "+_3+");",10);return;}}}function get_script_id(){return "script_"+(new Date()).getTime().toString(36)+Math.floor(Math.random()*100000000).toString(36);};document_buffer="";document.write=function(_4){document_buffer+=_4;};document.writeln=function(_5){document_buffer+=_5+"\n";};global_html_pool=[];var _6=[];_2=_2.split(/<\/script>/i);for(var i=0;i<_2.length;i++){global_html_pool[i]=_2[i].replace(/<script[\s\S]*$/ig,"");_6[i]={text:"",src:""};_6[i].text=_2[i].substr(global_html_pool[i].length);_6[i].src=_6[i].text.substr(0,_6[i].text.indexOf(">")+1);_6[i].src=_6[i].src.match(/src\s*=\s*(\"([^\"]*)\"|\'([^\']*)\'|([^\s]*)[\s>])/i);if(_6[i].src){if(_6[i].src[2]){_6[i].src=_6[i].src[2];}else{if(_6[i].src[3]){_6[i].src=_6[i].src[3];}else{if(_6[i].src[4]){_6[i].src=_6[i].src[4];}else{_6[i].src="";}}}_6[i].text="";}else{_6[i].src="";_6[i].text=_6[i].text.substr(_6[i].text.indexOf(">")+1);_6[i].text=_6[i].text.replace(/^\s*<\!--\s*/g,"");}}var s;if(typeof (_3)=="undefined"){s=0;}else{s=_3;}var _9,_a,_b;for(var i=0;i<_6.length;i++){var _c="document_buffer += global_html_pool["+i+"];\n";_c+="document.getElementById('"+_1+"').innerHTML = document_buffer;\n";_9=document.createElement("script");if(_6[i].src){_9.src=_6[i].src;if(typeof (global_script_src_pool[_9.src])=="undefined"){global_script_src_pool[_9.src]=true;s+=2000;}else{s+=10;}}else{_9.text=_6[i].text;s+=10;}_9.defer=true;_9.type="text/javascript";_9.id=get_script_id();global_script_pool[_9.id]=_9;_a=_c;_a+="document.getElementsByTagName('head').item(0)";_a+=".appendChild(global_script_pool['"+_9.id+"']);\n";window.setTimeout(_a,s);_b="document.getElementsByTagName('head').item(0)";_b+=".removeChild(document.getElementById('"+_9.id+"'));\n";_b+="delete global_script_pool['"+_9.id+"'];\n";window.setTimeout(_b,s+10000);}var _d="if (document_buffer.match(/<\\/script>/i)) {\n";_d+="set_innerHTML('"+_1+"', document_buffer, "+s+");\n";_d+="}\n";_d+="else {\n";_d+="document.getElementById('"+_1+"').innerHTML = document_buffer;\n";_d+="innerhtml_lock = null;\n";_d+="}";window.setTimeout(_d,s);};
c2eLibs++;
