// Create an object that is used to newsletterField form fields
newsletterField = {
	// ++++++++++++++++++ Object properties (Tip: You can change the values to fit in with your html page but DON'T change the property names)
	// ID of form
	fieldID:'newsletter_email',
	fieldID1:'newsletter_name',
	// CSS Style for newsletterFielded textbox
	calendarheadingClass:'highlight_field',
	fieldText:'Enter Email Address...',
	fieldText1:'Enter Your Name...',
	
	/************************************* Initialise functionality (called after page has loaded using addEvent() method ********************************************************/
  	// Initilise object
  	init:function()
  	{
  		/****************** Checks to see if the DOM is available (the browser supports it) AND the element is available ******/
		// Check to see if W3C DOM is available - if not terminate script (object detection)
		if(!document.getElementById || !document.createTextNode){return;}
		var container = document.getElementById(newsletterField.fieldID); // Find form element
		// If form element is available, initialise functunality
		if(container)
		{
			if(container.value == '')
				container.value = newsletterField.fieldText;
			// Add the onclick event behaviour - detects if user clicks into form
			helper.addEvent(container,'click', newsletterField.newsletterFieldField, false);
			// Add the focus event behaviour - detects if user tabs into form (if left off, the form field will not newsletterField if a user 'tabs' into the field)
			helper.addEvent(container,'focus', newsletterField.newsletterFieldField, false);
			// Add the onclick event behaviour to the link
			helper.addEvent(container,'blur', newsletterField.removeFieldnewsletterField, false);

		};
		var container = document.getElementById(newsletterField.fieldID1); // Find form element
		// If form element is available, initialise functunality
		if(container)
		{
			if(container.value == '')
				container.value = newsletterField.fieldText1;
			// Add the onclick event behaviour - detects if user clicks into form
			helper.addEvent(container,'click', newsletterField.newsletterFieldField1, false);
			// Add the focus event behaviour - detects if user tabs into form (if left off, the form field will not newsletterField if a user 'tabs' into the field)
			helper.addEvent(container,'focus', newsletterField.newsletterFieldField1, false);
			// Add the onclick event behaviour to the link
			helper.addEvent(container,'blur', newsletterField.removeFieldnewsletterField1, false);

		};
  	},
  	// Function to newsletterField form field (adds a class to the input)
  	newsletterFieldField:function(e)
	{
		// Get the target (the element we want to assign the class to) using getTarget() helper method
		var target = helper.getTarget(e);
		if(target.value == newsletterField.fieldText)
			target.value = '';
		
		// Use css() helper method to assign class calendarheadingClass
		helper.cssjs('add', target , newsletterField.calendarheadingClass);
    },
    // Function to remove newsletterField from form field (removes a class from the input)
    removeFieldnewsletterField:function(e)
	{
		var target = helper.getTarget(e);
		if(target.value == '') {
			target.value = newsletterField.fieldText;
			helper.cssjs('remove', target ,newsletterField.calendarheadingClass);
		}
    },
	// Function to newsletterField form field (adds a class to the input)
  	newsletterFieldField1:function(e)
	{
		// Get the target (the element we want to assign the class to) using getTarget() helper method
		var target = helper.getTarget(e);
		if(target.value == newsletterField.fieldText1)
			target.value = '';
		
		// Use css() helper method to assign class calendarheadingClass
		helper.cssjs('add', target , newsletterField.calendarheadingClass);
    },
    // Function to remove newsletterField from form field (removes a class from the input)
    removeFieldnewsletterField1:function(e)
	{
		var target = helper.getTarget(e);
		if(target.value == '') {
			target.value = newsletterField.fieldText1;
			helper.cssjs('remove', target ,newsletterField.calendarheadingClass);
		}
    }
}
// start the show.
//helper.addEvent(window, 'load', newsletterField.init, false);
