/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

jQuery.noConflict();

function popup_porovnani(pocet,adr)
{
   /*jQuery.jGrowl('<br><span style="font-size:11pt;font-weight:bold;">Počet <a href="'+adr+'" target="_blank" style="color:white;">zboží k porovnání</a>: '+pocet+' ks</span>', {
       close: function(e,m) {
           document.forms['porov_form'].submit();
           //jQuery.unblockUI();
       },
       open: function(e,m) {
           //jQuery.blockUI();
       },
       //life:500,
       sticky:false,
       animateOpen: {
           height: 'show'
       }
   });*/

   jQuery(document).ready(function() {
    jQuery('#porov_form').click(function() {

       jQuery.jGrowl('<br><span style="font-size:11pt;font-weight:bold;">Přidáno do <a href="'+adr+'" target="_blank" style="color:white;">zboží k porovnání</a><!--: '+pocet+' ks--></span>', {
       close: function(e,m) {
           document.forms['porov_form'].submit();
       },
       open: function(e,m) {},
       life:3000,
       sticky:false,
       animateOpen: {
           height: 'show'
       }
       });

        jQuery.blockUI({
//            message: '<br><span style="font-size:11pt;font-weight:bold;">Počet <a href="'+adr+'" target="_blank" style="color:white;">zboží k porovnání</a>: '+pocet+' ks</span><br><br>',
            timeout: 3000,
//            css: {
//            width:'300px',
//            border: 'solid 5px white',
//            padding: '15px',
//            backgroundColor: '#800',
//            '-webkit-border-radius': '10px',
//            '-moz-border-radius': '10px',
//            opacity: 1,
//            color: '#fff'
//            },
            overlayCSS: { opacity: .3 }

        });
        //jQuery('.blockOverlay').attr('title','Klikněte pro odblokování').click(jQuery.unblockUI);
    });
   });
}

function popup_do_kosiku()
{
   jQuery(document).ready(function() {
    jQuery('#do_kosiku').click(function() {

       jQuery.jGrowl('<br><span style="font-size:11pt;font-weight:bold;">Položka se vkládá do košíku</span>', {
       close: function(e,m) {
           document.forms['do_kosiku'].submit();
       },
       open: function(e,m) {},
       life:2000,
       sticky:false,
       animateOpen: {
           height: 'show'
       }
       });

        jQuery.blockUI({
            timeout: 2000,
            overlayCSS: { opacity: .3 }
        });
        //jQuery('.blockOverlay').attr('title','Klikněte pro odblokování').click(jQuery.unblockUI);
    });
   });
}

jQuery(function() {
       jQuery( "#tabs" ).tabs();
       jQuery("#tabs").bind('tabsshow',function(event, ui) {
            var tagWithHashId = jQuery(ui.tab.hash);
            var hash = ui.tab.hash;
            hash = hash.replace("#", "");
            jQuery(tagWithHashId).attr('id', hash+'-tmp');
            window.location.hash = ui.tab.hash;
            jQuery(tagWithHashId).attr('id', hash);
        })
});

//jQuery(document).ready(function(){
//   var tabs = jQuery("#tabs").accessibleTabs({
//       tabhead:'h2',
//       fx:"fadeIn",
//       syncheights:true
//   });
//   jQuery("a[href=#podrucky]").click(function(e){ // make a link that points to #dummy-text open a tab
//       e.preventDefault(); // avoid the jumping of the page when clicking the anchor
//       tabs.showAccessibleTabSelector('#podrucky'); //pass selector (id is easiest) of the tab to show
//   });
//});

jQuery(document).ready(function(){
var tabs = jQuery("#tabs").tabs();
jQuery('.pokracuj_prisl').click(function() { // bind click event to link
window.location.hash="#tabs";
tabs.tabs('select', '#podrucky');
return false;
});
});


jQuery(document).ready(function(){

var tabs = jQuery("#tabs").tabs();

jQuery('.link_popis').click(function() { // bind click event to link
window.location.hash="#tabs";
tabs.tabs('select', '#popis');
return false;
});

jQuery('.link_tech').click(function() { // bind click event to link
window.location.hash="#tabs";
tabs.tabs('select', '#tech-par');
return false;
});

jQuery('.link_odstin').click(function() { // bind click event to link
window.location.hash="#tabs";
tabs.tabs('select', '#odstin');
return false;
});

jQuery('.link_podrucky').click(function() { // bind click event to link
window.location.hash="#tabs";
tabs.tabs('select', '#podrucky');
return false;
});

jQuery('.link_podobne').click(function() { // bind click event to link
window.location.hash="#tabs";
tabs.tabs('select', '#podobne');
return false;
});

jQuery('.link_doporuc').click(function() { // bind click event to link
window.location.hash="#tabs";
tabs.tabs('select', '#doporucit');
return false;
});

});



jQuery(function() {
       jQuery( "#tabs2" ).tabs();
});
jQuery(function() {
       jQuery( "#tabs-therapia" ).tabs();
});
jQuery(function() {
       jQuery( "#tabs-zidle" ).tabs();
});

//jQuery('#tabs').tabs({
//    select: function(event, ui) {
//        var url = jQuery.data(ui.tab, 'load.tabs');
//        if( url ) {
//            location.href = url;
//            return false;
//        }
//        return true;
//    }
//});

//jQuery(document).ready(function()
//{
//     var termTemplate = "<span class='ui-autocomplete-term'>%s</span>";
//     //Autocomplete
//     jQuery("#autocomplete").autocomplete(
//     {
//          //source:["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "pearl"],
//          source: "../zbozi_all.php",
//          //source: [{"value":"", "id":"1002246"},{"value":" ECO 3", "id":"134"},{"value":" H 0", "id":"2185"},{"value":"106", "id":"1357"},{"value":"106 CHROM", "id":"1682"},{"value":"106 CHROM sedak drevo", "id":"1703"},{"value":"106 ZLATA", "id":"1704"},{"value":"106 ZLATA sedak drevo", "id":"1705"},{"value":"1080 MEK jen v latce AMICRA 105", "id":"327"},{"value":"1080 MEK, AMICRA 105", "id":"3018"}] ,
//          dataType: "json",
//          minChars:2,
//          width:400,
//          matchContains:true,
//          highlight:true,
//          selectFirst:false,
//          select: function(event, ui)
//          {
//             window.location.href = "/hledej?term=" + ui.item.value;
//          },
//          open: function(e,ui) {
//            var
//                acData = jQuery(this).data('autocomplete'),
//                styledTerm = termTemplate.replace('%s', acData.term);
//
//            acData
//                .menu
//                .element
//                .find('a')
//                .each(function() {
//                  var me = jQuery(this);
//                  var regex = new RegExp(acData.term, "gi");
//                  me.html( me.text().replace(regex, function (matched) {
//                     return termTemplate.replace('%s', matched);
//                  }) );
//               });
//
//         }
//     });
//});

//jQuery.noConflict(); //  kvuli konfliktu motools a jquery ( potřeba nahradit všechny jQuery -> jQuery )
//jQuery(document).ready(function(){ gapi.plusone.render("medium", {"size": "medium", "count":"false"});});
