﻿$().ready(function(){
	ContactForm.init();
});

ContactForm = {
	init: function(){
		$(".btnDelete").click(function(){
			$(".txtContactName")[0].value = "";
			$(".txtContactLastName")[0].value = "";
			$(".txtContactEnterprise")[0].value = "";
			$(".txtContactPhone")[0].value = "";
			$(".txtContactEmail")[0].value = "";
			$(".txtContactSubject")[0].value = "";
			$(".txtContactMessage")[0].value = "";
			$(".terms input")[0].checked = false;
			return false;
		});
	}	
}

function cvVerifyContactFields(source, arguments)
{    
    if ($(".txtContactName").val() != "" && $(".txtContactLastName").val() != "" && $(".txtContactEmail").val() != "" && $(".terms input")[0].checked)
	{
	    arguments.IsValid=true;
        return;
	}
	else
	{
        arguments.IsValid=false;
	}
}

function cvVerifyUnSubscribeNewsletterFields(source, arguments)
{    
    if ($(".txtNewsletterEmail").val() != "")
	{
	    arguments.IsValid=true;
        return;
	}
	else
	{
        arguments.IsValid=false;
	}
}


function cvVerifyContactTerms(source, arguments)
{
	if ($(".terms input")[0].checked)	
	{
	    arguments.IsValid=true;
        return;
	}
	else
	{
        arguments.IsValid=false;
	}
}
