
$(document).ready(function () {

  /*
   *  Search box
   */
  var searchDefaultStr = "Type phrase";
  if ($("#sitesearch").val() == '')
    $("#sitesearch").val(searchDefaultStr);

  $("#sitesearch").focus(function() {
    if ($(this).val() == searchDefaultStr) {
      $(this).val('');
    }
  });

  $("#sitesearch").blur(function() {
    if ($(this).val() == '') {
      $(this).val(searchDefaultStr);
    }
  });

  $("#indigo").fancybox({
  	frameWidth:'640',
		frameHeight:'580'
  });

  $("#litho").fancybox({
  	frameWidth:'640',
		frameHeight:'590'
  });

  $("#xpress").fancybox({
  	frameWidth:'700',
		frameHeight:'660'
  });

  /* // Menu opacity
  if ($("#mainmenu li.li_selected").length > 0){
  	$("#mainmenu li:not(.li_selected)").css({'opacity':'0.75'});
	$("#mainmenu li:not(.li_selected)").hover(function(){
    	$(this).fadeTo(0, 1);
	},
	function(){
        $(this).fadeTo(0, 0.75);
	});
  }
  */

});


$(window).ready(function () {

  $('.slideshow').cycle({
    fx: 'scrollDown',
    speed: 700,
    timeout: 5500
  });

  $('div.sliderGallery').each(function () {
    var ul = $('ul', this);
    var productWidth = ul.innerWidth() - $(this).outerWidth() + 22;

    var slider = $('.slider', this).slider({
      handle: '.handle',
      minValue: 0,
      maxValue: productWidth,
      slide: function (ev, ui) {
        var movePx = (ui.value / 100) * productWidth;
        ul.css('left', '-' + movePx + 'px');
      },
      stop: function (ev, ui) {
        var movePx = (ui.value / 100) * productWidth;
        ul.animate({ 'left' : '-' + movePx + 'px' }, 700, 'linear');
      }
    });

    $(".goto_start").click(function() {
      slider.slider("moveTo", 0, 0);
    });

    $(".goto_end").click(function() {
      slider.slider("moveTo", 100, 0);
    });
  });
});