

function restoreDefault(fld,defaultValue){
	if(fld.value=="") fld.value=defaultValue;
}
function clearDefault(fld,defaultValue){
	if(fld.value==defaultValue) fld.value="";
}
	function lookup(inputString) {
		if(inputString.length == 0) {
			// Hide the suggestion box.
			$('#suggestions').hide();
		} else {
			$.post("/Pages/autocomplete.php", {queryString: ""+inputString+""}, function(data){
				if(data.length >0) {
					$('#suggestions').show();
					$('#autoSuggestionsList').html(data);
				}
			});
		}
	} // lookup
	
	function fill(thisValue) {
		$('#hledam2').val(thisValue);
		setTimeout("$('#suggestions').hide();", 200);
	}
	function fake_load() {
  var cur_value = 1;
  var progress;
  // Make a loader.
  var loader = $.pnotify({
 pnotify_title: "Zboží bylo přidáno do košíku.",
 pnotify_text: "<div class=\"progress_bar\" />",
 pnotify_notice_icon: 'picon picon_16x16_throbber',
 pnotify_hide: false,
 pnotify_closer: false,
 pnotify_history: false,
 pnotify_before_open: function(pnotify){
 progress = pnotify.find("div.progress_bar");
 progress.progressbar({value: cur_value});
 // Pretend to do something.
 var timer = setInterval(function(){
 if (cur_value >= 100) {
 // Remove the interval.
 window.clearInterval(timer);
 loader.pnotify_remove();
 return;
 }
 //cur_value += Math.ceil(3 * ((100 - cur_value) / 100));
 cur_value += 1.6;
 progress.progressbar('option', 'value', cur_value);
 }, 2);
 }
 });
 }

jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;                                                                        
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
function ukaz(id) {

$('ul[id^=rulesmenu]').hide();
$('#vyrobciseznam').hide();

$('.rulesm'+id).slideToggle(400);
}
		$(document).ready(function() {
            window.fbAsyncInit = function() {
                FB.init({appId: '110496778974078', status: true, cookie: true, xfbml: true});

                /* All the events registered */
                FB.Event.subscribe('auth.login', function(response) {
                    // do something with response
                    login();
                });
                FB.Event.subscribe('auth.logout', function(response) {
                    // do something with response
                    logout();
                });
            };
            (function() {
                var e = document.createElement('script');
                e.type = 'text/javascript';
                e.src = document.location.protocol +
                    '//connect.facebook.net/cs_CZ/all.js';
                e.async = true;
                document.getElementById('fb-root').appendChild(e);
            }());

            function login(){
                document.location.href = "/";
            }
            function logout(){
                document.location.href = "/";
            }
		
		
      var $fbrec = '<fb:recommendations site="www.nase-miminko.cz" width="179" height="500"></fb:recommendations>';
      var $fblike = '<fb:like href="www.nase-miminko.cz" width="540"></fb:like>';
      var $fblogin = '<fb:login-button autologoutlink="true" perms="email,user_birthday,status_update,publish_stream"></fb:login-button>'; 		
      $($fbrec).appendTo('#fbp');  
      $($fblike).appendTo('#fblike');  
      $($fblogin).appendTo('#loginfb');  
		
/*		
    $("img").lazyload({ 
    effect : "fadeIn",
    threshold : 0,
    failurelimit : 10
 
});
*/
      $('.seznam1').hide(); 
      $('.seznam2').hide(); 
      $('.seznam3').hide(); 
      $('.seznam4').hide() ; 
      $('.seznam5').hide(); 
	var options = {
	    zoomWidth: 300,
	    zoomHeight: 253,
            xOffset: 10,
            yOffset: 0,
            position: "right" //and MORE OPTIONS
};
	$('.jqzoom').jqzoom(options);
  $('div[id^=rules]').hide();
  $('div[class^=ruleskat]').hide();
  $('div[class^=podruleskat]').hide();
/*  
$('a').click(function (event) {      event.preventDefault();
	var $this = $(this);
	var x = $this.attr("href");
	$('div#stred_sloupec').html("sdas");
	
});
*/
$('.nahleds').click(function() {
	var $this = $(this);
  var src = $this.attr("title");
  var alt = $this.attr("alt");

		$.ajax({  
		type: "POST",  
		url: "http://www.nase-miminko.cz/Pages/refreshimg.php",  
		data: { nsrc: src, nalt: alt},  
		success: function(theResponse) {
		
        $("#vymena").html(theResponse);
      	var options = {
      	    zoomWidth: 300,
      	    zoomHeight: 253,
                  xOffset: 10,
                  yOffset: 0,
                  position: "right" //and MORE OPTIONS
        };
        
      	$('.jqzoom').jqzoom(options);	
//-----------------------------

//-----------------------------        		
			}
		});  
		
});

$('.rozmer').change(function() {
	var $this = $(this);
//  var x = $this.attr("id");
  var x = $this.attr("name");
  var idcislo=x.substring(1);
  var value = $this.attr("value");
//var value = document.getElementById(x).value;
  var cenaid = "c"+idcislo;
  var kosid = "#kos_"+idcislo;
  var linkid = "#pr_"+idcislo;
  //var valc = $(kosid).attr("name");
  
  //alert (cenaid);
  //alert (valc);
  var re2=/;/; 
  var result2=value.split(re2); 
  document.getElementById(cenaid).innerHTML=""+result2[0]+" Kč";
  var str=result2[0]+";"+result2[1]+";"+result2[0];
  $(linkid).attr("href", "php/functions.php?action=addToBasket&amp;productID="+result2[1])
  .attr("name",result2[1]);
  $(kosid).attr("name",str)
	return false;
});
$('.rozmerp').change(function() {
	var $this = $(this);
  var x = $this.attr("name");
  var idcislo=x.substring(1);
  var value = $this.attr("value");
  var cenaid = "ac"+idcislo;
  var kosid = "#kkos_"+idcislo;
  var linkid = "#ppr_"+idcislo;
  //var valc = $(kosid).attr("name");
  
  //alert (cenaid);
  //alert (valc);
  var re2=/;/; 
  var result2=value.split(re2); 
  document.getElementById(cenaid).innerHTML=""+result2[0]+" Kč";
  var str=result2[0]+";"+result2[1]+";"+result2[0];
  $(linkid).attr("href", "php/functions.php?action=addToBasket&amp;productID="+result2[1])
  .attr("name",result2[1]);
  $(kosid).attr("name",str)
	return false;
});
$('.dfiltr').change(function() {
	var $this = $(this);
  var x = $this.attr("id");
  var idcislo=x.substring(1);
  var value = document.getElementById('d_filtr').value;
  var cenaid = "c"+idcislo;
  var linkid = "#pr_"+idcislo;
  var stranka = ""+document.location+"";
  var re1=/[ /]+/; 
  var result1=stranka.split(re1); 
  //for(var i=0;result1[i];i++) alert("["+i+"]: "+result1[i]);    
//  alert (parseInt(stranka));
  var re2=/[-]+/; 
  var result2=result1[2].split(re2);
  var kolik = result2.length;
  kolik=kolik-1; 
  var kateg=result2[kolik];
  var znacka = document.getElementById('d_vyrobce').value;
  var material = document.getElementById('d_material').value;
  var barva = document.getElementById('d_barva').value;
  var rozmer = document.getElementById('d_rozmer').value;
  var value2="";
  var value3="";
  var value4="";
  if (znacka) value2=value2+'AND t1.Pozn3="'+znacka+'"';
  if (material) value2=value2+'AND t1.Pozn1="'+material+'"';
  if (barva) value3=value3+'AND t1.Barva="'+barva+'"';
  if (rozmer) {
    value3=value3+'AND Rozmer="'+rozmer+'"';
    value4=value4+'AND Rozmer="'+rozmer+'"';
  }
  
		$.ajax({  
		type: "POST",  
		url: "http://www.design-market.cz/Pages/refresh.php",  
		data: { order: value, where1: value2,where2: value3,where3: value4, kategorie: kateg},  
		success: function(theResponse) {
		
        $("#soupisproduktu").html(theResponse);
			
			}
		});  
	return false;
});

$('.rozmer2').change(function() {
	var $this = $(this);
  var x = $this.attr("name");
  var idcislo=x.substring(1);
  var value = $this.attr("value");
  var cenaid = "c"+idcislo;
  var kosid = "#kos_det";
  var linkid = "#pr_"+idcislo;
  
  //alert (cenaid);
  //alert (value);
  var re2=/;/; 
  var result2=value.split(re2); 
  var str=value;
  $(kosid).attr("name",str)

  $(linkid).attr("href", "php/functions.php?action=addToBasket&amp;productID="+value)
  .attr("name",value);
	return false;
});


$('div[id^=detd]').click(function() {
	var $this = $(this);
	var x = $this.attr("id");
	$('#rules' + x).slideToggle(400);
	if( $this.is('.pruh3') ) {
              $(this).addClass('pruh2');
              $(this).removeClass('pruh3');
	} else {
              $(this).addClass('pruh3');
              $(this).removeClass('pruh2');

	}
	return false;
});

 
		var COOKIE_NAME = 'zobrazeni';
		var COOKIE_NAME2 = 'zobrazenidva';
		var options = { path: '/', expires: 10 };
      $('#avyrobci').click(function() {
                    $.cookie(COOKIE_NAME2, 'vyrobci', options);
                    $.cookie(COOKIE_NAME, null);
                    
                    $('ul[id^=rulesmenu]').hide();
                    $('#vyrobciseznam').show('slow');
                    
                    return false;
                });
		


		$("table.produkt")
			.tablesorter({widthFixed: false})
		.tablesorterPager({container: $("#pagerTable"),
    afterPagingCallBack: function() {
            	$(".dokoselink").click(function() {
            	  // alert("a");
            	  fake_load();
            		var productIDValSplitter 	= (this.id).split("_");
            		var productIDVal 			= productIDValSplitter[1];
            		var productIDVal2 			= (this.name)	;
            		var productX 		= $("#productImageWrapID_" + productIDVal).offset().left;
            		var productY 		= $("#productImageWrapID_" + productIDVal).offset().top;
            		var kolik=document.getElementById('kos_'+productIDValSplitter[1]).value;
            		
            		if( $("#productID_" + productIDVal).length > 0){
            			var basketX 		= $("#productID_" + productIDVal).offset().left;
            			var basketY 		= $("#productID_" + productIDVal).offset().top;			
            		} else {
            			var basketX 		= $("#basketTitleWrap").offset().left;
            			var basketY 		= $("#basketTitleWrap").offset().top;
            		}
            		
            		var gotoX 			= basketX - productX;
            		var gotoY 			= basketY - productY;
            		
            		var newImageWidth 	= $("#productImageWrapID_" + productIDVal).width() / 3;
            		var newImageHeight	= $("#productImageWrapID_" + productIDVal).height() / 3;
            
            		$("#productImageWrapID_" + productIDVal + " img")
            		.clone()
            		.prependTo("#productImageWrapID_" + productIDVal)
            		.css({'position' : 'absolute'})
            		.animate({opacity: 0.4}, 100 )
            		.animate({opacity: 0.1, marginLeft: gotoX, marginTop: gotoY, width: newImageWidth, height: newImageHeight}, 1200, function() {
            																																																																										  			$(this).remove();
            	
            			$("#notificationsLoader").html('<img src="/images/loader.gif">');
            		
            			$.ajax({  
            				type: "POST",  
            				url: "http://www.nase-miminko.cz/php/functions.php",  
            				data: { productID: productIDVal2,productCnt: kolik, action: "addToBasket"},  
            				success: function(theResponse) {
            					
            					if( $("#productID_" + productIDVal2).length > 0){
            						$("#productID_" + productIDVal2).animate({ opacity: 0 }, 500)
            						.before(theResponse).remove()
            						.animate({ opacity: 0 }, 500)
            						.animate({ opacity: 1 }, 500);
            						$("#notificationsLoader").empty();
            						
            					} else {
            						$("#basketItemsWrap tr:first").before(theResponse)
            						.hide()
            						.show("slow");  
            						$("#notificationsLoader").empty();			
            					}
                			$.ajax({  
                				type: "POST",  
                				url: "http://www.nase-miminko.cz/php/functions.php",  
                				data: {action: "getSumBasket"},  
                				success: function(theResponse) {
                						$("#sumkos").empty()
                						.html(theResponse);
                      			$.ajax({  
                      				type: "POST",  
                      				url: "http://www.nase-miminko.cz/php/functions.php",  
                      				data: {action: "getDoprava"},  
                      				success: function(theResponse2) {
                      						$(".dopravagratis").empty()
                        					.animate({ 
                                      opacity: 0.2}, "slow")  
                        					.html(theResponse2)
                        					.animate({ 
                                      opacity: 1}, "slow");  
                      				}  
                      			});  
                				}  
                			});  
            				}  
            			});  
            		
            		});
            		
            	});
                    }
                    });
    
       
		$("#scroller").simplyScroll({
			speed: 5
		});
			
//----------------------kosik
$("#basketItemsWrap tr:first").hide();

$("#basketItemsWrap td img.add").live("click", function(event) {
		var productIDValSplitter 	= (this.id).split("_");
		var productIDVal 			= productIDValSplitter[1];
		
		
			$.ajax({  
				type: "POST",  
				url: "http://www.nase-miminko.cz/php/functions.php",  
				data: { productID: productIDVal,productCnt: 1, action: "addToBasket"},  
				success: function(theResponse) {
					
					if( $("#productID_" + productIDVal).length > 0){
						$("#productID_" + productIDVal).animate({ opacity: 0 }, 500)
						.before(theResponse).remove()
						.animate({ opacity: 0 }, 500)
						.animate({ opacity: 1 }, 500);
						$("#notificationsLoader").empty();
						
					} else {
						$("#basketItemsWrap tr:first").before(theResponse)
						.hide()
						.show("slow");  
						$("#notificationsLoader").empty();			
					}
      			$.ajax({  
      				type: "POST",  
      				url: "http://www.nase-miminko.cz/php/functions.php",  
      				data: {action: "getSumBasket"},  
      				success: function(theResponse3) {
      						$("#sumkos").empty()
         					.show()
      						.html(theResponse3);
            			$.ajax({  
            				type: "POST",  
            				url: "http://www.nase-miminko.cz/php/functions.php",  
            				data: {action: "getDoprava"},  
            				success: function(theResponse2) {
            						$(".dopravagratis").empty()
            						.animate({ 
                          opacity: 0.2}, "slow")  
            						.html(theResponse2)
            						.animate({ 
                          opacity: 1}, "slow");  
            						
            						
            
            						
            					
            				}  
            			});  
      
      						
      					
      				}  
      			});  
					
				}  
			});  
		
		});
$("#basketItemsWrap td img.min").live("click", function(event) {
		var productIDValSplitter 	= (this.id).split("_");
		var productIDVal 			= productIDValSplitter[1];
		
		
			$.ajax({  
				type: "POST",  
				url: "http://www.nase-miminko.cz/php/functions.php",  
				data: { productID: productIDVal, action: "delFromBasket"},  
				success: function(theResponse) {
					
					if( $("#productID_" + productIDVal).length > 0){
						$("#productID_" + productIDVal).animate({ opacity: 0 }, 500)
						.before(theResponse).remove()
						.animate({ opacity: 0 }, 500)
						.animate({ opacity: 1 }, 500);
						$("#notificationsLoader").empty();
						
					} else {
						$("#basketItemsWrap tr:first").before(theResponse)
						.hide()
						.show("slow");  
						$("#notificationsLoader").empty();			
					}
					
				}  
			});
			$.ajax({  
				type: "POST",  
				url: "http://www.nase-miminko.cz/php/functions.php",  
				data: {action: "getSumBasket"},  
				success: function(theResponse) {
						$("#sumkos").empty()
						.html(theResponse);
      			$.ajax({  
      				type: "POST",  
      				url: "http://www.nase-miminko.cz/php/functions.php",  
      				data: {action: "getDoprava"},  
      				success: function(theResponse2) {
      						$(".dopravagratis").empty()
            			.animate({ 
                          opacity: 0.2}, "slow")  
            			.html(theResponse2)
            			.animate({ 
                          opacity: 1}, "slow");  
      
      						
      					
      				}  
      			});  

						
					
				}  
			});  
			
		
		});

	$(".dokoselink2").click(function() {
	  fake_load();
		var productIDValSplitter 	= (this.id).split("_");
		var productIDVal 			= productIDValSplitter[1];
		var productIDVal2 			= (this.name)	;
		var productX 		= $("#pproductImageWrapID_" + productIDVal).offset().left;
		var productY 		= $("#pproductImageWrapID_" + productIDVal).offset().top;
		var kolik=document.getElementById('kkos_'+productIDValSplitter[1]).value;
	
		if( $("#productID_" + productIDVal).length > 0){
			var basketX 		= $("#pproductID_" + productIDVal).offset().left;
			var basketY 		= $("#pproductID_" + productIDVal).offset().top;			
		} else {
			var basketX 		= $("#basketTitleWrap").offset().left;
			var basketY 		= $("#basketTitleWrap").offset().top;
		}
		
		var gotoX 			= basketX - productX;
		var gotoY 			= basketY - productY;
		
		var newImageWidth 	= $("#pproductImageWrapID_" + productIDVal).width() / 3;
		var newImageHeight	= $("#pproductImageWrapID_" + productIDVal).height() / 3;

		$("#pproductImageWrapID_" + productIDVal + " img")
		.clone()
		.prependTo("#pproductImageWrapID_" + productIDVal)
		.css({'position' : 'absolute'})
		.animate({opacity: 0.4}, 100 )
		.animate({opacity: 0.1, marginLeft: gotoX, marginTop: gotoY, width: newImageWidth, height: newImageHeight}, 1200, function() {
																																																																										  			$(this).remove();
	
			$("#notificationsLoader").html('<img src="/images/loader.gif">');
		
			$.ajax({  
				type: "POST",  
				url: "http://www.nase-miminko.cz/php/functions.php",  
				data: { productID: productIDVal2,productCnt: kolik, action: "addToBasket"},  
				success: function(theResponse) {
					
					if( $("#pproductID_" + productIDVal2).length > 0){
						$("#pproductID_" + productIDVal2).animate({ opacity: 0 }, 500)
						.before(theResponse).remove()
						.animate({ opacity: 0 }, 500)
						.animate({ opacity: 1 }, 500);
						$("#notificationsLoader").empty();
						
					} else {
						$("#basketItemsWrap tr:first").before(theResponse)
						.hide()
						.show("slow");  
						$("#notificationsLoader").empty();			
					}
			$.ajax({  
				type: "POST",  
				url: "http://www.nase-miminko.cz/php/functions.php",  
				data: {action: "getSumBasket"},  
				success: function(theResponse) {
						$("#sumkos").empty()
						.html(theResponse);
      			$.ajax({  
      				type: "POST",  
      				url: "http://www.nase-miminko.cz/php/functions.php",  
      				data: {action: "getDoprava"},  
      				success: function(theResponse2) {
      						$(".dopravagratis").empty()
            			.animate({ 
                          opacity: 0.2}, "slow")  
            			.html(theResponse2)
            			.animate({ 
                          opacity: 1}, "slow");  
      				}  
      			});  
				}  
			});  
					
				}  
			});  
		
		});
		
	});


	$(".dokoselink3").click(function() {
	  fake_load();
		var productIDValSplitter 	= (this.id).split("_");
		var productIDVal 			= productIDValSplitter[1];
		var productIDVal2 			= (this.name)	;
		var productX 		= $("#productImageWrapID_" + productIDVal).offset().left;
		var productY 		= $("#productImageWrapID_" + productIDVal).offset().top;
		var kolik=document.getElementById('kos_det').value;
		
		if( $("#productID_" + productIDVal).length > 0){
			var basketX 		= $("#productID_" + productIDVal).offset().left;
			var basketY 		= $("#productID_" + productIDVal).offset().top;			
		} else {
			var basketX 		= $("#basketTitleWrap").offset().left;
			var basketY 		= $("#basketTitleWrap").offset().top;
		}
		
		var gotoX 			= basketX - productX;
		var gotoY 			= basketY - productY;
		
		var newImageWidth 	= $("#productImageWrapID_" + productIDVal).width() / 3;
		var newImageHeight	= $("#productImageWrapID_" + productIDVal).height() / 3;

		$("#productImageWrapID_" + productIDVal + " img")
		.clone()
		.prependTo("#productImageWrapID_" + productIDVal)
		.css({'position' : 'absolute'})
		.animate({opacity: 0.4}, 100 )
		.animate({opacity: 0.1, marginLeft: gotoX, marginTop: gotoY, width: newImageWidth, height: newImageHeight}, 1200, function() {
																																																																										  			$(this).remove();
	
			$("#notificationsLoader").html('<img src="/images/loader.gif">');
		
			$.ajax({  
				type: "POST",  
				url: "http://www.nase-miminko.cz/php/functions.php",  
				data: { productID: productIDVal2,productCnt: kolik, action: "addToBasket"},  
				success: function(theResponse) {
					
					if( $("#productID_" + productIDVal2).length > 0){
						$("#productID_" + productIDVal2).animate({ opacity: 0 }, 500)
						.before(theResponse).remove()
						.animate({ opacity: 0 }, 500)
						.animate({ opacity: 1 }, 500);
						$("#notificationsLoader").empty();
						
					} else {
						$("#basketItemsWrap tr:first").before(theResponse)
						.hide()
						.show("slow");  
						$("#notificationsLoader").empty();			
					}
    			$.ajax({  
    				type: "POST",  
    				url: "http://www.nase-miminko.cz/php/functions.php",  
    				data: {action: "getSumBasket"},  
    				success: function(theResponse) {
    						$("#sumkos").empty()
    						.html(theResponse);
          			$.ajax({  
          				type: "POST",  
          				url: "http://www.nase-miminko.cz/php/functions.php",  
          				data: {action: "getDoprava"},  
          				success: function(theResponse2) {
          						$(".dopravagratis").empty()
            					.animate({ 
                          opacity: 0.2}, "slow")  
            					.html(theResponse2)
            					.animate({ 
                          opacity: 1}, "slow")  
          				}  
          			});  
    				}  
    			});  
				}  
			});  
		
		});
		
	});
	
	
	
	$("#basketItemsWrap td img.del").live("click", function(event) { 
		var productIDValSplitter 	= (this.id).split("_");
		var productIDVal 			= productIDValSplitter[1];	
           //alert("Mazu");
		$("#notificationsLoader").html('<img src="/images/loader.gif">');
	
		$.ajax({  
			type: "POST",  
			url: "http://www.nase-miminko.cz/php/functions.php",  
			data: { productID: productIDVal, action: "deleteFromBasket"},  
			success: function(theResponse) {
				
				$("#productID_" + productIDVal).hide("slow",  function() {$(this).remove();});
				$("#notificationsLoader").empty();
			
			}  
		});  
			$.ajax({  
				type: "POST",  
				url: "http://www.nase-miminko.cz/php/functions.php",  
				data: {action: "getSumBasket"},  
				success: function(theResponse) {
						$("#sumkos").empty();
						$("#sumkos").html(theResponse);
      			$.ajax({  
      				type: "POST",  
      				url: "http://www.nase-miminko.cz/php/functions.php",  
      				data: {action: "getDoprava"},  
      				success: function(theResponse2) {
      						$(".dopravagratis").empty()
            			.animate({ 
                          opacity: 0.2}, "slow")  
            			.html(theResponse2)
            			.animate({ 
                          opacity: 1}, "slow");  
      				}  
      			});  
				}  
			});  
	});
	$(".kos_radek2 img").live("click", function(event) { 
		var productIDValSplitter 	= (this.id).split("_");
		var productIDVal 			= productIDValSplitter[1];	
           //alert("Mazu");
		$("#notificationsLoader").html('<img src="/images/loader.gif">');
	
		$.ajax({  
			type: "POST",  
			url: "http://www.nase-miminko.cz/php/functions.php",  
			data: { productID: productIDVal, action: "deleteFromBasket"},  
			success: function(theResponse) {
				
				$("#productID_" + productIDVal).hide("slow",  function() {$(this).remove();});
				$("#notificationsLoader").empty();
				$("#TKos").html(theResponse);
			
			}  
		});  
			$.ajax({  
				type: "POST",  
				url: "http://www.nase-miminko.cz/php/functions.php",  
				data: {action: "getSumBasket"},  
				success: function(theResponse) {
						$("#sumkos").empty()
						.html(theResponse);
      			$.ajax({  
      				type: "POST",  
      				url: "http://www.nase-miminko.cz/php/functions.php",  
      				data: {action: "getDoprava"},  
      				success: function(theResponse2) {
      						$(".dopravagratis").empty()
            			.animate({ 
                          opacity: 0.2}, "slow")  
            			.html(theResponse2)
            			.animate({ 
                          opacity: 1}, "slow");  
      				}  
      			});  
				}  
			});  
			$.ajax({  
				type: "POST",  
				url: "http://www.nase-miminko.cz/php/functions.php",  
				data: {action: "getBasketView"},  
				success: function(theResponse) {
						$("#TKos").empty()
						.html(theResponse);
				}  
			});  
		
	});
	
	$(".kos_radek1 img").live("click", function(event) { 
		var productIDValSplitter 	= (this.id).split("_");
		var productIDVal 			= productIDValSplitter[1];	
           //alert("Mazu");
		$("#notificationsLoader").html('<img src="/images/loader.gif">');
	
		$.ajax({  
			type: "POST",  
			url: "http://www.nase-miminko.cz/php/functions.php",  
			data: { productID: productIDVal, action: "deleteFromBasket"},  
			success: function(theResponse) {
				
				$("#productID_" + productIDVal).hide("slow",  function() {$(this).remove();});
				$("#notificationsLoader").empty();
				$("#TKos").html(theResponse);
			
			}  
		});  
			$.ajax({  
				type: "POST",  
				url: "http://www.nase-miminko.cz/php/functions.php",  
				data: {action: "getSumBasket"},  
				success: function(theResponse) {
						$("#sumkos").empty()
						.html(theResponse);
      			$.ajax({  
      				type: "POST",  
      				url: "http://www.nase-miminko.cz/php/functions.php",  
      				data: {action: "getDoprava"},  
      				success: function(theResponse2) {
      						$(".dopravagratis").empty()
            			.animate({ 
                          opacity: 0.2}, "slow")  
            			.html(theResponse2)
            			.animate({ 
                          opacity: 1}, "slow");  
      				}  
      			});  
				}  
			});  
			$.ajax({  
				type: "POST",  
				url: "http://www.nase-miminko.cz/php/functions.php",  
				data: {action: "getBasketView"},  
				success: function(theResponse) {
						$("#TKos").empty()
						.html(theResponse);
				}  
			});  
		
	});
//----------------------
 if ($('#u_ic').length) {  
			$("#u_ic").mask("99999999");
			$("#u_telefon").mask("+999 999 999 999");
			$("#d_ic").mask("99999999");
			$("#d_telefon").mask("+999 999 999 999");
	}
 if ($('#registrace').length) {  
			$("#registrace").validationEngine({
				success :  false,
				failure : function() {}
			})
 }
		});

