function echeck(email){

var str=document.getElementById(email).value

var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i

if (filter.test(str)) 
	return true;

else
	return false;
}
function changebackground()
{
document.getElementById("txtname").style.background = "#fff";
document.getElementById("organization").style.background = "#fff";
document.getElementById("city").style.background = "#fff";
document.getElementById("country").style.background = "#fff";
document.getElementById("mob").style.background = "#fff";
document.getElementById("phone").style.background = "#fff";
}

function changehomebackground()
{
document.getElementById("tname").style.background = "#fff";
document.getElementById("tcountry").style.background = "#fff";
document.getElementById("temail").style.background = "#fff";
document.getElementById("tphone").style.background = "#fff";
}
 
function validatefrm()
{
changebackground();
if(document.getElementById("txtname").value=="Name")
{
document.getElementById("txtname").focus();
document.getElementById("txtname").style.background = "pink";
return false;
}
if(document.getElementById("organization").value=="Organization")
{
document.getElementById("organization").focus();
document.getElementById("organization").style.background = "pink";
return false;
}
if(document.getElementById("city").value=="City")
{
document.getElementById("city").focus();
document.getElementById("city").style.background = "pink";
return false;
}
if(document.getElementById("country").value=="")
{
document.getElementById("country").focus();
document.getElementById("country").style.background = "pink";
return false;
}
if(document.getElementById("mob").value=="Mobile-No")
{
document.getElementById("mob").focus();
document.getElementById("mob").style.background = "pink";
return false;
}
if(document.getElementById("phone").value=="Phone-No")
{
document.getElementById("phone").focus();
document.getElementById("phone").style.background = "pink";
return false;
}
if (echeck('email')==false)
	{
		document.getElementById("email").focus();
		document.getElementById("email").style.background = "pink";
		return false
	}
if(document.getElementById("txtCaptcha").value=='')

{
document.getElementById("txtCaptcha").focus();
document.getElementById("txtCaptcha").style.background = "pink";
return false;

}
	
return true;
}


function textclear(a,b)
{
	if(document.getElementById(a).value==b)
	document.getElementById(a).value="";
}

function textchange(a,b)
{
	if(document.getElementById(a).value=="")
	{
	document.getElementById(a).value=b;
	}

}


function homevalidate()
{
	changehomebackground();
if(document.getElementById("tname").value=="Your Name")
{
document.getElementById("tname").focus();
document.getElementById("tname").style.background = "pink";
return false;
}
if(document.getElementById("tcountry").value=="Country")
{
document.getElementById("tcountry").focus();
document.getElementById("tcountry").style.background = "pink";
return false;
}
if (echeck('temail')==false)
	{
		document.getElementById("temail").focus();
		document.getElementById("temail").style.background = "pink";
		return false
	}
if(document.getElementById("tphone").value=="Your Tel./Mob. No.")
{
document.getElementById("tphone").focus();
document.getElementById("tphone").style.background = "pink";
return false;
}
return true;
}

function changecaptcha()
{
if(document.getElementById('imgCaptcha').name=='captcha')
	{
	document.getElementById('imgCaptcha').src='create_image1.php';
	document.getElementById('imgCaptcha').name='captcha1';
	}
	else
	{
	document.getElementById('imgCaptcha').src='create_image.php';
	document.getElementById('imgCaptcha').name='captcha';
	}
}

