
// Script file with Javascript for use on every page on this site

// jQuery to release all functions after DOM is loaded
$(document).ready(function(){

	// bind class createPrettyName to artistName field
	$('.createPrettyName').bind('change',artistName.makePretty);

	// call script to fill in the your@e-mailadres value in subscribe fields
	emailField.addTheHint("#subscribeEmail");

});

// function takes artist name from artro database in select field with class createPrettyName and puts a pretty name in a text field with id artistName
var artistName = 
{
	makePretty: function() 
	{
		var artistName = $('.createPrettyName option:selected').text();
		firstLetter = artistName.charAt(0);
		splitName = artistName.split(",");
		firstName = $.trim(splitName[1]);
		lastName = $.trim(splitName[0]);
		if(firstName != "") {
			artistName = firstName + " " + lastName;
		}
		else {
			artistName = lastName;			
		}
		$('#artistName').val(artistName);
		$('#firstLetter').val(firstLetter);		
	}
}

// function highlights the selected tab on standard galerie page
var topMenu = 
{
	highlightMenuItem: function(deTab) 
	{
		$('#topMenu li:nth-child('+ deTab +')').addClass('selectedTab');
	}
}

// function to display and make disappear e-mail address in appropriate field
var emailField = 
{
	addTheHint: function(deFormfield)
	{
		$(deFormfield).val("e-mail@adres.nl");
		$(deFormfield).focus(function() {
			if($(deFormfield).val() == "e-mail@adres.nl") {
 			 $(deFormfield).val("");
			}
		});			
		$(deFormfield).blur(function() {
			if($(deFormfield).val() == "") {
 			 $(deFormfield).val("e-mail@adres.nl");
			}
		});	}
}

