function swapimg(obj)
{
  var strsrc = obj.src;
  if (strsrc.indexOf("_off") != -1)
    {
	    var new_src = strsrc.split("_off")[0]+"_on.gif";
		obj.src = new_src;
    }
  else
	{
        var new_src = strsrc.split("_on")[0]+"_off.gif";
		obj.src = new_src;

	}

}


function checkEmail(str)
{
	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);
	if (str.indexOf(at)==-1)
	{
		alert('Invalid Email Address!\nPlease enter your email address again');
		return false;
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
	{
		alert('Invalid Email Address!\nPlease enter your email address again');
		return false;
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
	{
		alert('Invalid Email Address!\nPlease enter your email address again');
		return false;
	}
	if (str.indexOf(at,(lat+1))!=-1)
	{
		alert('Invalid Email Address!\nPlease enter your email address again');
		return false;
	}
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
	{
		alert('Invalid Email Address!\nPlease enter your email address again');
		return false;
	}
	if (str.indexOf(dot,(lat+2))==-1)
	{
		alert('Invalid Email Address!\nPlease enter your email address again');
		return false;
	}
	if (str.indexOf(" ")!=-1)
	{
		alert('Invalid Email Address!\nPlease enter your email address again');
		return false;
	}
	return true;
}

function CheckForm(form)
{
	if (form.Name.value == '')
	{
		alert('The following information is required\nYour Name is missing');
		form.Name.focus();
		return false;
	}
	if (checkEmail(form.Email.value) == '')
	{
		alert('The following information is required\nYour Email is missing');
		form.Email.focus();
		return false;
	}
	if (form.FrdName.value == '')
	{
		alert('The following information is required\nYour Friend\'s name is missing');
		form.FrdName.focus();
		return false;
	}
	if (checkEmail(form.FrdEmail.value) == '')
	{
		alert('The following information is required\nYour Friend\'s Email is missing');
		form.FrdEmail.focus();
		return false;
	}
	return true;
}


function disp_confirm(form)
{

	if (CheckForm(form) == true)
	{
		var r=confirm("You are about to forward information about this website to your friend.\n\nDo you wish to proceed?");
		if (r==true)
		{
			return true;
		}
	}
	return false;
}
