//JQUERY Settings

jQuery(document).ready(function(){
			
	//SLIDE SHOW
	//$(".head_banner_right").cycle({ 
   // fx:    'fade', 
   // speed:  2000,
  //  pause: 1 
//});

 $("a[rel^='prettyPhoto']").prettyPhoto({
        animationSpeed: 'normal', /* fast/slow/normal */
        padding: 40, /* padding for each side of the picture */
        opacity: 0.35, /* Value betwee 0 and 1 */
        showTitle: true, /* true/false */
        allowresize: true, /* true/false */
        counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
        theme: 'light_square', /* light_rounded / dark_rounded / light_square / dark_square */
        callback: function() { }
    });
    
     //TABOVI
	var vrijednostTaba;   
	
	jQuery(".paket_menu a").click( function() {
		jQuery("#tab1").css({ display: 'block' });
		jQuery('#tabovi a').removeClass("tab_selected").addClass("tab_normal");
		//jQuery(this).removeClass("tab_normal");
		//jQuery(this).toggleClass("tab_selected");
		vrijednostTaba = jQuery(this).attr('rel');
		jQuery('.paket_text_short').css({ display: 'none' });
		jQuery("#" + vrijednostTaba).css({ display: 'block' });
	});
	
    var vrijednostTaba2;   	
	jQuery("#tabovi a").click(function() {
		jQuery('#tabovi a').removeClass("tb_selected").addClass("tb_normal");
		jQuery(this).removeClass("tb_normal");
		jQuery(this).toggleClass("tb_selected");
		jQuery("#tab1").css({ display: 'block' });
		vrijednostTaba2 = jQuery(this).attr('rel');
		jQuery('.tabH').css({ display: 'none' });
		$.cookie("mTab",null);
		$.cookie("mTab",vrijednostTaba2);
		jQuery("#" + vrijednostTaba2).css({ display: 'block' });
	});
});


function postaviAktualanTab()
{    
    vrijednostTaba2 = $.cookie("mTab");
    
    if(vrijednostTaba2==null)
    {
        jQuery("#164").css({ display: 'block' }); 
        jQuery("#m164").toggleClass("tb_selected"); 
    }
    else
    {
        jQuery('#tabovi a').removeClass("tb_selected").addClass("tb_normal");
        jQuery("#m" + vrijednostTaba2).toggleClass("tb_selected");
        jQuery("#tab1").css({ display: 'block' });
        jQuery('.tabH').css({ display: 'none' });
        jQuery("#" + vrijednostTaba2).css({ display: 'block' });
     }
}
function Search(root) {
    var input = URLDecode(document.getElementById("_ctl0_tbTrazilica"));
    //alert("Trazili ste: " + input.value);
    var search = "ItemSearch.aspx?value=" + input.value;
    top.location.href = search; return false;
}

function SearchClear(defaultText) {
    var input = document.getElementById("_ctl0_tbTrazilica");
    //alert(input);
    if (input.value == defaultText)
        input.value = "";
    else
        if (input.value == "")
        input.value = defaultText;
}

function URLDecode(encodedString) {
    var output = encodedString;
    var binVal, thisString;
    var myregexp = /(%[^%]{2})/;
    while ((match = myregexp.exec(output)) != null
             && match.length > 1
             && match[1] != '') {
        binVal = parseInt(match[1].substr(1), 16);
        thisString = String.fromCharCode(binVal);
        output = output.replace(match[1], thisString);
    }
    return output;
}

