var ALERT_TITLE = "Oops!";
var ALERT_BUTTON_TEXT = "Ok";

if(document.getElementById) {
	window.alert = function(txt) {
		createCustomAlert(txt);
	}
}

function createCustomAlert(txt) {
	d = document;

	if(d.getElementById("modalContainer")) return;

	mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
	mObj.id = "modalContainer";
	mObj.style.height = d.documentElement.scrollHeight + "px";
	
	alertObj = mObj.appendChild(d.createElement("div"));
	alertObj.id = "alertBox";
	if(d.all && !window.opera) alertObj.style.top = document.documentElement.scrollTop + "px";
	alertObj.style.left = (d.documentElement.scrollWidth - alertObj.offsetWidth)/2 + "px";
	alertObj.style.visiblity="visible";

	h1 = alertObj.appendChild(d.createElement("h1"));
	h1.appendChild(d.createTextNode(ALERT_TITLE));

	msg = alertObj.appendChild(d.createElement("p"));
	msg.appendChild(d.createTextNode(txt));

	btn = alertObj.appendChild(d.createElement("a"));
	btn.id = "closeBtn";
	btn.appendChild(d.createTextNode(ALERT_BUTTON_TEXT));
	btn.href = "#";
	alertObj.focus();
	btn.onclick = function() { removeCustomAlert();return false; }

	alertObj.style.display = "block";
	
}

function removeCustomAlert() {
	document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));
}


function checkformdetails()

{

	var strmessage="";

	if (document.getElementById('ele_username').value=="")
	{	
		strmessage+=" - Username                                                                                   ";
	}

	if (document.getElementById('ele_password').value=="")
	{
		strmessage+="- Password                                                                                    ";
	}

	if (strmessage=="")
	{
		return true;
	}

	else
	{   
		alert("The following fields are required:                          "+strmessage);
		return false;
	}
}





function checknewuserdetails()

{

	var strmessagea="";

	if (document.getElementById('username').value=="")
	{	
		strmessagea+=" - Username                                                      ";
	}
	
	if (document.getElementById('handle').value=="")
	{	
		strmessagea+=" - Handle                                                        ";
	}
	
	if (document.getElementById('email').value=="")
	{	
		strmessagea+=" - Email Address                                                 ";
	}

	if (document.getElementById('password1').value=="")
	{
		strmessagea+="- Password                                                       ";
	}

	if (document.getElementById('password2').value=="")
	{
		strmessagea+="- Password (Confirm)                                             ";
	}
	
	if (document.getElementById('location').value=="")
	{
		strmessagea+="- Location                                                       ";
	}

	if (document.getElementById('sex').value=="")
	{
		strmessagea+="- Sex (Gender)                                                   ";
	}
	
	if (document.getElementById('bd_day').value=="")
	{
		strmessagea+="- Birth Day                                                      ";
	}

	if (document.getElementById('bd_month').value=="")
	{
		strmessagea+="- Birth Month                                                    ";
	}
	
	if (document.getElementById('bd_year').value=="")
	{
		strmessagea+="- Birth Year                                                     ";
	}

	if (strmessagea=="")
	{
		return true;
	}

	else
	{   
		alert("The following fields are required:                          "+strmessagea);
		return false;
	}
}





               