 var slider = {

	version:	"v1.0003",

	path:		{ own: "http://www.royalcasino.lv/splash/_slider/" },
	size: 		{ sl1:140, sl2:24, w:550 },

	layer:		false,
	timer:		false,
	y:		false,
	webs:		new Array(),
	current:	false,

	init:		function(id) {
				this.webs = [
						{t:	"Night Clubs",		s:[
							//{i:"larocca",		t:	"La Rocca",		u:	"info.larocca.lv",		c:"454545"},
							{i:"studio69",		t:	"Studio 69",		u:	"info.studio69.lv",		c:"435084"},
							{i:"redsquare",		t:	"Red Square",		u:	"info.redsquare.lv",		c:"000000"},
							{i:"rnbbar",		t:	"RnB Bar",		u:	"info.redsquare.lv",		c:"000000"},
							{i:"tuttifrutti",	t:	"Tutti Frutti",		u:	"info.tutti-frutti.lv",		c:"3e0b4e"}
						]},
						{t:	"Restaurants & Bars",	s:[
							{i:"lebouquet",		t:	"Le Bouquet",		u:	"info.lebouquet.lv",		c:"585858"},	// 5d5620
							{i:"cafebellagio",	t:	"Cafe Bellagio",	u:	"info.cafebellagio.lv",		c:"443028"},
							{i:"lobbybar",		t:	"Lobby Bar",		u:	"info.lobbybar.lv",		c:"585858"}	// 400001
						]},
						{t:	"Health Care",		s:[
							{i:"seasonspa",		t:	"Season SPA",		u:	"info.seasonspa.lv",		c:"585858"},
							{i:"globalfitness",	t:	"Global Fitness",	u:	"info.globalfitness.lv",	c:"000000"},
							{i:"ladance",		t:	"Dance School",		u:	"info.ladance.lv",		c:"376ca0"}
						]},
						{t:	"Entertainment",	s:[
							{i:"royalcasino",	t:	"Royal Casino",		u:	"info.royalcasino.lv",		c:"000000"},
							{i:"pokerclub",		t:	"Poker Club",		u:	"info.royalcasino.lv",			c:"000000"}
						]},
						{t:	"Other",		s:[
							{i:"cavalli",		t:	"Cavalli Boutique",	u:	"www.cavallifashion.lv",	c:"000000"},
							{i:"clubber",		t:	"Clubber.Lv",		u:	"www.clubber.lv",		c:"000000"},
							{i:"royalhotel",	t:	"Royal Hotel",		u:	"www.royalhotel.lv",		c:"000000"}
						]}
				];

				this.current = id;

				this.css();
				this.container();

				div = this.obj('slider');
				layer = this.obj('layer1');

				y = (-1 * this.size.sl1);
				layer.style.top = y + "px";
				layer.style.left = ((window.screen.width - this.size.w) / 2) + 'px';

				layer.style.display = "";
			},

	css:		function() {
				if(document.createStyleSheet) {
					document.createStyleSheet(this.path.own + 'styles_slider.css?' + Math.random());
				} else {
					var newSS=document.createElement('link');
					newSS.rel='stylesheet';
					newSS.type = 'text/css';
					newSS.href = this.path.own + 'styles_slider.css?' + Math.random();
					newSS.media = 'all';

					document.getElementsByTagName("head")[0].appendChild(newSS);
				}
			},

	container:	function() {
				_self = this;

				div = this.obj('slider');
				//div.style.display = "none";

				div1 = document.createElement("div");
				div1.className = "divLine";

				div.appendChild(div1);

				div2 = document.createElement("div");
				div2.id = 'layer1';
				div2.style.display = "none";
				div2.style.position = "absolute";
				div2.className = "divLayer";
				//div2.style.top = "-1500px";
				//div2.style.left = "-1500px";

				div2.onmouseout = function() { _self.up(); }
				div2.onmouseover = function() { _self.down(); }

				table = document.createElement("table");
				table.className = "sliderCF";
				table.style.height = this.size.sl1 + this.size.sl2 + 'px';
				tbody = document.createElement("tbody");
				tr1 = document.createElement("tr");
				tr1.className = "sliderCG";
				tr1.style.height = this.size.sl1 + "px";

				for (var q=0; q<this.webs.length; q++) {
					td1 = document.createElement("td");
					td1.className = "sliderCC";

					div33 = document.createElement("div");
					div33.className = "sliderCT";
					div33.innerHTML = this.webs[q].t;

					td1.appendChild(div33);

					for (var q1=0; q1<this.webs[q].s.length; q1++) {
						if (this.current == this.webs[q].s[q1].i) div1.style.background = "#" + this.webs[q].s[q1].c;

						div33 = document.createElement("div");
						div33.className = "sliderC";
						div33.innerHTML = '<a href="http://'+ this.webs[q].s[q1].u +'/">' + this.webs[q].s[q1].t + '</a>';
						td1.appendChild(div33);
					}

					tr1.appendChild(td1);
				}

				tr2 = document.createElement("tr");
				tr2.style.height = this.size.sl2 + "px";
				td2 = document.createElement("td");
				td2.className = "sliderCB";
				td2.colSpan = this.webs.length;
				td2.style.background = "url(" + this.path.own + "images/" + this.current + ".gif?" + Math.random() + ") top left no-repeat";

				tr2.appendChild(td2);

				tbody.appendChild(tr1);
				tbody.appendChild(tr2);

				table.appendChild(tbody);

				div2.appendChild(table);

				div.appendChild(div2);

				//this.size.w = table.offsetWidth;
			},

	up:		function() {
				if (y > (-1 * this.size.sl1)) {
					y = y - 5;
					layer.style.top = y + "px";
					this.TimeoutUpDown(1, 2);
				} else {
					layer.style.top = (-1 * this.size.sl1) + 'px';
				}
			},

	down:		function() {
				if (y < 0) {
					y = y + 5;
					layer.style.top = y + "px";
					this.TimeoutUpDown(1, 1);
				} else {
					layer.style.top = '0px';
				}
			},

	TimeoutUpDown:	function (ms, d) {
        			var _self = this;
				clearTimeout(_self.timer);
        			_self.timer = setTimeout(function(ms){
            				if (d==1) _self.down();
            				if (d==2) _self.up();
            			}, ms);
			},

	obj:		function (id) {
				return document.getElementById(id);
			}
 }