	function clearText(thefield) {

	  if (thefield.defaultValue==thefield.value) { thefield.value = "" }

	} 

	

	function replaceText(thefield) {

	  if (thefield.value=="") { thefield.value = thefield.defaultValue }

	}	

	

	function ValidateEmail(valor) 

    {

	    if (/^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]{2,60}\.[a-zA-Z]{2,4}$/.test(valor))

		    return true;

	    else

		    return false;

    }

    

    function ValidatePhone(incoming)

    {

		    var ValidChars = "0123456789.()- ";

		    var IsCorrect=true;

		    var Char;



		    for (cont = 0; cont < incoming.length && IsCorrect == true; cont++) 

		    { 

		    Char = incoming.charAt(cont); 

		    if (ValidChars.indexOf(Char) == -1) 

		    return false;

		    }

		    return true;

    }

    

   function trim(myString)

   {

	return myString.replace(/^\s+/g,'').replace(/\s+$/g,'')

   }



	function ValidateDataSmall(FullName,Email)

	{	    

		FullName.value=trim(FullName.value);

		Email.value=trim(Email.value);		

				

		if ((FullName.value == "") || (FullName.value == 'FullName'))

		{

			alert('Please, enter your name.');

			FullName.focus();

			return (false);

		}

		

		if ((Email.value == "") || (Email.value == 'Email'))

		{

			alert('Please, enter your email.');

			Email.focus();

			return (false);

		}

		else

		{

			if(!ValidateEmail(Email.value))

			{

				alert("Please check the emails address.");

				Email.focus();

				return false;

			}

		}

								

		return true;

	}



	function OnSubmit()

	{	

		var txtFullName=getElement('txtFullName');				

		var txtEmail=getElement('txtEmail');		

		var hdnContactFormID=getElement('hdnContactFormID');

		var hdnContactFormType=getElement('hdnContactFormType');

		var chkSingUp=getElement('chkSingUp');

		var chkWebinar=getElement('chkWebinar');		

		

		if (ValidateDataSmall(txtFullName,txtEmail)==true)

			window.location.href="IfMark_savesmallform.aspx?txtFullName="+txtFullName.value +			

			"&txtEmail=" + txtEmail.value +						

			"&chkSingUp=" + chkSingUp.checked +

			"&chkWebinar=" + chkWebinar.checked +

			"&hdnContactFormID=" + hdnContactFormID.value +

			"&hdnContactFormType=" + hdnContactFormType.value;		

	}

	

	function getElement(name)

    {

        var object = null;

        var tbSmallContact=document.getElementById('tbSmallContact'); 

        for (var i=0; i<tbSmallContact.rows.length; i++)

        {

            for (var j=0; j<tbSmallContact.rows[i].cells.length; j++)

            {

                for (var k=0; k<tbSmallContact.rows[i].cells[j].childNodes.length; k++)

                {                

                    if(tbSmallContact.rows[i].cells[j].childNodes[k].id == name)

                    {

                       object = tbSmallContact.rows[i].cells[j].childNodes[k];

                       return object;

                    }

                }

            }

        }    

    }

