function newmajortile_gallery (divID)
{
	this.containerdiv = divID;
	
	/*this.imgID = imageId;
	this.delay = 3000,
	this.imagearray = new Array();
	this.imageindex = null;
	
	var timer = null;
	*/
	//this.addimage = addimage;
	this.start = start;
	this.init = init;
	this.addbg = addbg;
	this.addset = addset;
	this.redraw = redraw;
	
	function init(delay , effect, effecttimer, randomonload, width)
	{
	 	//initialize
		this.delay = delay;
		this.effecttimer = effecttimer;
		this.effect = effect;
		this.imagearray = new Array();
		this.bgarray = new Array();
		this.titlearray = new Array();
		this.textarray = new Array();
		this.linkarray = new Array();
		
		this.bgIndex = 0;
		this.tileIndex = 0;
		$(this.containerdiv).style.width = width + 'px';
	}

	function addbg(bgimg)
	{
		this.bgarray.push(bgimg);
	}
	
	function addset(img, title, text, alink)
	{
		this.imagearray.push(img);
		this.titlearray.push(title);
		this.textarray.push(text);
		this.linkarray.push(alink);
	}

	/*
	function addimage(imageurl)
	{
		//this.imagearray.push(imageurl);
	}*/
	
	
	function redraw()
	{
		var container = document.createElement('div');
		container.className = 'tilecontainer';
		container.style.backgroundColor = this.bgcolor;
		container.style.backgroundImage = 'url('+this.bgarray[this.bgIndex]+')';
		container.setAttribute('title', this.linkarray[this.tileIndex]);
		container.onclick = function (e)
			{
				if (!e) var e = window.event;
				var url = this.getAttribute('title');
				location.href = url;
			}		
			if (container.captureEvents)container.captureEvents(Event.ONCLICK);

		var title = document.createElement('div');
		title.innerHTML = this.titlearray[this.tileIndex];
		title.className = 'tile_header';
		
		var info = document.createElement('div');
		info.className = 'info_wrapper';
		
		var text = document.createElement('div');
		text.innerHTML = this.textarray[this.tileIndex];
		text.className = 'tile_text';
		
		var img = document.createElement('img');
		img.src = this.imagearray[this.tileIndex];
		img.className = 'tile_image';
		
		container.appendChild(img);
		
		info.appendChild(title);
		info.appendChild(text);
		
		container.appendChild(info);

		$(this.containerdiv).appendChild(container);
	
	}
	
	function start()
	{	
		if(this.titlearray.length >1)
		{
			var _self = this;
			$(_self.containerdiv).innerHTML = '';

			_self.redraw();
			if(_self.tileIndex < _self.titlearray.length-1)
			{
				_self.tileIndex = _self.tileIndex+ 1;
			}
			else
			{
				_self.tileIndex = 0;
			}
			if(_self.bgIndex < _self.bgarray.length-1)
			{
				
				_self.bgIndex = _self.bgIndex + 1;
			}
			else
			{
				_self.bgIndex = 0;
			}
			timer = setTimeout(function (ms) { _self.start(); }, _self.delay );
		}
		else
		{
			$(this.containerdiv).innerHTML = '';
			this.redraw();
		}
		
	}
}