var com = {
	lang : null,
	nm : 0,
	tw :0,
	ids: null,
	idss: null,
	path : null,
	kind : navigator.appName,

getXML : function(nm,lang,ids,tw, idss){
	this.nm = nm; 
	this.tw = tw; 
	this.lang=lang; 
	this.ids=ids; 
	this.idss=idss;
	
	if(lang=='us') this.lang='';
	this.path = 'images/'+nm+'/'+this.tw+this.lang+'/';
	obj = isdom(this.path+'hyperlink.xml').responseXML; 
	if(this.kind=='Netscape'){ 
		if(obj==null){ 
			len=0;
		}else{
			el = obj.getElementsByTagName(ids);
			len = el.length;
		}
	}else{
		el = obj.getElementsByTagName(ids);
		len = el.length;
	}
	
	if(len==0){
		this.path = 'images/default'+this.lang+'/';
		obj = isdom(this.path+'hyperlink.xml').responseXML;
		el = obj.getElementsByTagName(ids);
	}
	
	for(i=0;i<el.length;i++){
		this.getNode(el[i].getElementsByTagName('animation'));
	}
},

getNode : function(node){
	for(k=0; k<node.length; k++){ //alert(k);
		t = this._getInfo(node[k], parseInt(node[k].getAttribute('flag')), k);
		_obj = document.getElementById('ts'+(k+1));
		_obj.innerHTML = t;
	}
},
 
_getInfo : function(n, flag, ps){
	t='';  p = 'images/'+ps+'/';
	if(ps!='default'){ 
		n = n.getElementsByTagName('link'); 
		p = this.path;
	}
	
	_t = '';
	if(n[0].firstChild.nodeValue.indexOf('ids=')>0){ 
		n[0].firstChild.nodeValue += this.idss;
		_t = "&t=" + n[0].getAttribute('t') + "&kw=" + n[0].getAttribute('kw');
	}
	switch(flag){
		case 0: 
			if(n[0].firstChild==null)
				t ="<a href='#'><img border=0 src="+p+n[0].getAttribute('img')+"></a>";
			else
			t ="<a href='"+n[0].firstChild.nodeValue+_t+"' target=_blank><img border=0 src="+p+n[0].getAttribute('img')+"></a>";
			break;
		case 1:
			_ts = '';
			if(n[1].firstChild.nodeValue.indexOf('ids=')>0){ 
				n[1].firstChild.nodeValue += this.idss;
				_ts = "&t=" + n[1].getAttribute('t') + "&kw=" + n[1].getAttribute('kw');
			}
	
			if((n[0].firstChild==null)||(n[1].firstChild==null)){
				if(n[0].firstChild==null){ 
					t = "<img id='ts' class=dists border=0 src="+p+n[0].getAttribute('img')+"><a href='" +
					   n[1].firstChild.nodeValue + _t + "' target=_blank><img class=disnonets border=0 src=" + p + n[1].getAttribute('img') +
					   "></a>";
				}
				if(n[1].firstChild==null){ 
					t = "<a href='"+n[0].firstChild.nodeValue + _t + "' target=_blank><img id='ts' class=dists border=0 src=" + p +
						n[0].getAttribute('img')+"></a><img class=disnonets border=0 src=" + p + n[1].getAttribute('img') + ">";
				}
			}else{
				t = "<a href='"+n[0].firstChild.nodeValue + _t + "' target=_blank><img id='ts' class=dists border=0 src=" + p + n[0].getAttribute('img') + "></a><a href='" +
				   n[1].firstChild.nodeValue + _ts + "'><img class=disnonets border=0 src="+p+n[1].getAttribute('img')+"></a>";
			}
			break;
		case 2:
			t = this.getXMLD(ps);
			break;
	}
	return t;
},

getXMLD : function(ps){
		obj = isdom('images/default/hyperlink.xml').responseXML;
		el = obj.getElementsByTagName('animation');
		h = this._getInfo(el[ps].getElementsByTagName('link'),parseInt(el[ps].getAttribute('flag')),'default');
		return h;
	}
}

function jumb(){
	_id = document.getElementsByTagName('img'); 
	for(i=0; i<_id.length; i++){
		if(_id[i].id=='ts'){
			tmp = _id[i].className;
			_id[i].className = _id[i].parentNode.nextSibling.childNodes[0].className;
			_id[i].parentNode.nextSibling.childNodes[0].className = tmp;
		}
	}
	setTimeout('jumb()',1000);
}


//Coder by tritigi@yahoo.com
var image = {
	host : "http://localhost/teaser/img/" ,
	
	
load : function (str, links, vitri){
	if (str =='') return ;
	var name = "ts"+ vitri ;
	
	if((vitri < 3) || (vitri == 10))
		var img=this.showImg(str, links, 400, 60) ;
	else if ((vitri > 2) && (vitri < 10))
		var img=this.showImg(str, links, 137, 80) ;
	else
		var img=this.showImg(str, links, 128, 242) ;


	obj = document.getElementById(name) ;
	obj.innerHTML = img ;
},

showImg : function (file, links, w, h){
	var len = file.length ;
	var duoi = file.substr(len -3, len) ;
	if(duoi == "swf")
		var img='<embed height="'+ h +'" width="'+ w +'" bgcolor="" wmode="transparent" quality="high" menu="false" src="'+ this.host + file +'"/>' ;
	else
		var img='<a href="'+ links +'" target="_blank"><img vspace="8"  src="'+ this.host + file +'" width="'+ w +'" height="'+ h +'" border=0></a>';
		
	return img ;
},

imgRan : function (str, links, vitri){
	if (str =='') return ;
	var name = "ts"+ vitri ;
	
	if((vitri < 3) || (vitri == 10))
		var img=this.showImg(str, links, 400, 60) ;
	else if ((vitri > 2) && (vitri < 10))
		var img=this.showImg(str, links, 137, 80) ;
	else
		var img=this.showImg(str, links, 128, 242) ;
		
	var obj = parent.document.getElementById(name) ;
	obj.innerHTML =  img ;
}	
}	//namepaces

//**********************************************************
function showhide(id){
	obj = document.getElementById(id) ;
	obj.style.display = "block" ;
}
