
function pp(p)
{
	document.getElementById(p).style.fontWeight="Bold";
};

function pp2(p)
{
	document.getElementById(p).style.fontWeight="normal";
};

function chkreg(p)
{
var hash;
var cook;
cook=getCookie('tntcon');
hash = String(document.comForm.verif_box.value);
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;


with(document.comForm)
{
	if (name.value == "")
	{
		alert("Input the Name!");
		name.focus();
	}
	else
	{
		if (address.value == "")
		{
			alert("Input the Address!");
			address.focus();
		}
		else
		{
			if (email.value == "")
			{
				alert("Input Your Email!");
				email.focus();
			}
			else
			{
				if (!filter.test(email.value)) 
				{
					alert('Please provide a valid email address');
					email.focus();
				}
				else
				{
					if (verif_box.value == "")
					{
						alert("Input the Verification Number!");
						verif_box.focus();
					}
					else
					{
						if(hex_md5(hash) + 'a4xn' != cook)
						{
							alert("Wrong Verification Number!");
							verif_box.focus();
						}
						else	
						{
							var parameters="name="+name.value+"&address="+address.value+"&email="+email.value+"&PHPSESSID="+p;
							var datasource = "register2.php";
							var divid = "news";
							getreg(datasource,parameters,divid);
						};
					};
				};	
			};
		};
	};
};
};

function getreg(datasource,parameters,divid)
{
	var XMLHttpRequestObject=false;
	if (window.XMLHttpRequest)
	{
		XMLHttpRequestObject = new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		XMLHttpRequestObject=new ActiveXObject("Microsoft.XMLHTTP");
	};
	
	if (XMLHttpRequestObject)
	{
		XMLHttpRequestObject.open("POST",datasource,true);
		XMLHttpRequestObject.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		
		XMLHttpRequestObject.send(parameters);
		
		XMLHttpRequestObject.onreadystatechange = function()
		
		{	
			if(XMLHttpRequestObject.readyState < 4)
			
			{
				
				document.getElementById(divid).innerHTML="<p align='center' style='font-family:arial; font-size:14px;color:grey'><img src='images/loader.gif' /><br /><br />Please Wait Loading.........</p>";
			};
			
			if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200)
			{
				var newlines = XMLHttpRequestObject.responseText;

     			if(newlines != "")

       			{ 
					if(newlines == "<p align='center' style='margin-top:40px;font-family:arial; font-size:14px; color:#336666'><img src='images/cross.png' style='margin-right:4px' />Email Account Already Exist! Fail to Register!</p>")
					{
	 					document.getElementById(divid).innerHTML="<center>"+newlines+"</center>";
					}
					else
					{
						document.getElementById(divid).innerHTML="<p alighn='center' style='margin-top:40px;font-family:arial; font-size:14px; color:#336666'><img src='images/ok.png' style='margin-right:4px' />Thank You For the Registration!</p>";
						document.getElementById("tot").innerHTML="<p style='font-size:11px; color:#FFFFFF;margin-left:15px; margin-bottom:7px; margin-top:2px'><img src='images/acct.png' style='margin-right:4px' />Total Members "+ newlines + "</p>";
					};
										
				};

			};
			
		};
		
	};
};



function chkyurnews()
{
var passed=false;

with(document.yurnews)
{
	if (name.value == "")
	{
		alert("Input the Name!");
		name.focus();
	}
	else
	{
		if (address.value == "")
		{
			alert("Input the Address!");
			address.focus();
		}
		else
		{
			if (email.value == "")
			{
				alert("Input Your Email!");
				email.focus();
			}
			else
			{
				if (piclink.value == "")
				{
					alert("Input the Pic!");
					piclink.focus();
				}
				else
				{
					if (verif_box.value == "")
					{
						alert("Input the Verification!");
						verif_box.focus();
					}
					else
					{
						if (comments.value == "")
						{
							alert("Input Your Comments!");
							comments.focus();
						}
						else	
						{
						
							passed=true;
						
						};
					};
				};
			};
		};
	};
};
return passed;
};


