// NEWSLETTER POPUP
function newsletter() {
  // Set Height of Overlay
  $('#overlayLoad').css('height',$(document).height());
  // Fade In Overlay
	$('#overlayLoad').fadeIn();
	$('#signUp').center();
	$('#signUp .closeSignUp').click(function() {
    $('#signUp').fadeOut();
    $('#overlayLoad').fadeOut();
  });
}

// REPLACE TARGET WITH A CLASS OF NEWWINDOW
function replaceTarget() {
  if (!document.getElementsByTagName('a')) return false;
  $('a[target]').addClass('newwindow').removeAttr('target');
}

// OPEN WEB STANDARD POPUP
function strictNewWindow() {
  if (!document.getElementsByTagName('a')) return false;
  $('a.newwindow').click(function() {
		window.open($(this).attr('href'));
    return false;
	});
}

// CLEAR SEARCH BOX
function clearSearchBox() {
	if (!document.getElementById('txtSearch')) return false;
	$('#txtSearch').focus(function() {
    if ($(this).val() == 'SEARCH') {
      $(this).val('');
	  }
  });
}

// BANNER ROTATION
function initializeCycle() {
	if (!$('.pics a').length > 0) return false;
  $('.pics a').cycle('fade');
}


//*****Load all functions**************************************************//
$(document).ready(function(){
  newsletter();
  clearSearchBox();
  replaceTarget();
  strictNewWindow();
  initializeCycle();
});
