// JavaScript Document
function Banner(href, src, alt, separator){
	this.alt = alt;
	this.href = href;
	this.separator = separator;
	this.src = src;	
	
	this.addAtribute = _addAtribute;
	this.getAttributes = _getAttributes;
	this.getSize = _getSize;
};

function _addAtribute(name, val){
	this[name] = val;
};

function _getAttributes(){
	var params = '';
	var ad = '';
	for(x in this){		
		if(x != 'href' && x != 'src' && x != 'height' && x != 'width' && x != 'separator' && x != 'addAtribute' && x != 'getAttributes' && x != 'getSize' && x != 'alt' && x != 'visible'){
			params += x + "=" + this[x] + this.separator;
			ad = '?';
		}
	}
	return ad + params + ' ';
};

function _getSize(){	
	return "width=" + this.width + " height=" + this.height + " ";
};

function BannerHost(){
	this.banners = new Array();
};

$ = BannerHost.prototype;

$.addBanner = function(href, src, alt, separator, params, visible){
	this.banners[this.banners.length] = new Banner(href, src, alt, separator);
	for(x in params){
		this.banners[this.banners.length - 1].addAtribute(x, params[x]);
	}
	this.banners[this.banners.length - 1].addAtribute('visible', visible);
};

$.drawBanners = function(){
	var d = document;
	var style = '';
	for(var i = 0; i < this.banners.length; i++){
		if(this.banners[i].visible == false){
			style = ' style=\'display:none;\' ';
		}
		d.write("<span " + style + "><a href='" + this.banners[i].href + "' target=_blank><img src='" + this.banners[i].src + this.banners[i].getAttributes() + "' border=0 " + this.banners[i].getSize() + "' alt='" + this.banners[i].alt + "'></a>&nbsp;</span>");
		style = '';
	}
};

var banners = new BannerHost();
	banners.addBanner(  "http://top.mail.ru/jump?from=825320", 
						"http://top.list.ru/counter", "Mail.ru", ";",
						{
							width: 88, 
							height: 31,
							id: 825320,
							t: 210,
							j: navigator.javaEnabled(),
							js: 13,
							r: escape(document.referrer),
							rand: Math.random(),
							s: screen.width + "*" + screen.height,
							d: (screen.colorDepth?screen.colorDepth:screen.pixelDepth)
						}
	);	
	banners.addBanner(  "http://top100.rambler.ru/top100/", 
						"http://top100-images.rambler.ru/top100/banner-88x31-rambler-darkblue2.gif", "Rambler Top100", ";",
						{
							width: 88, 
							height: 31							
						}
	
	);	
	banners.addBanner(  "http://top100.rambler.ru/top100/", 
						"http://counter.rambler.ru/top100.cnt?654416", "Rambler", ";",
						{
							width: 1, 
							height: 1							
						}
		);
