
this.label2value = function(){	

	var inactive = "inactive";
	var active = "active";
	var focused = "focused";

	$("label.sw").each(function(){		
		obj = document.getElementById($(this).attr("for"));
		if(($(obj).attr("type") == "text") || (obj.tagName.toLowerCase() == "textarea")){			
			$(obj).addClass(inactive);			
			var text = $(this).text();
			$(this).css("display","none");			
			$(obj).val(text);
			$(obj).focus(function(){	
				$(this).addClass(focused);
				$(this).removeClass(inactive);
				$(this).removeClass(active);								  
				if($(this).val() == text) $(this).val("");
			});	
			$(obj).blur(function(){	
				$(this).removeClass(focused);													 
				if($(this).val() == "") {
					$(this).val(text);
					$(this).addClass(inactive);
				} else {
					$(this).addClass(active);		
				};				
			});				
		};	
	});		
};
$(document).ready(function(){	
	label2value();	
});


function validate_contact() {

if ( document.getElementById('name').value.length < 2 ) {
    alert("Please provide a real name");
    return false;
    }

if (document.getElementById("mail").value.indexOf('@')==-1  || document.getElementById("mail").value.indexOf('.')==-1  || document.getElementById("mail").value.length <= 7 )
    {
    alert("Please provide your email");
    return false;
    }

if ( document.getElementById('phone').value.length < 5 ) {
    alert("Please provide a phone number");
    return false;
    }

}

function validate_signup() {

if ((document.getElementById('f_name').value.length < 2 ) || (document.getElementById('f_name').value == 'First Name')) {
    alert("Please provide your First Name");
    return false;
    }

if ((document.getElementById('surname').value.length < 2 ) || (document.getElementById('surname').value == 'Surname')) {
    alert("Please provide your Surname");
    return false;
    }

if (document.getElementById("email").value.indexOf('@')==-1  || document.getElementById("email").value.indexOf('.')==-1  || document.getElementById("email").value.length <= 7 )
    {
    alert("Please provide a valid email address");
    return false;
    }

}
