   function init_promo(){
   
    $('#promoAction').hide();
    $('.promoButton').click(function(e) {
        e.preventDefault();
        name = $(this).attr('name');
        path=url +"inc/ajax/apromo.php?promo="+name;
      //  alert(path);
        getData(path,"promoAction");
        document.getElementById("promoAction").display = "block";
        $('#promoAction').modal({
            close:false,
            onClose: $.modal.close()
         });
    });
    }


 $(document).ready(function(){
 
 	function myokfunc(){
	}

	//init colorpicker:
	//$.ColorPicker.init();	
	/*
	$("#menu ul li a[id^='a_']").click(function() {
		var linkId = $(this).attr('id');
		var catId = linkId.split('_');
		$('.hiddenSubmenu').attr({style: "display:none"});
		$('.submenu_' + catId[1]).attr({style: "display: block"});
		//return false;
	});
	*/

  
   
    init_promo();
	$('.sendToFriend').click(function (e) {
		e.preventDefault();
		// load the contact form using ajax
		$.get(url + "inc/sendfriend.php?product="+window.location, function(data){
			// create a modal dialog with the data
			$(data).modal({
				close: false,
				overlayId: 'contact-overlay',
				containerId: 'contact-container',
				onOpen: contact.open,
				onShow: contact.show,
				onClose: contact.close
			});
		});
	});
			 	 
	$('.availability').click(function (e) {
		e.preventDefault();
		// load the contact form using ajax
		var code = $('.kod').html();
		codeElems = code.split(':');
		$.get(url + "inc/ajax/checkAvailability.php?product="+window.location+'&code='+codeElems[1], function(data){
			// create a modal dialog with the data
			$(data).modal({
				close: false,
				overlayId: 'contact-overlay',
				containerId: 'contact-container',
				onOpen: availability.open,
				onShow: availability.show,
				onClose: availability.close
			});
		});
	});

    $('.availabilityRapr').click(function (e) {
        e.preventDefault();

        var product=$(this).find('input').attr("value");
		$.get("../inc/ajax/checkAvailabilityRapr.php?product="+product, function(data){
			// create a modal dialog with the data
			$(data).modal({
        position: [10,10],
				close: false,
				overlayId: 'contact-overlay',
				containerId: 'contact-container',
				onOpen: availability.open,
				onShow: availability.show,
				onClose: availability.close
			});
		});
	});
	
	
	
	
	//Set Default State of each portfolio piece
	$(".paging").show();
	$(".paging a:first").addClass("active");
		
	//Get size of images, how many there are, then determin the size of the image reel.
	var imageWidth = $(".window").width();
	var imageSum = $(".image_reel img").size();
	var imageReelWidth = imageWidth * imageSum;
	
	//Adjust the image reel to its new size
	$(".image_reel").css({'width' : imageReelWidth});
	
	//Paging + Slider Function
	rotate = function(length, isLast){	
		var triggerID = $active.attr("rel") - 1; //Get number of times to slide
		var image_reelPosition = triggerID * imageWidth; //Determines the distance the image reel needs to slide

		$(".paging a").removeClass('active'); //Remove all active class
		$active.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function)
		
		//Slider Animation
		
    var slid_timeout = 1;
		if(length != 0) slid_timeout = 500;
		
		
		$("#slid_timeout").html(slid_timeout);
		$(".image_reel").animate({ 
			left: -image_reelPosition
		}, slid_timeout );
		//alert(isLast);
		if(isLast == 0){
		//  alert('posledni');
    $active = $('.paging a:first');
    rotate(0, 1);
    }
	
		
	}; 
	
	//Rotation + Timing Event
	rotateSwitch = function(){		
		play = setInterval(function(){ //Set timer - this will repeat itself every 3 seconds
			$active = $('.paging a.active').next();
			var length = $active.length;
			if ( $active.length === 0) { //If paging reaches the end...
				$active = $('.paging a:first'); //go back to first
			}
			var isLast = $active.next().length;
			rotate(length, isLast); //Trigger the paging and slider function
		}, 7000); //Timer speed in milliseconds (3 seconds)
	};
	
	rotateSwitch(); //Run function on launch
	
	//On Hover
	$(".image_reel a").hover(function() {
		clearInterval(play); //Stop the rotation
	}, function() {
		rotateSwitch(); //Resume rotation
	});	
	
	//On Click
	$(".paging a").click(function() {	
		$active = $(this); //Activate the clicked paging
		//Reset Timer
		clearInterval(play); //Stop the rotation
		rotate(); //Trigger rotation immediately
		rotateSwitch(); // Resume rotation
		return false; //Prevent browser jump to link anchor
	});
				 	 
   animatedcollapse.addDiv('menuCont', 'fade=0');
   animatedcollapse.addDiv('schranka', 'fade=0');
   animatedcollapse.addDiv('basketId', 'fade=0');
   animatedcollapse.addDiv('infoBox', 'fade=0');
   animatedcollapse.addDiv('log', 'fade=0');
   animatedcollapse.addDiv('glossatyList', 'fade=0');
   animatedcollapse.addDiv('ANKETA', 'fade=0');
   animatedcollapse.addDiv('NEWS', 'fade=0');
   animatedcollapse.addDiv('NEWSL', 'fade=0');
   animatedcollapse.addDiv('quickContact', 'fade=0');
   animatedcollapse.addDiv('productHistory', 'fade=0');
   animatedcollapse.addDiv('currencyCalc', 'fade=0');
   animatedcollapse.addDiv('categoryHistory', 'fade=0');
   animatedcollapse.addDiv('actionProducts', 'fade=0');
   animatedcollapse.addDiv('newProducts', 'fade=0');
   animatedcollapse.addDiv('monitoredProducts', 'fade=0');
   animatedcollapse.addDiv('mostWantedProducts', 'fade=0');
   animatedcollapse.addDiv('recommendProducts', 'fade=0');
   animatedcollapse.addDiv('saleProducts', 'fade=0');
   animatedcollapse.addDiv('specSearch', 'fade=0');   	   	
   animatedcollapse.addDiv('catDownl', 'fade=0');   	    	
   animatedcollapse.addDiv('pay', 'fade=0');   	    	    	
   animatedcollapse.addDiv('tagClouds', 'fade=0');    	    	
   animatedcollapse.addDiv('menuDes', 'fade=0');   	  	  
   animatedcollapse.init();
   pageReloadBlock();

    $(".delivery_date").datepicker({ changeFirstDay: false, showOn: "both", buttonImage: "images/calendar.png", buttonImageOnly: true, onSelect: function (input, date) { changeDeliveryDate(input, date); }});

	$(".jCarouselLite").jCarouselLite({
	    auto: 1000,
	    visible: 5,
	    speed: 2000
	});
	
    $('#browser').html('Používáte <strong>' + $.browser.name + '</strong> ve verzi <strong>' + $.browser.version + '</strong> ' + $.os.name); 
 });

