// webhosting2
// Developed by Igor Mino <igor@platon.org>
// Copyright (c) 2011 Platon Technologies Ltd, http://platon.sk
// All rights reserved.

// prepne okienko v hornej casti stranky pre login alebo zistenie dostupnosti domeny
function switch_box(boxName) {
	switch (boxName) {
		case 'domain':
			$('#domain-box').removeClass('hide');
			$('#login-box').addClass('hide');
			$('#link-login').removeClass('arrow-link-background');
			$('#link-domain').addClass('arrow-link-background');
			break;
		case 'login':
		default:
			$('#login-box').removeClass('hide');
			$('#domain-box').addClass('hide');
			$('#link-domain').removeClass('arrow-link-background');
			$('#link-login').addClass('arrow-link-background');
			break;
	}
}

// okrem pozadia pod polozkou menu zmeni aj krajne oddelovace
function select_menu(index, count, selected) {
	var a, b;
	var menu_item_prefix = 'menu_item_';
	var menu_delimiter_prefix = 'menu_delimiter_';

	for (a = 1; a <= count; a++) {
		if (index == a
			|| selected == a)
		{
				if (a == 1) {
					document.getElementById(menu_item_prefix + a.toString()).className = 'menu-item-first-hover';
				} else {
					document.getElementById(menu_item_prefix + a.toString()).className = 'menu-item-hover';
				}
				if ((a+1 == index)
					|| (a+1) == selected)
    				{
					document.getElementById(menu_delimiter_prefix + a.toString()).className = 'menu-delimiter-hover';
				} else {
					document.getElementById(menu_delimiter_prefix + a.toString()).className = 'menu-delimiter-hover-right';
				}
			b = a - 1;
			if (b > 0) {
				if (b == index
					|| b == selected)
    				{
					document.getElementById(menu_delimiter_prefix + b.toString()).className = 'menu-delimiter-hover';
				} else {
					document.getElementById(menu_delimiter_prefix + b.toString()).className = 'menu-delimiter-hover-left';
				}
			}
		} else {
			if (a == 1) {
				document.getElementById(menu_item_prefix + a.toString()).className = 'menu-item-first';
			} else {
				document.getElementById(menu_item_prefix + a.toString()).className = 'menu-item';
			}
			document.getElementById(menu_delimiter_prefix + a.toString()).className = 'menu-delimiter';
		}
	}
}

// skryje okienko "Vedeli ste ze ..." a ulozi skrytie do cookies
function dyk_hide() {
	$('div.dyk-box').slideUp('slow', function() {
		// Animation complete.
		$('div.navigation-background').css('background-image', 'none');
		$('div.navigation-background').addClass('navigation-background-hide');
		$('div.navigation-background').removeClass('navigation-background');
		$('div.navigation-background-bottom').hide();
		$.cookie("did-you-know", "hide", { expires: 365 });
	});
}

// zobrazi okienko "Vedeli ste ze ..." a vymaze skrytie v cookies ak je skryte, inak vymeni obsah
function dyk_show() {
	if ($('div.navigation-background-hide').hasClass('navigation-background-hide')) {
		$('div.navigation-background-hide').attr('style', '');
		$('div.navigation-background-hide').addClass('navigation-background');
		$('div.navigation-background-hide').removeClass('navigation-background-hide');
		$('div.navigation-background-bottom').show();
		$.cookie("did-you-know", null);
		$('div.dyk-box').slideDown('slow', function() {
			// Animation complete.
		});
	} else {
		dyk_index++;
		if (dyk_index >= dyk_count) {
			dyk_index = 0;
		}
		$('.did-you-know-content').html(dyk_contents[dyk_index]);
	}
}

// skontroluje, ci su vyplnene potrebne udaje pre prihlasenie, v pripade chyby zobrazi hlasenie
function checkSetupLogin() {
	if ($('#setup_login').val().length == 0
		|| $('#setup_password').val().length == 0 )
	{
		if (ezin_lang == 'sk') {
			alert('Nie sú vyplnené prihlasovanie údaje !');
		} else {
			alert('Missing login information !');
		}
		return false;
	} else {
		return true;
	}
}

