



jQuery('document').ready(function($){
//  jQuery('#slides').slides({
//    preload: true,
//    // preloadImage: 'images/loading.gif',
//    play: 5000,
//    pause: 2500,
//    hoverPause: true,
//
//    generateNextPrev : false
//  });


  jQuery('#products-slides').slides({
    preload: true,
    preloadImage: 'images/loading.gif',
    play: 5000,
    pause: 2500,
    hoverPause: true,
    generateNextPrev : false
  });

  jQuery(function(){
    jQuery('.navmenu ul').superfish();
  });

  $('#searchform [name="sm"]').toggleVal({
    populateFrom: "custom",
    text: "Search"
  });

  $('#newsletterform .toggleval').toggleVal({
    populateFrom: "custom",
    text: "Your Email"
  });


  $('.contact-block [name="name"]').toggleVal({
    populateFrom: "custom",
    text: "Name"
  });
    $('.contact-block [name="email"]').toggleVal({
    populateFrom: "custom",
    text: "Email"
  });
    $('.contact-block [name="phone"]').toggleVal({
    populateFrom: "custom",
    text: "Phone"
  });
    $('.contact-block [name="question"]').toggleVal({
    populateFrom: "custom",
    text: "Question"
  });

  
  // menu fix - depend on css setings !
  $('.navmenu li a.sf-with-ul').live('mouseover', function(){
    var elementNext = $(this).next('ul');
    elementNext.css('width', $(this).width() + 70)
    elementNext.find('a').css('width', $(this).width() + 70);
  })

});

/* Input Placeholder */

function supports_input_placeholder() {
    var i = document.createElement('input');
    return 'placeholder' in i;
}

function bindPlaceholderFunctionality(selector) {
    $(selector).blur(
        function() {
            if ($(this).val() == '') {
                $(this).val($(this).attr('placeholder'));
                $(this).addClass('m-placeholder');
            }
        }).focus(
            function() {
                $(this).removeClass('m-placeholder');
                if ($(this).val() == $(this).attr('placeholder'))
                    $(this).val('');
            }).each(function() {
                if (($(this).val() == '') || ($(this).val() == $(this).attr('placeholder'))) {
                    $(this).val($(this).attr('placeholder'));
                    $(this).addClass('m-placeholder');
                }
            var form = $(this).closest('FORM');
            if (form.length)
            form.submit(function() {
                if ($(this).val() == $(this).attr('placeholder'))
                    $(this).val('');
            });
        });
}

$(function(){
    if (!supports_input_placeholder()) {
        bindPlaceholderFunctionality('input[placeholder], textarea[placeholder]');
    }
});



