﻿function validateAndCleanUp()
{
	if (jQuery.validate({usedefault: true}) == false)
		return false;
	
	$(".text").each(function(i, item)
	{
		if (item.value == $(item).attr("title"))
			item.value = "";
	});
	
}

function removeValidation(ev, ids)
{
	for (var i = 0; i < ids.length; i++)
	{
		$("#" + ids[i]).removeClass("required");
		$("#" + ids[i]).removeClass("notvalid");
		$("#validationerror_" + ids[i]).hide();
	}
	return false;
}

$(document).ready(function() {
	
	$(".text").each(function(i, item) {
        $(item).val($(item).attr("title"));
	});
	
	// Bind textareas.
	$(".text").bind("focus", function() {

		$(this)
			.val("")
			.css({ color: "#d54c27" })

	});
	
	$(".text").bind("blur", function() {

		var t = $(this);

		if (t.val() == "" && t.attr("title"))
			t.val(t.attr("title"))
				.css({ color: "#cccccc" })
		else
			t.unbind("focus");   
	});
	
	$(".external").each(function(i, item) {
		
		$(item).bind("click", function(ev, i) {
			window.open(this.href, "window" + i);
			return false;
		});
		
	});
	
});