$(document).ready(function() {
$("#size").change(function () {
// 40 je atyp
if ( ($(this).val()== 40 )){
q = 1;
q2 = 1;
$("#price").effect("puff", 300, function(){
$("#price").show();
$("#total").html(number_format((price)*q*q2*discount*count, 0, '.', ' '));
});
if (dis>0){
$("#save").html(number_format((price)*q*q2*count, 0, '.', ' '));
}
$("#atyp").html('
Délka:
Šířka:
');
$("#width").spinner({
min: 170,
max:220,
stop: function( event, ui ) {
var tmp = parseInt(($(this).spinner("value")));
//koeficient rozmeru
if (tmp<=200){
q2 = 1;
}else if (tmp>200){
q2 = 1.1;
}else{
q2 = 1;
}
//alert(q);
$("#price").effect("puff", 300, function(){
$("#price").show();
$("#total").html(number_format((price)*q*q2*discount*count, 0, '.', ' '));
});
if (dis>0){
$("#save").html(number_format((price)*q*q2*count, 0, '.', ' '));
}
}
});
$("#height").spinner({
min: 70,
max:200,
stop: function( event, ui ) {
var tmp = parseInt(($(this).spinner("value")));
//koeficient rozmeru
if (tmp>90 && tmp < 101){
q = 1.2;
}else if (tmp>100 && tmp<121){
q = 1.4;
}else if (tmp>120 && tmp<141){
q = 1.6;
}else if (tmp>140 && tmp<161){
q = 1.8;
}else if (tmp>160 && tmp<181){
q = 2;
}else if(tmp>180){
q = 2.2;
}else{
q = 1;
}
//alert(q);
$("#price").effect("puff", 300, function(){
$("#price").show();
$("#total").html(number_format((price)*q*q2*discount*count, 0, '.', ' '));
});
if (dis>0){
$("#save").html(number_format((price)*q*q2*count, 0, '.', ' '));
}
}
});
}else{
$("#atyp").html("");
var sel = $("option:selected", this).html();
var tmp = sel.split("x");
tmp = parseInt(tmp[1]);
tmp2 = parseInt(tmp[0]);
//koeficient delky
if (tmp>90 && tmp < 101){
q = 1.2;
}else if (tmp>100 && tmp<121){
q = 1.4;
}else if (tmp>120 && tmp<141){
q = 1.6;
}else if (tmp>140 && tmp<161){
q = 1.8;
}else if (tmp>160 && tmp<181){
q = 2;
}else if(tmp>180){
q = 2.2;
}else{
q = 1;
}
//koeficient sirky
if (tmp2<=200){
q2 = 1;
}else if (tmp2>200){
q2 = 1.1;
}else{
q2 = 1;
}
$("#price").effect("puff", 300, function(){
$("#price").show();
$("#total").html(number_format((price)*q*q2*discount*count, 0, '.', ' '));
});
if (dis>0){
$("#save").html(number_format((price)*q*q2*count, 0, '.', ' '));
}
}
});
});