function BanMng(){
	this.render = BanRender;
	this.write = BanWrite;
	this.add = BanAdd;
	this.insert = BanInsert;
	// this.parse = BanParse;
	this.bans = new Array();
}
function BanObj(){}
function BanAdd(type,name,url,src,height,trans){
	if(type == "image" ){
		//this.props = this.parse(data);
		this.ban = new BanObj();
		this.ban.type = "image";
		this.ban.name = name;
		this.ban.url = url;
		this.ban.img = new Image();		
		this.ban.img.src = src;
	//	this.ban.img.src = this.props["src"];
	//	this.ban.url = this.props["url"];
	//	this.ban.title = this.props["title"];	
		if(height)
			this.ban.height = height;
		else
			this.ban.height = 60;
		if(trans)
			this.ban.trans = trans;
		this.bans.push(this.ban);
	} else if(type == "iframe" ){
		this.ban = new BanObj();
		this.ban.type = "iframe";
		this.ban.name = name;
		this.ban.url = url;
		this.ban.iframe = src;
		if(height)
			this.ban.height = height;
		this.bans.push(this.ban);
	} else 
		alert("ban type unknown!"+type);
}
/*function BanParse(data){
	this.props = new Array();
	this.rows = data.split("||");
	for( this.i in this.rows ){
		this.fields = this.rows[this.i].split("=");
		this.props[this.fields[0]] = this.fields[1];
	}
	return this.props;
}*/
function BanInsert(){}
function banbug(which){
	this.ban = bans.bans[which];
	alert(
		" \nbh=" +  this.ban.height
		+ " \nbph=" +  this.ban.pheight
		+ " \npch=" + document.getElementById("pad").clientHeight
		+ " \npoh=" + document.getElementById("pad").offsetHeight
		+ " \npich=" + document.getElementById("padim").clientHeight
		+ " \npioh=" + document.getElementById("padim").offsetHeight
		+ " \nbch=" + document.getElementById("banner").clientHeight
		+ " \nboh=" + document.getElementById("banner").offsetHeight
		+ " \nbich=" + document.getElementById("imbann").clientHeight
		+ " \nbioh=" + document.getElementById("imbann").offsetHeight
	);
}
function BanRender(){
	this.src = '';
	this.classes = "";
	this.ran = Math.floor(Math.random()*this.bans.length);
	if(this.bans.length>0){
		this.ban = this.bans[this.ran];
		if( this.ban.type == "image" ){
			this.ban.pheight = Math.floor((90-this.ban.height)/2) ;
			if(this.ban.pheight < 1 )
					this.ban.pheight = 0;
			if( this.ban.pheight >= 4  ){
				this.src += '<div id="pad"';	
				//this.src += ' onclick="banbug('+this.ran+')"';
				this.src += ' style="height:' + this.ban.pheight +'px" >';
				this.src += '<img id="padim" src="/images/blank.gif" ';	
				this.src += ' width="5" border="0" ';
				//this.src += ' height="' + this.ban.pheight  + '" /></div>';
				this.src += ' height="1" /></div>';
			}
			this.src += '<div id="banimage">';
			if(this.ban.url)
				this.src += '<a href="' + this.ban.url + '">'
			this.src += '<img id="imbann" border="0" src="';
			this.src += this.ban.img.src;
			if(this.ban.height)
				this.src += '" height="' + this.ban.height + '" ';
			else{
				this.src += '" height="60" ';
				this.classes += " norm";
			}	
			if(!this.ban.trans )
				this.classes += " bord";
			this.src += ' class="' + this.classes + '" />';	
			if(this.ban.url)
				this.src += '</a>';
			this.src+= '</div>';	
		} 
	}	
	return this.src;
}
function BanWrite(src){
	if(src)
		document.write(src);
	else
		document.write(this.src);
}
function Ban(){}

