var options = 11;
var rotateDelay = 4000; 	// ile czasu ma byc widoczny box


var txts = [];

txts[1] = [];
txts[2] = [];
txts[3] = [];
txts[4] = [];
txts[5] = [];
txts[6] = [];
txts[7] = [];
txts[8] = [];
txts[9] = [];
txts[10] = [];
txts[11] = [];

txts[1]['cont'] = '<p>STRONA GŁÓWNA</p>';
txts[2]['cont'] = '<p>IMPREZY INTEGRACYJNE</p>';
txts[3]['cont'] = '<p>KAŻDE WESELE JEST INNE <br> ZADBAMY O KAŻDY SZCZEGÓŁ</p>';
txts[4]['cont'] = '<p>DJ, WODZIREJ<br />PREZENTER, KONFERANSJER<br>NA KAŻDĄ IMPREZĘ</p>';
txts[5]['cont'] = '<p>PLENERY ŚLUBNE, REPORTAŻE<br>ALBUMY, DVD, HD</p>';
txts[6]['cont'] = '<p>NAWET NA 1000 OSÓB</p>';
txts[7]['cont'] = '<p>ANIMATORZY, GRY<br>ZABAWY, URZĄDZENIA</p>';
txts[8]['cont'] = '<p>IMPREZY MASOWE<br>FESTYNY, DOŻYNKI</p>';
txts[9]['cont'] = '<p>KARAOKE, POKAZ LASERÓW i FAJERWERKOW<br>URZĄDZENIA ROZRYWKOWE</p>';
txts[10]['cont'] = '<p>GALERIA</p>';
txts[11]['cont'] = '<p>KONTAKT</p>';

txts[1]['top'] = '20px'; //20
txts[2]['top'] = '20px'; //20
txts[3]['top'] = '20px'; //20
txts[4]['top'] = '250px'; 
txts[5]['top'] = '20px'; //20
txts[6]['top'] = '250px';
txts[7]['top'] = '250px';
txts[8]['top'] = '250px';
txts[9]['top'] = '250px';
txts[10]['top'] = '250px'; 
txts[11]['top'] = '250px';


var imgs = [];
imgs[1] = [];
imgs[2] = [];
imgs[3] = [];
imgs[4] = [];
imgs[5] = [];
imgs[6] = [];
imgs[7] = [];
imgs[8] = [];
imgs[9] = [];
imgs[10] = [];
imgs[11] = [];

imgs[1]['path'] = '/imgMenu/obrys.swf';
imgs[2]['path'] = '/imgMenu/quad.jpg';
imgs[3]['path'] = '/imgMenu/obrys.swf';
imgs[4]['path'] = '/imgMenu/dj.jpg';
imgs[5]['path'] = '/imgMenu/foto_video.jpg';
imgs[6]['path'] = '/imgMenu/bale.jpg';
imgs[7]['path'] = '/imgMenu/plenery.jpg';
imgs[8]['path'] = '/imgMenu/koncerty.jpg';
imgs[9]['path'] = '/imgMenu/dodatkowe.jpg';
imgs[10]['path'] = '/imgMenu/galeria.jpg';
imgs[11]['path'] = '/imgMenu/kontakt.jpg';

imgs[1]['type'] = 'swf';
imgs[2]['type'] = 'img';
imgs[3]['type'] = 'swf';
imgs[4]['type'] = 'img';
imgs[5]['type'] = 'img';
imgs[6]['type'] = 'img';
imgs[7]['type'] = 'img';
imgs[8]['type'] = 'img';
imgs[9]['type'] = 'img';
imgs[10]['type'] = 'img';
imgs[11]['type'] = 'img';

var source = [];

var timeoutID = [];
var actTab, nextTab, delay;

//var f1 = function rotate()

function rotate(tabId)
{
	if(tabId > options)
	{
		lastTab = options;
		tabId = 1;
	}
	else
	{
		if($('lastTab'))
		{
			var lastTab = $('lastTab').value;
		}
	}	
	
	$('textContent').set('html', '&nbsp;');
	
	if($('tab' + lastTab) && startId != lastTab)
	{
		$('tab' + lastTab).set('class', 'none');
		//$('tab' + lastTab).get('tween', {property: 'opacity', duration: 'long'}).start(1);
	}
	
	$('lastTab').set('value', tabId);
	
	if(startId != tabId)
	{
		$('tab' + tabId).set('class', 'act');
	}
	
	if(startId)
	{
		$('tab' + startId).set('class', 'selected');
	}
	
	timeoutID[4] = $('tab' + tabId).get('tween', {property: 'opacity', duration: 'long'}).start(0);

	
	switch(imgs[tabId]['type'])
	{
		case 'img':
			var str = "<img src = '"+ imgs[tabId]['path'] +"' />";
			break;
			
		case 'swf':
			var str = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="400" height="325" id="obrys" align="middle">';
				str += '<param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="false" />';
				str += '<param name="movie" value="'+ imgs[tabId]['path'] +'" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#393838" />	<embed src="'+ imgs[tabId]['path'] +'" quality="high" wmode="transparent" bgcolor="#393838" width="400" height="325" name="obrys" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />	</object>';
			break;			
	}

	$('menuMainContent').set('html', str);
	
	
	 
	timeoutID[11] = insertContent.delay(700,[], [tabId]);

	
	//$('tab' + actTab).fade('toggle');
	
	//$('tab' + tabId).tween('padding', [0, 80]);
	
	timeoutID[1] = showTab.delay(100,[], [tabId]);
	
	tabId++;
	
	$('tabId').set('value', tabId);
}

function insertContent(tabId)
{
	timeoutID[6] = $('textBox').setStyle('paddingTop', txts[tabId]['top']);
	timeoutID[5] = $('textContent').setStyle('marginRight', '-200px');
	
	timeoutID[3] = $('textContent').set('html', txts[tabId]['cont']);
	timeoutID[2] = $('textContent').tween('marginRight', [-130, 20]);
}

function tab(tabId)
{
	if($('lastTab'))
	{
		last = $('lastTab').value;
	
	
		if($('tab' + last))
		{
			$('tab' + last).set('class', 'none');
			$('tab' + last).get('tween', {property: 'opacity', duration: 'long'}).start(1);
		}
		
		$('lastTab').set('value', $('tabId').value)
		$('tabId').set('value', tabId);
	}
	
	
	$clear(timeoutID[0]);
	$clear(timeoutID[1]);
	$clear(timeoutID[2]);
	$clear(timeoutID[3]);
	$clear(timeoutID[4]);	
	$clear(timeoutID[5]);
	$clear(timeoutID[6]);
	$clear(timeoutID[11]);	
	rotate(tabId);
				
	//timeoutID[0] = makeRotate.periodical(rotateDelay);
}

function showTab(tabId)
{
	$('tab' + tabId).get('tween', {property: 'opacity', duration: 'long'}).start(1);
}

function createField(name, value)
{
	the_field = document.createElement('input');
	the_field.setAttribute('type', 'hidden');
	the_field.setAttribute('name', name);
	the_field.setAttribute('id', name);
	the_field.setAttribute('value', value);
	document.getElementById("menuBox").appendChild(the_field);
}


