jQuery.noConflict();

jQuery(document).ready(function() {
	jQuery('#slider').cycle({
		fx:     'fade',
		speed:   500,
		timeout: 6000,  
		pause:   1,   
		next:   '#next',
		prev:   '#prev',
		pager:  '#slider-control-2'
	});

	jQuery('a[rel*=external]').not("[href*='stecom.nl/']").attr('target','_blank');
	jQuery("a[href^=http]").not("[href*='stecom.nl/']").attr('target','_blank');

});

jQuery(document).ready(function($) {
  $('#searchform input, #frmNewsletter input').each(function () {
    if ($(this).val() == '') {
      $(this).val($(this).attr('defaultvalue'));
    }
  }).focus(function () {
    $(this).removeClass('fielderror');
    if ($(this).val() == $(this).attr('defaultvalue')) {
      $(this).val('');
    }
  }).blur(function () {
    if ($(this).val() == '') {
      $(this).val($(this).attr('defaultvalue'));
    }
  });
  $('#searchform form').submit(function () {
    $('#searcherror').remove();
    var errors = 0;
    $(this).find('input').each(function () {
      if ($(this).val() == $(this).attr('defaultvalue')) {
        $(this).val('');
      }
      if ($(this).hasClass('required') && $(this).val() == '') {
        $(this).addClass('fielderror');
        errors++;
      }
    });
    
    if (errors > 0) {
      $(this).find('input').each(function () {
        if ($(this).val() == '') {
          $(this).val($(this).attr('defaultvalue'));
        }
      });
      $('#searchform').prepend('<p class="error">What are you searching for?</p>');
      return false;
    }
    return true;
    
  });
});
