/* dynlite dhtml dom api  
 * @author:  Peter Assenov- AIP Solutions Ltd.' 2001-2006
 * @version: 2.2.1.3/2005-12-20
 */
/* init */
ver=2.2;
dev=0;
ns6=(document.all)? 0:1;
log=['--- dynlite log ---'];
if(!document.getElementById) alert('This site is not compatible with your browser!');
Array.prototype.push=function(el){this[this.length]=el;} /* ie5 sucks */

/* debug */
error=function(msg,url,lno,type)
{	var err=[msg,' line:'+lno,' url:'+url.replace(/^.*(\/|\\)/,'')];
	log.push('! '+(type||'')+'Error: '+err.join(','));
	if(dev) alert(log);
return true
}
onerror=error;

_alert=alert;
window.alert=function(el)
{	if(typeof(el)=='object')
	{	var code=[];
		for(var i in el){try{code.push(i+' -> '+el[i])}catch(e){}}
		(code.length>30)? document.write(code.join('<br>')) : _alert(code.join('\n'));
	}
	else _alert(el);
}
info=window.alert;

/* onload initialisation */	
load=[];
onload=function()
{		
	//writeFlash();
	log.push('- processing onload code');
	eval(load.join(';')); 
	if(window.init) init(); 
	log.push('#onload code executed');
}

/* dynlite layer */
obj=function(id,ob)
{ 		log.push('- creating object ['+id+']');
	var el=document.getElementById(id);
	if(!el) {error('no element with id='+id+' found','dynlite.js','obj()','Runtime');return 0;}
	if(ob) el.ob=ob;
	el.on=function(){el.style.display='block';}
	el.off=function(){el.style.display='none';}
return el;
}

/* auto object creation */
make=function(tag)
{		log.push('- processing ['+tag+'] tags');
	var arr=document.getElementsByTagName(tag);
	for(var i=arr.length-1;i>=0;i--)
	{	var id=arr.item(i).getAttribute('id');
		var ob=arr.item(i).getAttribute('obj');
		if(id&&ob)
		{	if(ob&&!window[ob])	error('no ptototype '+ob+' found','dynlite.js','make()','Runtime');
			else new window[ob](id); 
		}	
	}
}

/* misc */
_gmt=new Date();
gmt=function(){return new Date()-_gmt}
log.push('#dynlite core loaded, debug ['+((dev)?'on]':'off]'));
//enjoy...

