document.write("<span id=ad_area>&nbsp;</span>");
document.write('<script src="http://www.oilchina.com.cn/js/LiuMeiTi.js"></script>');


function sort_schedule(a,b){
                return((a.priority>b.priority) ? -1:((a.priority == b.priority) ? 0:1));
}

function do_schedule(){
	try{
		schedule.sort(sort_schedule);
	}catch(E){}

        var l,len = arguments.length;
        if(len>0) l = arguments[0];
        if(typeof(l)=='undefined') l = 0;
        if(l >= schedule.length) return;

        this.timeout    = 0;
        this.priority   = schedule[l].priority;
        for(var i=l;i<schedule.length;i++){
                var prior = (i==0)?0:i-1;
                if(schedule[i].priority>=schedule[prior].priority||schedule[prior].Finished==true){
//                      window.status="No."+i+" is running...";
                        schedule[i].start(schedule[i],i);
                                
                }else{          
                        setTimeout("do_schedule("+i+")",500);
                        break;
                }
        }
        if(true){

        }
}                               


function documentAdWrite(str){
        ad_content      = document.getElementById("ad_area");
        ad_content.innerHTML += str;
}


function documentAdClear(){
        ad_content      = document.getElementById("ad_area");
        ad_content.innerHTML = "";
}

function documentAdShow(){
        ad_content      = document.getElementById("ad_area");
        alert(ad_content.innerHTML);
}


function SohuAd(type,start_func,end_func,TimeOut,priority){
        this.start=start_func;
        this.end=end_func;
        this.priority = priority;
        this.TimeOut    = TimeOut;
        this.Finished   = false;
}

var schedule=new Array();
var ad_cnt=0;                                
