$(document).ready(function() {


$("#podgrupesve").click(function() {
$("#podtextBox").toggle();
});

$("#brend").click(function() {
$("#brendhide").toggle();
});
$("#vendor").click(function() {
$("#vendorhide").toggle();
});

$("#grupesve").click(function() {
$("#textBox").toggle();
});

$("#pomocurl").click(function() {
$("#pomoscurldiv").toggle();
});

$("#pomocslika").click(function() {
$("#pomocslikadiv").toggle();
});

$("input.#uklonime1").click(function () {
   $.post("http://www.dodatnaoprema.com/pages/ukloni.php", {uporedime: $("#uporedime1").val() });
    $("#tabs1").hide('slow', function() {
      });							 
      $(this).hide(2000, function () {
        $(this).remove();
      });
    });
$("input.#uklonime2").click(function () {
	 $.post("http://www.dodatnaoprema.com/pages/ukloni.php", {uporedime: $("#uporedime2").val() });
	    $("#tabs2").hide('slow', function() {
      });							 
      $(this).hide(2000, function () {
        $(this).remove();
      });
    });
$("input.#uklonime3").click(function () {
 $.post("http://www.dodatnaoprema.com/pages/ukloni.php", {uporedime: $("#uporedime3").val() });
    $("#tabs3").hide('slow', function() {
      });							 
      $(this).hide(2000, function () {
        $(this).remove();
      });
    });
$("input.#uklonime4").click(function () {
 $.post("http://www.dodatnaoprema.com/pages/ukloni.php", {uporedime: $("#uporedime4").val() });
    $("#tabs4").hide('slow', function() {
      });							 
      $(this).hide(2000, function () {
        $(this).remove();
      });
    });
$("input.#uklonime5").click(function () {
  $.post("http://www.dodatnaoprema.com/pages/ukloni.php", {uporedime: $("#uporedime5").val() });
    $("#tabs5").hide('slow', function() {
      });							 
      $(this).hide(2000, function () {
        $(this).remove();
      });
    });

$("select#direkcija").change(function(){
	var vreme = new Date();								  
     $.getJSON("http://www.dodatnaoprema.com/pages/select.php"+'?ms='+ vreme.getTime(),{idd: $(this).val()}, function(j){
					var options = '';
					for (var i = 0; i < j.length; i++) {
						options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
					}
					$('#odeljenje').removeAttr('disabled');
					$("#odeljenje").html(options);
					$('#odeljenje option:first').attr('selected', 'selected');
				})
			})	


$("select#odeljenje").change(function(){
	var vreme = new Date();								  
     $.getJSON("http://www.dodatnaoprema.com/pages/selectspec.php?spec=jedan"+'&ms='+ vreme.getTime(),{idd: $(this).val()}, function(j){
					var options = '';
					for (var i = 0; i < j.length; i++) {
						options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
					}
					$('#spec1').removeAttr('disabled');
					$("#spec1").html(options);
					$('#spec1 option:first').attr('selected', 'selected');
				})
	  $.getJSON("http://www.dodatnaoprema.com/pages/selectspec.php?spec=dva"+'&ms='+ vreme.getTime(),{idd: $(this).val()}, function(j){
					var options = '';
					for (var i = 0; i < j.length; i++) {
						options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
					}
					$('#spec2').removeAttr('disabled');
					$("#spec2").html(options);
					$('#spec2 option:first').attr('selected', 'selected');
				})
	 
	  $.getJSON("http://www.dodatnaoprema.com/pages/selectspec.php?spec=tri"+'&ms='+ vreme.getTime(),{idd: $(this).val()}, function(j){
					var options = '';
					for (var i = 0; i < j.length; i++) {
						options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
					}
					$('#spec3').removeAttr('disabled');
					$("#spec3").html(options);
					$('#spec3 option:first').attr('selected', 'selected');
				})
	  $.getJSON("http://www.dodatnaoprema.com/pages/selectspec.php?spec=cet"+'&ms='+ vreme.getTime(),{idd: $(this).val()}, function(j){
					var options = '';
					for (var i = 0; i < j.length; i++) {
						options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
					}
					$('#spec4').removeAttr('disabled');
					$("#spec4").html(options);
					$('#spec4 option:first').attr('selected', 'selected');
				})
	  $.getJSON("http://www.dodatnaoprema.com/pages/selectspec.php?spec=pet"+'&ms='+ vreme.getTime(),{idd: $(this).val()}, function(j){
					var options = '';
					for (var i = 0; i < j.length; i++) {
						options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
					}
					$('#spec5').removeAttr('disabled');
					$("#spec5").html(options);
					$('#spec5 option:first').attr('selected', 'selected');
				})
	 
	 
	 
	 
			})

$("uhvati").change(function () {
          var str = "";
          $("select option:selected").each(function () {
                str += $(this).text() + " ";
              });
          $("div").text(str);
        })
        .trigger('change');	


// ovo je za hover
//$('a.alink').hover(function() {
 // $(this).addClass('alink');
//}, function() {
//  $(this).removeClass('alinkm');
//});

$('a.a_rss_menu').hover(function() {
  $(this).addClass('a_rss_menu');
}, function() {
  $(this).removeClass('alinkm');
});


$('a.aovde').hover(function() {
  $(this).addClass('aovdej');
}, function() {
  $(this).removeClass('aovde');
});

// accordion 2
//  $("div#content .photo") = get all element with class="photo" nested in the <div id="content">
// collapsible: true
 $('#accordion').accordion({ animated: 'bounceslide', active: false, navigation: true, autoHeight: false });
 
$("#tabs").tabs();
$("#tabsnovi").tabs();
$("#tabslog").tabs();

$("a.#kamion").click(function () {
      $("div.#kamion1").toggle("slide","slow");
    });

$("form.#signupForm input").css("border","1px solid #cdcdcd");
$("form.#login input").css("border","1px solid #cdcdcd");


$("a.#cancel").click(function(){
	  $(this).parents("div.#kamion1").animate({ opacity: "hide" }, 1500);
	}); // ovih 1500 je brzina hide

    lastBlock = $("#a1");
    maxWidth = 190;
    minWidth = 65;	
//  $("div#content .photo") = get all element with class="photo" nested in the <div id="content"> 
    $("a.aaa").hover(
      function(){
        $(lastBlock).animate({width: minWidth+"px"}, { queue:false, duration:400 });
	$(this).animate({width: maxWidth+"px"}, { queue:false, duration:400});
	lastBlock = this;
      }
    );
	
//$("a.fancy").fancybox();


// $("#myTable").tablesorter( {sortList: [[0,0], [1,0]]} ); 
// $("#myTable1").tablesorter( {sortList: [[0,0], [1,0]]} ); 
// $("#myTable2").tablesorter( {sortList: [[0,0], [1,0]]} ); 
});


