function send_openPopup(strLang)
{
	//window.open(getLocationPath() + 'Shared/UserControls/SendToFriend/PopUp.aspx?lang=' + strLang,'sendToFrient','top=190,left=30,height=340,width=331,scrollbars=no,toolbar=no');
	window.open('/Shared/UserControls/SendToFriend/PopUp.aspx?lang=' + strLang,'sendToFrient','top=190,left=30,height=340,width=331,scrollbars=no,toolbar=no');
}
			
var send_Message = new Object();
send_Message.EmptyMail = "";	
send_Message.InvalidChars = "";	
send_Message.TooManyStrudel = "";	
send_Message.NoStrudel = "";	
send_Message.NoDot = "";	
send_Message.LastCharIsDot = "";	
send_Message.TwoDots = "";	
			
function send_isnull(arg) 
{
	arg = arg+'';
	return (arg == '' || arg == 'null' || arg == 'undefined');
}
			
function send_checkForm()
{
	var bCheckMail = false;
	bCheckMail = send_checkEmail(frmEmail.item("txtSenderMail").value);
	if (bCheckMail != true){
		alert(bCheckMail);
		frmEmail.item("txtSenderMail").focus();
		return;
	}
	bCheckMail = send_checkEmail(frmEmail.item("txtReciverMail").value);
	if (bCheckMail != true){
		alert(bCheckMail);
		frmEmail.item("txtReciverMail").focus();
		return;
	}

	document.frmEmail.txtParentLocation.value = window.opener.location;
	document.frmEmail.btnSend.click();
}

function send_checkEmail(email)
{
	var atPos = email.indexOf("@",1)
	var invalidChars = " /:;,"

	if(send_isnull(email)){ //email cannot be empty
		return(send_Message.EmptyMail);
	}
	
	for(var i=0; i<invalidChars.length; i++){
		badChar = invalidChars.charAt(i)
		if(email.indexOf(badChar,0) != -1){ //email cannot be invalid chars
			return (send_Message.InvalidChars);
		}
	}
	
	if((email.indexOf("@")) != (email.lastIndexOf("@"))){ //email must be one "@" symbol
		return (send_Message.TooManyStrudel);
	}
	
	if(email.indexOf("@") == -1){ //check if there is "@" symbol in the email
		return (send_Message.NoStrudel);
	}
	
	if((email.indexOf(".")) == -1){ //check if there is "." symbol in the email
		return (send_Message.NoDot);
	}
						
	if(email.lastIndexOf(".") == (email.length -1)){ //check if the "." is the last in the email
		return (send_Message.LastCharIsDot);
	}
	
	if(email.indexOf("..") != -1){ // check if the isn't two dots in 
		return (send_Message.TwoDots);
	}

	return true;
	
}

function send_resetDoc()
{
	document.all('txtSenderMail').value	= "";
	document.all('txtReciverMail').value = "";
	document.all('txtDesc').innerHTML = "";
	document.all('txtSenderMail').focus();
}

