var timerFtext,obHost;
var ogbCron = {};
ogbCron.count = 0;
ogbCron.run = function(){
	var url = obHost+'index.php?option=com_obgrabber&task=callaio';
	//var url = obHost+'index.php?option=com_obgrabber&task=cronjob';	
	ogbAjax(url,function(txt){ogbCron.next(txt)});
}
ogbCron.sleep = function(txt){
	clearTimeout(timerFtext);
	timerFtext = setTimeout ('ogbCron.run()',60000);
}
ogbCron.next = function(txt){
	if(this.stop(txt)){		
		this.sleep();
	}else if(ogbCron.count<10) {
		ogbCron.count ++;
		this.run();	
	}else{
		ogbCron.count = 0;
		this.sleep();
		//location.reload();
	}
}
ogbCron.stop = function(str){
	var p = /\{ogb-res:\d\}/g;
	if(p.exec(str)=='{ogb-res:0}'){
		return false;
	}
	return true;
}