function subscribe(product_id){
  $('#subscrib_product').val(product_id);
  $('#subscription').fadeIn('fast');
  $('#subscription').css('top',$('#subscription_but').offset().top-10);
}
function calculater(){
  $('#price').val($('#priceforcalc').val());
  $('#calculate').fadeIn('fast');
  $('#calculate').css('top',$('#calculate_but').offset().top-100);

}
function calculate() {
    price = $('#price').val();
    interes = $('#interes').val();
    period = $('#period').val();
    first_pay = $('#first_pay').val();
	if (price == 0) {
		$('#error_state').html("The Price field can't be 0!");
		$('#error_state_dt').show();
		$('#error_state_dd').show();
		return;
	}
	else if (interes == 0 ) {
		$('#error_state').html("The Interest Rate field can't be 0!");
		$('#error_state_dt').show();
		$('#error_state_dd').show();
		return;
	}
	else if (period == 0) {
		$('#error_state').html("The Term field can't be 0!");
		$('#error_state_dt').show();
		$('#error_state_dd').show();
		return;
	}
	else{
		$('#error_state').html('');
		$('#error_state_dt').show();
		$('#error_state_dd').show();
	}
	princ = price - (price*first_pay/100);
	intRate = (interes/100) / 12;
	months = period * 12;
	ccc = Math.floor((princ*intRate)/(1-Math.pow(1+intRate,(-1*months)))*100)/100;
	$('#per_month').val(ccc);
	$('#overall').val(princ);
	$('#count').val(months);
}
$(function(){

		NFInit();

		$('#search-block').hide();
		$('#after-search').hide();
		$('#search-block-little-a').click(function(){
			$('#search-block-little').hide();
			$('#search-block').slideDown(400,function(){
				$('#after-search').show();
				NFFix();
			});

			return false;
		});

		$('#search-block-close').click(function(){
			$('#after-search').hide();
			$('#search-block').slideUp(400,function(){
				$('#search-block-little').show();
				NFFix();
			});
			return false;
		})



		//
		$("#tab-content").children().hide().eq(0).show();
		$('#tab-list li').click(function(){
			$(this).parent().children().removeClass('active');
			$(this).addClass('active');
			$("#tab-content").children().hide();
			$('#' + $(this).attr('rel')).show();
			return false;
		});

  img = new Image();
  img.src = '/tpl/en/i/ajax-loader.gif';


});

function exchange(path) {
  $('.images .main img').remove();
  $('.images .main').prepend('<img src="'+ path +'" id="tovar_big" width="600" height="400" border="0" />');
  $('.j-loader').removeClass('active-loader');
}

jQuery(document).ready(function() {

  jQuery('#mycarousel').jcarousel({
		visible:5
  });

    $('.jcarousel-clip-horizontal a').click( function (){
      $('.jcarousel-clip-horizontal a img').removeClass('prew_active');
      $(this).find('img').addClass('prew_active');
      $('.j-loader').addClass('active-loader');
      var href = $(this).attr('title');
      var LImg;
      $(LImg).unbind();
      LImg = new Image; LImg.src=href;
      if (LImg.complete) {
        exchange(href);
      } else {
        $(LImg).unbind().bind('load', function () {
          exchange(href);
        });
      }
    });

    $('#subscription form').submit( function () {
      $(this).find('dl').hide();
      $(this).find('#sucsess_subcribe').show();
    });

});

$(function () {
  $('.highslide').click(function(){
	return hs.expand(this);
  });
});

