/*
	ItemstatLite by T.G.(farmer1992@gmail.com)
	http://code.google.com/p/itemstatlite/
	如果你安装遇到了麻烦 可以直接联系 QQ 22267156 QQ群:76067737 我会帮你解决 
	
	itemstatlite_path 的配置方法
	
	itemstatlite_path的内容是itemstatlite的绝对目录 注意最后加/
	
	例
	你将itemstat文件夹上传到 网站/itemstatlite/ 中
	这里写 var itemstatlite_path="/itemstatlite/";

	即保证 你的网址/itemstatlite/itemstatlite.js 能访问到本文件
	
*/

var itemstatlite_path="/itemstatlite/";

function itemstatlite_show(){}
function itemstatlite_hide(){}

function loadScript(src, callback, charset) {  
   var script = document.createElement('script');  
   script.setAttribute("type","text/javascript");
   if (charset) {  
       script.setAttribute("charset", charset);  
   }  
   script.setAttribute("src", src);  
   document.getElementsByTagName("head")[0].appendChild(script);  
   
   
   if(document.all) {  
       script.onreadystatechange = function() {  
           if(this.readyState == 4 || this.readyState == 'complete' || this.readyState == 'loaded') {  
               callback();  
           }  
       };  
   } else {  
       script.onload = function() {  
           callback();  
       };  
   }  
}  


function domReady(fn)
{
		if (document.addEventListener){
			document.addEventListener("DOMContentLoaded", init, false);
		}
		
		if(window.addEventListener) window.addEventListener("load",init,false);
		else if (window.attachEvent) window.attachEvent("onload",init);
			
		var _timer = setInterval(function() {
			if(document.readyState == "loaded" ||document.readyState == "complete")
			{
				init();
			}
		},20);
		
		function init(){
			if (arguments.callee.done){
				return;
			}
			arguments.callee.done = true;
			if (_timer) {
				clearInterval(_timer);
				_timer = null;
			}
			fn();
		}
}

function itemstatlite_begin(path){
	var h=document.getElementsByTagName("head")[0];
	var l=document.createElement("link");
	
	l.setAttribute("type","text/css");
	l.setAttribute("href",path+"css/itemstatlite.css");
	l.setAttribute("rel","stylesheet");
	h.appendChild(l);

	if(document.all){
		domReady(function(){
			loadScript(path+"js/overlib_mini.js",function(){	
				loadScript(path+"js/xmlhttp.js",function(){
					loadScript(path+"js/main.js",function(){OLonLoad_handler(0);},"utf-8");			
				},"utf-8");
				});
			});
	}
	else
	{
		loadScript(path+"js/overlib_mini.js",function(){});
		loadScript(path+"js/xmlhttp.js",function(){},"utf-8");
		loadScript(path+"js/main.js",function(){},"utf-8");		
	}		
	
}

itemstatlite_begin(itemstatlite_path);