
$(document).ready(function(){
	if ($('#headlines').get(0)) {
		$('#headlines').cycle({
			fx:	'fade',
			timeout: 5000,
			speed: 1500,
			sync: 0,
			pause: 1,
			slideExpr:'dd',
			cleartype:0
		});
	}
});

jQuery.fn.hint = function() {
	return this.each(function(){
		var t = $(this);
		var title = t.attr('title');

		if (title) {
			t.focus(function(){
				if (t.val() == title) {
				  t.val('');
				  t.removeClass('blur');
				}
			})

			t.blur(function(){
				if (t.val() == '') {
				  t.val(title);
				  t.addClass('blur');
				}
			})

			t.parents('form:first()').submit(function(){
				if (t.val() == title) {
					t.val('');
					t.removeClass('blur');
				}
			});

			t.blur();
		}
	})
}

$(function(){
	$('input:text').hint();
})

function applyPopups()
{
  a = document.getElementsByTagName("a");

  for(i=0; i<a.length; i++)
  {
    if(a[i].getAttribute("target") && a[i].getAttribute("target") == "_blanksound")
    {
      a[i].onclick = function()
      {
        url = this.getAttribute("href");
        window.open(url,'popup','width=450,height=150,scrollbars=1,resizable=1,toolbar=0');
        return false;
      }
    }
  }
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

addLoadEvent(applyPopups);
