/*custom javascript codes for semerad.sk */

window.addEvent('domready', function(){
	setMenu();
	setButtons(1);
	//setTabIndex();
});

//window resize
window.addEvent('resize', function(){
	$clear(timer);
	var timer = (function(){
		setMenu();
		setButtons(0);
	}).delay(50);
});


function show_button(elm) {
	//document.id(elm).tween('opacity', '1');
	$$('.'+elm).each(function(item) {
		item.tween('opacity', '1');
	});
}

function hide_button(elm) {
	//document.id(elm).tween('opacity', '0');
	$$('.'+elm).each(function(item) {
		item.tween('opacity', '0');
	});
}

function setMenu() {
	var size = document.getSize();
		
	if (size.x < 1050) {
		document.id('rheader').setStyles({
			left: 0,
			margin: 0
		});
	}
	else {
		document.id('rheader').setStyles({
			left: '50%',
			margin: '0 0 0 -525px'
		});
	}
}

function setButtons(load) {
	var size = document.getSize();
	
	if (load==1 && Browser.opera) {
	
		$$('.network_small, .webdesign_small, .kontakt_small').each(function(item) {
			item.setStyles({
				left: '50%',
				margin: '0 0 0 100px'
			});
		});
	}
		
	if (size.x < 1050) {
		$$('.network_small, .webdesign_small, .kontakt_small').each(function(item) {
			item.setStyles({
				left: 0,
				margin: '0 0 0 669px'
			});
		});
	}
	else {
		$$('.network_small, .webdesign_small, .kontakt_small').each(function(item) {
			(function(){
				item.setStyles({
				left: '50%',
				margin: '0 0 0 311px'
				});
			}).delay(10);
			
		});
	}
}


//set tabindex in IE
function setTabIndex() {
	$$('a').each(function(item, index) {
		item.set('tabindex',index+1);
	});
}
