﻿/////// Design boxů //////////
$(document).ready(function() {
    $(".box").each(function(i) {
        //$(this).bind ( "click",  function() { alert("Index: " + intIndex ); return false; });
        var nadpis = $(this).attr("title");
        $(this).children("img").before("<h4>" + nadpis + "</h4>");
        $(this).children("img").css("width", "128px");
        $(this).children("img").css("height", "128px");
    });

    $(".leftbox a").each(function(i) {
        //$(this).css("color","red");
		if(($(this).attr("rel")!=undefined)&&($(this).attr("rel")!='')) {
        	$(this).html($(this).html() + "<span class='adminlabel admininline'>[" + $(this).attr("rel") + "]</span>")
		}
    });

	/* img.menubox ??? */

    $("img.x").each(function(i) {
        //$(this).bind ( "click",  function() { alert("Index: " + intIndex ); return false; });
        var IDlink = $(this).attr("title");
        var selektor = "a[rel='" + IDlink + "']";
        //// odkaz
        var odkaz = $(selektor).attr("href");
        $(this).wrap(document.createElement("a"));
        $(this).parent().attr("class", "x");
        $(this).bind("click", function() { window.location = odkaz });
        $(this).parent().bind("mouseenter", function(e) { $(this).css("cursor", "hand"); });
        $(this).parent().bind("mouseleave", function(e) { $(this).css("cursor", "pointer"); });
        //// nadpis
        var nadpis = $(selektor).html();
        $(this).before("<h4>" + nadpis + "</h4>");
        $(this).css("width", "128px");
        $(this).css("height", "128px");
    });
});