/* *** GLOBAL BEHAVIOURS *** */

$(document).ready(function() {
	
// Form input auto-clear
/*	 function resetFields(){
	$(":input[@type=text]").focus(function(){
		if (this.value == this.defaultValue){
			this.value = "";
		}
	});
	$(":input[@type=text]").blur(function(){
		if (this.value == ""){
			this.value = this.defaultValue;
		}
	});
};
$(function(){
	resetFields();	
});*/


	$(".bgInput input").focus(function (i) {
				this.value = "";
	});



	$(".sponsor").attr("value", "Enter your friend's name").focus(function (i) {
		if (this.value == "Enter your friend's name"){
			this.value = "";
		}
	}).blur(function (i) {
		if (this.value == ""){
			this.value = "Enter your friend's name";
		}
	});


// Standard button highlight
$(function() {
	$('.stdBtn a, .stdBtn input').hover(
		function(){$(this).parents('span, div.stdBtn').addClass('stdBtn-hover');}, 
		function() {$(this).parents('span, div.stdBtn').removeClass('stdBtn-hover');
	});	
	
});

// New window pop-up
	$('#bookmarks a').addClass('new-window');
	$('a.new-window').click(function(){
		window.open(this.href);
		return false;	
	});

	//$('td.enter a').addClass('popupwindow').attr('rel','formWindow');
	//$('#eventDetails .stdBtn a').addClass('popupwindow').attr('rel','formWindow');
	$('a[title=Glossary]').addClass('popupwindow').attr('rel','newWindow').attr('href', '/glossary/index.php?popupwindow');
	$('a.external').addClass('popupwindow')
	var profiles =	{
		newWindow:
		{
			width: 1000,
			height: 600,
			status:1,
			toolbar:1,
			scrollbars:1,
			status:1,
			resizable:1,
			location:1,
			menubar:1
		},
		formWindow:
		{
			width: 1024,
			height: 768,
			status:0,
			toolbar:0,
			scrollbars:1,
			status:0,
			resizable:0,
			location:0,
			menubar:0
		}
	};
	
	//$(function()
	//{
  // 		$(".popupwindow").popupwindow(profiles);
  // 	});
	
// Glossary
	$('.glossary').after('<div class="linkBox"><div class="stdBtn"><span class="btnTl"><span class="btnBr"><span class="btnBl"><span class="btnTr"><a href="javascript:window.close();">Close window</a></span></span></span></span></div></div>');

// Table sorting
	//$('table[@class!="noSort"]').addClass('tableSort');
	//$('.tableSort').tablesorter(
	//	{widgets: ['zebra']});

	//$('.noSort tr:odd').addClass('odd');
		
});

