$(document).ready(function() {

/*$(".intro-button").hover(function() {
		var id = $(this).attr('id');
		if($("#pic_"+id).length>0) {
			$(".mir-col-double img:visible").hide();
			$(".mir-col-double a:visible").hide();
			$("#pic_"+id).show();
			if ($("#a_"+id).length>0)			
				$("#a_"+id).show();
		}
	}, function() {

	});*/

	$('#PR_TYPE_S').live('change', function(){
			var type = $('#PR_TYPE_S').val();
			var name= $('#PR_INTERVAL_S').attr('name');
			var value = $('#PR_INTERVAL_S').val();
			if (type){
				//$(this).parent().html('<select disabled="disabled"><option>load...</option></select>');
				jsAjaxUtil.InsertDataToNode('/ajax/reminder.php?type='+type+'&name='+name+'&value='+value, 'PR_INTERVAL_S', true);
			}
		}
	);

  if ($('#feedback').length) {

	$("#feedback, #feedback1, #feedback2, #feedback_c").click(function() {

		window.open($(this).attr('href'), 'feedback', 'width=500,height=800,status=yes,resizable=yes,scrollbars=yes');
		return false;
	});
  }


	$.preloadImages("/img/tm-left-sub.png", "/img/tm-center-sub.png", "/img/tm-right-sub.png");
   $('.product-small-pics a').hover(function(){
      id=parseInt($(this).attr('id'));
      $(".block-rbs.product-pic img:visible").hide();
      $("#"+id+"big").show();
      return false;
   }, function() {

	});


	$("#top-menu ul li").hover(function() {
		var cur = $(this);
		if($(this).find("ul").length>0) {
			$(this).find("ul").slideDown(300);
			$(this).find("a").addClass("hover");
		}
	}, function() {
		$(this).find("ul").hide();
		$(this).find("a").removeClass("hover");
	});
	$("#top-menu ul>li:first-child").hover(function() {
		if($(this).find("ul").length>0) {
			$(this).find("ul").css("marign-left","0");
			$(this).parent().parent().find("div.lb-6").hide();
		}
	}, function() {
		$(this).parent().parent().find("div.lb-6").show();
	});

  $('ul.tabs').each(function() {
    $(this).find('li').each(function(i) {
      $(this).click(function(){
        $(this).addClass('current').siblings().removeClass('current')
          .parents('div.section').find('div.box').hide().end().find('div.box:eq('+i+')').show();
      });
    });
  });

    /*$('ul.news-tabs').each(function() {
    $(this).find('li').each(function(i) {
      $(this).click(function(){
        $(this).addClass('current').siblings().removeClass('current')
          .parents('div.news-section').find('div.news-box').hide().end().find('div.news-box:eq('+i+')').show();
      });
    });
  });*/

	$("div.product-block").hover(function() {
		$(this).find("div.pb-desc").show();
	}, function() {
		$(this).find("div.pb-desc").hide();
	});

		var params = {
        changedEl: "#langs",
        visRows: 2,
        scrollArrows: true,
		checkZIndex: true
    }
    cuSel(params);

	$(".cusel span").hover(function() {
		$(this).css("background","#0c7dd4").css("color","#fff");
	}, function() {
		$(this).css("background","#fff").css("color","#71767f");
	});


	$(".cusel span").live("click",function() {
		$(".cuselText").html($(this).html());
	});

	if($(".cusel span:eq(0)").hasClass("cuselActive")) {
		$(".cuselText").prepend("<img src='/img/lang-001.png' alt='' />");
	}
	if($(".cusel span:eq(1)").hasClass("cuselActive")) {
		$(".cuselText").prepend("<img src='/img/lang-002.png' alt='' />");
	}
	if($(".cusel span:eq(2)").hasClass("cuselActive")) {
		$(".cuselText").prepend("<img src='/img/lang-003.png' alt='' />");
	}
	if($(".cusel span:eq(3)").hasClass("cuselActive")) {
		$(".cuselText").prepend("<img src='/img/lang-004.png' alt='' />");
	}
	if($(".cusel span:eq(4)").hasClass("cuselActive")) {
		$(".cuselText").prepend("<img src='/img/lang-005.png' alt='' />");
	}
	$(".cusel span:eq(0)").prepend("<img src='/img/lang-001.png' alt='' />");
	$(".cusel span:eq(1)").prepend("<img src='/img/lang-002.png' alt='' />");
	$(".cusel span:eq(2)").prepend("<img src='/img/lang-003.png' alt='' />");
	$(".cusel span:eq(3)").prepend("<img src='/img/lang-004.png' alt='' />");
	$(".cusel span:eq(4)").prepend("<img src='/img/lang-005.png' alt='' />");

});

jQuery.preloadImages = function()
{
 for(var i = 0; i<arguments.length; i++)
 {
  jQuery("<img>").attr("src", arguments[i]);
 }
};
