﻿// JScript File

//Validation & Code For Free Demo...
function txtPhone1_OnKeyPress(obj,e)
{
    var keyAscii=e.keyCode;
    if (pKeyPressNumeric(keyAscii)==0)
    {
        e.keyCode=0;
        return;
    }
}
function Control1_OnKeyUp()
{
    if(event.keyCode==13)
        cmdSubmit1_OnClick();
}
function cmdReset1_OnClick()
{
    document.getElementById('txtError').value='';
    document.getElementById('txtName1').value='';
    document.getElementById('txtCompanyName1').value='';
    document.getElementById('txtEmail1').value='';
    document.getElementById('txtPhone1').value='';
}
function cmdSubmit1_OnClick()
{
    if(fnValidRecordForFreeDemo()==false)
    {
        document.getElementById('txtError').value='';
        return false;
    }
    else
    {
        document.getElementById('txtError').value='SubmitForFreeDemo';
		return true;
	}
}
function fnValidRecordForFreeDemo()
{
    var txtName1=document.getElementById('txtName1');
    if(Trim(txtName1.value)=='')
    {
        alert('Name can not be blank');
        txtName1.focus();
        return false;
    }
 
    var txtCompanyName1=document.getElementById('txtCompanyName1');
    if(Trim(txtCompanyName1.value)=='')
    {
        alert('Company name can not be blank');
        txtCompanyName1.focus();
        return false;
    }

    var strEmail1=Trim(document.getElementById('txtEmail1').value);
    if(strEmail1=='')
    {
        alert('E-Mail cannot be blank.');
        document.getElementById('txtEmail1').focus();
        return false;
    }
    if(fnValidEmail(strEmail1)==false)
    {
        alert('Enter a valid e-mail id.');
        document.getElementById('txtEmail1').focus();
        return false;
    }  

    var txtPhone1=document.getElementById('txtPhone1');
    if(Trim(txtPhone1.value)=='')
    {
        alert('Phone number can not be blank.');
        txtPhone1.focus();
        return false;
    }
    
    return true;
}

//Validation & Code For Quick Tour...
function txtPhone2_OnKeyPress(obj,e)
{
    var keyAscii=e.keyCode;
    if (pKeyPressNumeric(keyAscii)==0)
    {
        e.keyCode=0;
        return;
    }
}
function Control2_OnKeyUp()
{
    if(event.keyCode==13)
        cmdSubmit2_OnClick();
}
function cmdReset2_OnClick()
{
    document.getElementById('txtError').value='';
    document.getElementById('txtName2').value='';
    document.getElementById('txtCompanyName2').value='';
    document.getElementById('txtEmail2').value='';
    document.getElementById('txtPhone2').value='';
}
function cmdSubmit2_OnClick()
{
    if(fnValidRecordForQuickTour()==false)
    {
        document.getElementById('txtError').value='';
        return false;
    }
    else
    {
        document.getElementById('txtError').value='SubmitForQuickTour';
        return true;
    }
}
function fnValidRecordForQuickTour()
{
    var txtName2=document.getElementById('txtName2');
    if(Trim(txtName2.value)=='')
    {
        alert('Name can not be blank');
        txtName2.focus();
        return false;
    }
 
    var txtCompanyName2=document.getElementById('txtCompanyName2');
    if(Trim(txtCompanyName2.value)=='')
    {
        alert('Company name can not be blank');
        txtCompanyName2.focus();
        return false;
    }

    var strEmail2=Trim(document.getElementById('txtEmail2').value);
    if(strEmail2=='')
    {
        alert('E-Mail cannot be blank.');
        document.getElementById('txtEmail2').focus();
        return false;
    }
    if(fnValidEmail(strEmail2)==false)
    {
        alert('Enter a valid e-mail id.');
        document.getElementById('txtEmail2').focus();
        return false;
    }  

    var txtPhone2=document.getElementById('txtPhone2');
    if(Trim(txtPhone2.value)=='')
    {
        alert('Phone number can not be blank.');
        txtPhone2.focus();
        return false;
    }
    
    return true;
}

//Validation & Code For DemoTab...
function txtPhone3_OnKeyPress(obj,e)
{
    var keyAscii=e.keyCode;
    if (pKeyPressNumeric(keyAscii)==0)
    {
        e.keyCode=0;
        return;
    }
}
function Control3_OnKeyUp()
{
    if(event.keyCode==13)
        cmdSubmit3_OnClick();
}
function cmdReset3_OnClick()
{
    document.getElementById('txtError').value='';
    document.getElementById('txtName3').value='';
    document.getElementById('txtCompanyName3').value='';
    document.getElementById('txtEmail3').value='';
    document.getElementById('txtPhone3').value='';
}
function cmdSubmit3_OnClick()
{
    if(fnValidRecordForDemo()==false)
    {
        document.getElementById('txtError').value='';
        return false;
    }
    else
    {
        document.getElementById('txtError').value='SubmitForDemo';
        return true;
    }
}
function fnValidRecordForDemo()
{
    var txtName3=document.getElementById('txtName3');
    if(Trim(txtName3.value)=='')
    {
        alert('Name can not be blank');
        txtName3.focus();
        return false;
    }
 
    var txtCompanyName3=document.getElementById('txtCompanyName3');
    if(Trim(txtCompanyName3.value)=='')
    {
        alert('Company name can not be blank');
        txtCompanyName3.focus();
        return false;
    }

    var strEmail3=Trim(document.getElementById('txtEmail3').value);
    if(strEmail3=='')
    {
        alert('E-Mail cannot be blank.');
        document.getElementById('txtEmail3').focus();
        return false;
    }
    if(fnValidEmail(strEmail3)==false)
    {
        alert('Enter a valid e-mail id.');
        document.getElementById('txtEmail3').focus();
        return false;
    }  

    var txtPhone3=document.getElementById('txtPhone3');
    if(Trim(txtPhone3.value)=='')
    {
        alert('Phone number can not be blank.');
        txtPhone3.focus();
        return false;
    }
    
    return true;
}