﻿function DemosKarieraHideElement(img, id)
{
    if(document.getElementById(id).style.display == 'none')
    {
        document.getElementById(id).style.display = 'block';
        img.src = '../../cz/obrazky/kariera/expand.gif';
    }
    else
    {
        document.getElementById(id).style.display = 'none';
        img.src = '../../cz/obrazky/kariera/hide.gif';
    }
}
function DemosStazeniHideElement(img, id) {
    if (document.getElementById(id).style.display == 'none') 
    {
        document.getElementById(id).style.display = 'block';
        img.src = '../cz/obrazky/stazeni/expand2.png';
    }
    else 
    {
        document.getElementById(id).style.display = 'none';
        img.src = '../cz/obrazky/stazeni/click2.png';
    }
}

function ReKvados() {
    window.location.href = "http://www.demos24plus.com";
}

function pageLoad() {
	var menuWidth = $('.RadMenu_Demos').width();
	var aktualniPadding = (parseFloat($('.rmHorizontal > li > a.rmLink:eq(0)').css('padding-left')));
	var pocetPlozek = $('.rmHorizontal > li').length;
	var rozsirit = (Math.floor((menuWidth - $('.rmRootGroup').width()) / (pocetPlozek * 2)));
	var zbytek = menuWidth - $('.rmRootGroup').width() - (pocetPlozek * 2 * rozsirit);
	zbytek = zbytek - 1; // IE9
	$('.rmRootGroup').width(menuWidth);
	$('.rmHorizontal > li > a.rmLink > .rmText').each(function(index) {
	    if (zbytek > 0) {
	        $(this).css('padding-right', (aktualniPadding + rozsirit + 1).toString() + 'px');
	        zbytek = zbytek - 1;
	        if (zbytek > 0) {
	            $(this).css('padding-left', (rozsirit + 1).toString() + 'px');
	            zbytek = zbytek - 1;
	        }
	        else {
	            $(this).css('padding-left', rozsirit.toString() + 'px');
	        }
	    }
	    else {
            $(this).css('padding-left', rozsirit.toString() + 'px');
            $(this).css('padding-right', (aktualniPadding + rozsirit).toString() + 'px');
	    }
	});
	$('.rmLink').click(function() {
	    if ($(this).parent().children("div.rmSlide").length > 0 && !($(this).children("span").html()=="SLUŽBY")) {
	        return false;
	    }
	})

	$('.rmLink').parent().mouseout(function() {
	    $(this).oneTime(1000, "hide", function() {
	        $(this).children("a").removeClass("rmFocused");
	        if ($('.rmVertical a[href="' + location.href + '"]').length == 1) {
	            $('.rmVertical a[href="' + location.href + '"]').parent().parent().parent().parent().children('a').addClass("rmSelected");
	        }
	    })
	})
	
	if ($('.rmVertical a[href="' + location.href + '"]').length == 1) {
	    $('.rmVertical a[href="' + location.href + '"]').parent().parent().parent().parent().children('a').addClass("rmSelected");
	}

    // ke stažení - soubory
//	$(".Download tr th:nth-child(4)").hide();
	$(".Download tr th:nth-child(2), .Download tr th:nth-child(3), .Download td table").hide();
	$(".Download tr th:nth-child(1)").toggle(function() {
	    $(this).parent().parent().children("tr").children("td").children("table").show();
	    $(this).parent().children("th:eq(3)").hide();
	    $(this).parent().children("th:eq(1), th:eq(2)").show();
	}, function() {
	    $(this).parent().parent().children("tr").children("td").children("table").hide();
	    $(this).parent().children("th:eq(3)").show();
	    $(this).parent().children("th:eq(1), th:eq(2)").hide();
    });
    $(".Download a").click(function(event) {
	    event.stopPropagation();
	})
	$(".Download tr th:nth-child(1)").click(function() {
	    $(this).toggleClass("Up");
	})
	
	// videonávody
	$(".Videos table td").hide();
	$(".Videos th").toggle(function() {
	    $(this).parent().parent().find("td").show();
	}, function() {
	    $(this).parent().parent().find("td").hide();
	});
	$(".Videos a").click(function(event) {
	    event.stopPropagation();
	})
	$(".Videos th").click(function() {
	    $(this).toggleClass("Up");
	})
	$("a[rel^='prettyPhoto']").prettyPhoto();


}

function openRadWindow(data) {
    var oWnd = radopen("http://www.demos.cz/radwindow.aspx?url=" + data, "RadWindow1");
    oWnd.center();
}


function OnClientPageLoad(sender, args) {
    setTimeout(function() {
        sender.set_status("");
    }, 0);
} 
