// SUBMIT FORM
	
	/*http://dotnetslackers.com/JavaScript/re-137768_JavaScript_gt_gt_Get_Any_CSS_Property_Value_of_an_Object_using_style.aspx
	* function that gets the style on an element
	*/
	function $style(ElementId, CssProperty)
	{
	    function $(stringId) {
	        return document.getElementById(stringId);
		}   

		if($(ElementId) != null){
			if($(ElementId).currentStyle) {
		        var convertToCamelCase = CssProperty.replace(/\-(.)/g, function(m, l){return l.toUpperCase()});
		        return $(ElementId).currentStyle[convertToCamelCase];
		    }
			else if (window.getComputedStyle)
			{
		        var elementStyle = window.getComputedStyle($(ElementId), "");
		        return elementStyle.getPropertyValue(CssProperty);
		    }
	    }
	}
	
	
	/*
	* jQuery emptyonclick plugin
	*
	* Created by Andreas Creten (andreas@madewithlove.be) on 2008-06-06.
	* Copyright (c) 2008 madewithlove. All rights reserved.
	*
	* Version: 1.2
	*/
	$(document).ready(function() {
			$('input[type="text"]').addClass("idleField");
       		$('input[type="text"]').focus(function() {
       			$(this).removeClass("idleField").addClass("focusField");
    		    if (this.value == this.defaultValue){ 
    		    	this.value = '';
    		    	$(this).attr('style', 'border:0;');
    		    	$(".submit").removeAttr("disabled");
				}
				if(this.value != this.defaultValue){
	    			this.select();
	    			$(this).attr('style', 'border:0;');
	    			$(".submit").removeAttr("disabled");
	    		}
    		});
    		$('input[type="text"]').blur(function() {
    			$(this).removeClass("focusField").addClass("idleField");
    		    if ($.trim(this.value) == ''){
			    	this.value = (this.defaultValue ? this.defaultValue : '');
			    	$(this).attr('style', 'border:0;');
			    	$(".submit").removeAttr("disabled");
				}
    		});
		});
	jQuery.fn.extend({
	    emptyonclick: function(options) {
	        return this.each(function() {
	            new jQuery.EmptyOnClick(this, options);
	        });
	    }
	});
	
	jQuery.EmptyOnClick = function(element, options) {
	    var defaultValue = $(element).val();
	    var defaultBgColor = $style($(element), "background-color");
	    var defaultColor = $style($(element), "color");

	    // Bind event handlers to the element
	    if($(element).attr('type') != "submit"){
			$(element)
			// On Focus: Store the default value if it's not set, empty the field
			.bind("focus", function(e) {
				if(defaultValue == $(this).val()){
					$(this).val('');
					$(this).attr('style', 'color:#FFF;');
				}
			})

			// On Blur: if the field is empty, reset the default value
			.bind("blur", function(e) {
				if(!$(this).val()) {
					$(this).val(defaultValue);
					$(this).attr('style', 'background-color:'+defaultBgColor+'; color:'+defaultColor+';');
				}
			});
	    }
	};
	
	$(function() {
		
		// NEWSLETTER ---------------------------
		$('#newsletter-form').ajaxForm({ 
			target: '#newsletter-result',
			success: function() { }
		});
		
		// NEWSLETTER ---------------------------
		$('#newsletter-frameld-form').ajaxForm({ 
			target: '#newsletter-frameld-result',
			success: function() { }
		});
		
		// CONTACT ---------------------------
		$('#contact-form').ajaxForm({ 
			target: '#contact-result',
			success: function() { }
		});
		
		$('#newsletter-form').submit(function(){
    		$('input[type=submit]', this).attr('disabled', 'disabled');
		});
		$('#newsletter-frameld-form').submit(function(){
    		$('input[type=submit]', this).attr('disabled', 'disabled');
		});
		$('#contact-form').submit(function(){
    		$('input[type=submit]', this).attr('disabled', 'disabled');
		});
		
		$('input, textarea').emptyonclick();
	})
	
	function result(element) {$(element).fadeIn();}


