function toggleDiv(x, divShort, divLong)
{
	var divShortText = document.getElementById(divShort);
	var divLongText = document.getElementById(divLong);

	if(x==0)
	{
		divShortText.style.display = "block";
		divLongText.style.display = "none";
	}

	else
	{
		divShortText.style.display = "none";
		divLongText.style.display = "block";
	}
}


whitespace = "\t \n\r";
function isEmptyString(s)
{
   	var i;
  	if((s == null) || (s.length == 0)) return true;
  	for(i=0;i < s.length;i++)
  	{
  		var currchar = s.charAt(i);
  		if(whitespace.indexOf(currchar) == -1) return false;
  	}
    return true;

}

function isEmail(n)
{
	if ((n==null) || (n.length==0))
	{
		return true;
	}

	if (isEmptyString(n)) return false;

	var i=1;
	var nLength=n.length;
	while((parseInt(i) < parseInt(nLength)) && (n.charAt(parseInt(i)) != '@'))
	{
		i++;
	}

	if ((parseInt(i) >= parseInt(nLength)) || (n.charAt(i)!="@"))
	{
		return false;
	}
	else i+=2;

	while((i<nLength) && (n.charAt(i)!="."))
	{
		i++;
	}

	if ((i>=nLength-1) || (n.charAt(i)!="."))
	{
		return false;
	}
	else return true;
}


function check_raf_Frm(theForm)
{
	if(isEmptyString(theForm.friend_email.value))
	{
		alert("Please provide Friends Email.");
		theForm.friend_email.focus();
		return false;
	}

	if(!isEmail(theForm.friend_email.value))
	{
		alert("Please check the format for Friends Email.");
		theForm.friend_email.focus();
		return false;
	}

	if(isEmptyString(theForm.sender_name.value))
	{
		alert("Please provide Your Name.");
		theForm.sender_name.focus();
		return false;
	}

	if(isEmptyString(theForm.sender_email.value))
	{
		alert("Please provide Your Email.");
		theForm.sender_email.focus();
		return false;
	}

	if(!isEmail(theForm.donor_email.value))
	{
		alert("Please check the format for Your Email.");
		theForm.donor_email.focus();
		return false;
	}

	return true;
}

