var price1= [];
var price2= [];
var price3= [];
var array1 = [];
var kosik = new Array(0,0,0);
price1['CZK']=4990;
price2['CZK']=[2990,5990];
price3['CZK']=[2490,4490];
price1['USD']=249;
price2['USD']=[159,299];
price3['USD']=[129,229];
price1['EUR']=219;
price2['EUR']=[139,269];
price3['EUR']=[109,199];
//plugin bootstrap minus and plus
//http://jsfiddle.net/laelitenetwork/puJ6G/
$('.btn-numberwidth').click(function(e){
e.preventDefault();
fieldName = $(this).attr('data-field');
type = $(this).attr('data-type');
var input = $("input[name='"+fieldName+"']");
var currentVal = parseInt(input.val());
if (!isNaN(currentVal)) {
if(type == 'minus') {
if (currentVal==100) zmena=50;
else zmena=100 ;
if(currentVal > input.attr('min')) {
input.val(currentVal - zmena).change();
}
if(parseInt(input.val()) == input.attr('min')) {
$(this).attr('disabled', true);
}
} else if(type == 'plus') {
if (currentVal==50) zmena=50;
else zmena=100 ;
if(currentVal < input.attr('max')) {
input.val(currentVal + zmena).change();
}
if(parseInt(input.val()) == input.attr('max')) {
$(this).attr('disabled', true);
}
}
} else {
input.val(0);
}
});
$('.input-numberwidth').focusin(function(){
$(this).data('oldValue', $(this).val());
});
$('.input-numberwidth').change(function() {
minValue = parseInt($(this).attr('min'));
maxValue = parseInt($(this).attr('max'));
valueCurrent = parseInt($(this).val());
name = $(this).attr('name');
if(valueCurrent >= minValue) {
$(".btn-numberwidth[data-type='minus'][data-field='"+name+"']").removeAttr('disabled')
} else {
alert('Bylo překročeno minimum');
$(this).val($(this).data('oldValue'));
}
if(valueCurrent <= maxValue) {
$(".btn-numberwidth[data-type='plus'][data-field='"+name+"']").removeAttr('disabled')
} else {
alert('Bylo překročeno maximum');
$(this).val($(this).data('oldValue'));
}
valuelen = parseInt($('.input-numberlen').val());
valuewidth = parseInt($('.input-numberwidth').val());
pocet = parseInt($('.pocet1').val());
document.getElementById("price").innerHTML=parseInt(price1[mena]*valuewidth/100*valuelen/100);
document.getElementById("price_sum").innerHTML=pocet*parseInt((price1[mena]*valuewidth/100*valuelen/100));
});
$('.btn-numberwidth2').click(function(e){
e.preventDefault();
fieldName = $(this).attr('data-field');
type = $(this).attr('data-type');
var input = $("input[name='"+fieldName+"']");
var currentVal = parseInt(input.val());
if (!isNaN(currentVal)) {
if(type == 'minus') {
zmena=1 ;
if(currentVal > input.attr('min')) {
input.val(currentVal - zmena).change();
}
if(parseInt(input.val()) == input.attr('min')) {
$(this).attr('disabled', true);
}
} else if(type == 'plus') {
zmena=1 ;
if(currentVal < input.attr('max')) {
input.val(currentVal + zmena).change();
}
if(parseInt(input.val()) == input.attr('max')) {
$(this).attr('disabled', true);
}
}
} else {
input.val(0);
}
});
$('.input-numberwidth2').focusin(function(){
$(this).data('oldValue', $(this).val());
});
$('.input-numberwidth2').change(function() {
minValue = parseInt($(this).attr('min'));
maxValue = parseInt($(this).attr('max'));
valueCurrent = parseInt($(this).val());
name = $(this).attr('name');
if(valueCurrent >= minValue) {
$(".btn-numberwidth2[data-type='minus'][data-field='"+name+"']").removeAttr('disabled')
} else {
alert('Bylo překročeno minimum');
$(this).val($(this).data('oldValue'));
}
if(valueCurrent <= maxValue) {
$(".btn-numberwidth2[data-type='plus'][data-field='"+name+"']").removeAttr('disabled')
} else {
alert('Bylo překročeno maximum');
$(this).val($(this).data('oldValue'));
}
});
$('.btn-numberlen').click(function(e){
e.preventDefault();
fieldName = $(this).attr('data-field');
type = $(this).attr('data-type');
var input = $("input[name='"+fieldName+"']");
var currentVal = parseInt(input.val());
zmena=10;
if (!isNaN(currentVal)) {
if(type == 'minus') {
if(currentVal > input.attr('min')) {
input.val(currentVal - zmena).change();
}
if(parseInt(input.val()) == input.attr('min')) {
$(this).attr('disabled', true);
}
} else if(type == 'plus') {
if(currentVal < input.attr('max')) {
input.val(currentVal + zmena).change();
}
if(parseInt(input.val()) == input.attr('max')) {
$(this).attr('disabled', true);
}
}
} else {
input.val(0);
}
});
$('.input-numberlen').focusin(function(){
$(this).data('oldValue', $(this).val());
});
$('.input-numberlen').change(function() {
minValue = parseInt($(this).attr('min'));
maxValue = parseInt($(this).attr('max'));
valueCurrent = parseInt($(this).val());
name = $(this).attr('name');
if(valueCurrent >= minValue) {
$(".btn-numberlen[data-type='minus'][data-field='"+name+"']").removeAttr('disabled')
} else {
alert('Sorry, the minimum value was reached');
$(this).val($(this).data('oldValue'));
}
if(valueCurrent <= maxValue) {
$(".btn-numberlen[data-type='plus'][data-field='"+name+"']").removeAttr('disabled')
} else {
alert('Sorry, the maximum value was reached');
$(this).val($(this).data('oldValue'));
}
valuelen = parseInt($('.input-numberlen').val());
valuewidth = parseInt($('.input-numberwidth').val());
pocet = parseInt($('.pocet1').val());
document.getElementById("price").innerHTML=parseInt(price1[mena]*valuewidth/100*valuelen/100);
document.getElementById("price_sum").innerHTML=pocet*parseInt((price1[mena]*valuewidth/100*valuelen/100));
});
$('.pocet1').change(function() {
valuelen = parseInt($('.input-numberlen').val());
valuewidth = parseInt($('.input-numberwidth').val());
pocet = parseInt($('.pocet1').val());
document.getElementById("price").innerHTML=parseInt(price1[mena]*valuewidth/100*valuelen/100);
document.getElementById("price_sum").innerHTML=pocet*parseInt((price1[mena]*valuewidth/100*valuelen/100));
});
$('.pocet2').change(function() {
valuesize = parseInt($('.size1:checked').val());
if (valuesize==2) {price=price2[mena][1];
}
else
{price=price2[mena][0];
}
pocet = parseInt($('.pocet2').val());
document.getElementById("price2").innerHTML=parseInt(price);
document.getElementById("price_sum2").innerHTML=parseInt(pocet*price);
});
$('.pocet3').change(function() {
valuesize = parseInt($('.size2:checked').val());
if (valuesize==2) {price=price3[mena][1];
}
else
{price=price3[mena][0] ;
}
pocet = parseInt($('.pocet3').val());
document.getElementById("price3").innerHTML=parseInt(price);
document.getElementById("price_sum3").innerHTML=parseInt(pocet*price);
});
$('.obr').change(function() {
value1 = parseInt($('.vzor:checked').val());
value2 = parseInt($('.trasne:checked').val());
value3 = parseInt($('.size1:checked').val());
value4 = parseInt($('.vzor2:checked').val());
value5 = parseInt($('.size2:checked').val());
if (value1==1 && value2==1 )$("#koberec").attr("src","images/kob1.jpg");
if (value1==1 && value2==2 )$("#koberec").attr("src","images/kob3.jpg");
if (value1==2 && value2==1 )$("#koberec").attr("src","images/kob2.jpg");
if (value1==2 && value2==2 )$("#koberec").attr("src","images/kob4.jpg");
if (value3==1 && value4==1 )$("#polstar").attr("src","images/kob10.jpg");
if (value3==1 && value4==2 )$("#polstar").attr("src","images/kob11.jpg");
if (value3==2 && value4==1 )$("#polstar").attr("src","images/kob12.jpg");
if (value3==2 && value4==2 )$("#polstar").attr("src","images/kob13.jpg");
if (value5==1 )$("#podhlavnik").attr("src","images/kob20.jpg");
if (value5==2 )$("#podhlavnik").attr("src","images/kob21.jpg");
});
(function($,W,D)
{
var JQUERY4U = {};
JQUERY4U.UTIL =
{
setupFormValidation: function()
{
//form validation rules
$("#form1").validate({
rules: {
jmeno: "required",
email: {
required: true,
email: true
},
adress: "required",
city: "required",
zip: "required",
telefon: "required",
souhlas: "required",
payment: "required"
},
messages: {
jmeno: "Enter your name and surname/Company name",
telefon: "Enter your telephone number",
email: "Enter your e-mail",
adress: "Enter address",
city: "Enter your city",
zip: "Enter your postcode",
souhlas: "You must agree to the Terms & Conditions",
payment: "Choose the payment method
",
},
errorPlacement: function(error, element) {
if (element.attr("name") == "payment" ) {
error.insertAfter("#payment");
} else {
error.insertAfter(element);
}
},
submitHandler: function(form) {
$("#reservate").prop( "disabled", true );
form.submit();
}
});
}
}
//when the dom has loaded setup form validation rules
$(D).ready(function($) {
JQUERY4U.UTIL.setupFormValidation();
});
})(jQuery, window, document);
$(window).load(function(){
$("#zakaznik").sticky({ topSpacing: 0 });
idmain=0;
mena=$('.mena').val();
$( "" ).cena2();
$('.mena2').val(mena);
$('.mena').val(mena);
$( ).precenit();
sum=0;
});
$('.addtocart').click(function() {
valuelen = parseInt($('.input-numberlen').val());
valuewidth = parseInt($('.input-numberwidth').val());
price=document.getElementById("price").innerHTML=parseInt(price1[mena]*valuewidth/100*valuelen/100);
valuevzor = parseInt($('.vzor:checked').val());
valuetrasne = parseInt($('.trasne:checked').val());
pocet = parseInt($('.pocet1').val());
idmain++;
kosik[idmain] = new Array( [1,valuelen, valuewidth, price,valuevzor,valuetrasne,pocet,idmain]);
text='