
var email_filter=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var num_filter =/^([0-9])[0-9\-_\.\s]{2,}$/;



function clicksponsor()
{
		if(document.getElementById("pop_confirm") && (document.getElementById("pop_confirm").style.display == '') || (document.getElementById("pop_confirm").style.display == 'none')){
			alert("Please select a child to sponsor.");
			document.getElementById('div01').style.display = 'block';
			return false;
		}

}



function validate()
{
	
    if (! (document.forms.donateform.Title[0].checked || 

document.forms.donateform.Title[1].checked || 

document.forms.donateform.Title[2].checked || 

document.forms.donateform.Title[3].checked)) {
        alert ('Please choose the Title.');
        document.forms.donateform.Title[0].focus();
        return false;
    }
    if(!(document.forms.donateform.FName.value.length > 1))
	{
        alert ('Please type your First Name.');
        document.forms.donateform.FName.focus();
        return false;
    }
    if(!(document.forms.donateform.LName.value.length > 1))
	{
        alert ('Please type your Last Name.');
        document.forms.donateform.LName.focus();
        return false;
    }
    if (!email_filter.test(document.forms.donateform.Email.value)) 
	{
        alert ('Invalid Email ID. Please Rectify.');
        document.forms.donateform.Email.focus();
        return false;
    }
    if (! (document.forms.donateform.Add1.value.length > 3)) 
	{
        alert ('Please type your Address.');
        document.forms.donateform.Add1.focus();
        return false;
    }
    if (! (document.forms.donateform.City.value.length > 3))
	 {
        alert ('Please type your City.');
        document.forms.donateform.City.focus();
        return false;
    }
    if (! (document.forms.donateform.State.value.length > 3))
	{
        alert ('Please type your State.');
        document.forms.donateform.State.focus();
        return false;
    }
    if (! ((document.forms.donateform.Tel_R.value.length + document.forms.donateform.Mobile.value.length) > 3))
	{
        alert ('Please give at least one number. Telephone or Mobile is mandatory.');
        document.forms.donateform.Tel_R.focus();
        return false;
    }
    if (!num_filter.test(document.forms.donateform.Tel_R.value) && (document.forms.donateform.Tel_R.value.length))
	{
        alert ('Please input a valid Telephone number.');
        document.forms.donateform.Tel_R.focus();
        return false;
    }
    if (!num_filter.test(document.forms.donateform.Mobile.value )&& (document.forms.donateform.Mobile.value.length)>1)
	{
        alert ('Please input a valid mobile number.');
        document.forms.donateform.Mobile.focus();
        return false;
    }
    if (!(document.forms.donateform.FC[0].checked || document.forms.donateform.FC[1].checked))
	{
        document.forms.donateform.FC[0].focus();
        alert ('We need your Nationality for FCRA compliance with Govt.of India.');
        return false;
    }
    if (!(document.forms.donateform.PG[0].checked || document.forms.donateform.PG[1].checked || document.forms.donateform.PG[2].checked)) 	  {
        document.forms.donateform.PG[1].focus();
        alert ('Please choose your mode of payment.');
        return false;
    }
}
function popwin()
{
	if(window.screenTop>10000)
	{
window.open("./popupwindow.php", "_wv","directories=0, height=250, width=300, scrollbars=no, left=10, top=200");
}}

function popsamewindow(url)
{

	var newwindow=window.open(url,'name',"directories=0, height=630, width=800, scrollbars=yes");
	if (window.focus) {newwindow.focus()}

}
function showamt()
{
	document.getElementById("displayamt").innerHTML='Rs.'+document.getElementById("sponamt").value*600+'/-';
}

function pop_pj(pcode)
{
	window.open("/ecom/prjdetails.php?pcode="+pcode, "_wv","directories=0, height=350, width=450, scrollbars=no, left=150, top=100");
}
