// Created: 2004-03-24
// Author Algirdas Noreika
// e-mail: alnor@delfi.lt

//-----------------------------------------------------------------------
// fnAddBookmark() - Adds a bookmark.
function fnAddBookmark(title,url){ 
	if (document.all) window.external.AddFavorite(url,title); 
}

//-----------------------------------------------------------------------
// Open Tell A Friend.
function fnTAF(sID, sMSGTitle, sURL) {
	oDiv = document.getElementById(sID);
	if (oDiv != null) {
		if(window.document.body.clientWidth || window.document.body.clientHeight) {
			oDiv.style.left = window.document.body.scrollLeft + window.document.body.clientWidth / 2 - oDiv.offsetWidth / 2;
			oDiv.style.top = window.document.body.scrollTop + window.document.body.clientHeight / 2 - oDiv.offsetHeight / 2;
		} else {
			oDiv.style.left = 20;
			oDiv.style.top = 20;
		}
	} else {
		oDiv = window.document.createElement("DIV");
		oDiv.style.position="absolute";
		oDiv.style.padding = "1px";
		oDiv.style.visibility = "hidden";
		oDiv.style.border = "0px";
		oDiv.id = sID;
		oDiv.style.left = 20;
		oDiv.style.top = 20;
		
		oDiv.innerHTML = "<table style=\"border:1px solid #333333\" class=\"cDWTitleBar\" cellspacing=\"0\">"+
		"<tr><td style=\"padding:1px;height:1px;border-bottom:1px solid #333333;\">"+
		"&#160;<b>Tell your friend about mindsOCEAN.com !</b>"+
		"</td>"+
		"<td align=\"right\" valign=\"top\" style=\"border-bottom:1px solid #333333;\">"+
		"<table height=\"1px\" width=\"1px\" cellspacing=\"1\" onclick=\"oDiv = document.getElementById('"+sID+"'); window.document.body.removeChild(oDiv);\"><tr><td style=\"padding:2px;background-color:#BBBBBB;border:1px solid #939393;font:10px Verdana;color:#000000;\" onmouseover=\"this.style.cursor='default';\"><b>X</b></td></tr></table>"+
		"</td>"+
		"</tr>"+
		"<tr>"+
		"	<td colspan=\"2\" style=\"background-color:#EFEFEF;padding:1px 1px 1px 1px\" align=\"left\" valign=\"top\">"+
			"<form method='post' style='margin:0px;'>"+
			"<input type='hidden' name='ihTitle' value='" + sMSGTitle + "'>"+
			"<input type='hidden' name='ihURL' value='" + sURL + "'>"+
			"<input type='hidden' name='ihSubmitTAF' value='1'>"+
			"<table width='100%' height='100%' class='cText'>"+
			"<tr><td align='right'><nobr>Your name:</nobr></td><td><input type='text' name='itName'></td></tr>"+
			"<tr><td align='right'><nobr>Your e-mail:</nobr></td><td><input type='text' name='itEmail' id='idYEML'></td></tr>"+
			"<tr><td align='right'><nobr>Friend`s name:</nobr></td><td><input type='text' name='itFName'></td></tr>"+
			"<tr><td align='right'><nobr>Friend`s e-mail:</nobr></td><td><input type='text' name='itFEmail' id='idFEML'></td></tr>"+
			"<tr><td colspan='2' align='right'><input type='button' value='Submit' onclick='if(fnIsEmail(\"idYEML\") && fnIsEmail(\"idFEML\")) form.submit(); else alert(\"Incorrect e-mail(s).\");'></td></tr>"+
			"</table>"+
			"</form>"+
		"   </td>"+
		"</tr>"+
		"</table>";
		window.document.body.appendChild(oDiv);
		
		if(window.document.body.clientWidth || window.document.body.clientHeight) {
			oDiv.style.left = window.document.body.scrollLeft + window.document.body.clientWidth / 2 - oDiv.offsetWidth / 2;
			oDiv.style.top = window.document.body.scrollTop + window.document.body.clientHeight / 2 - oDiv.offsetHeight / 2;
		} else {
			oDiv.style.left = 20;
			oDiv.style.top = 20;
		}
		oDiv.style.visibility = "visible";
	}
	
}

//-----------------------------------------------------------------------
// Checks if e-mail is correct.
function fnIsEmail(objID) {
	oIT = window.document.getElementById(objID);
	if (oIT.value.match(/^[a-z0-9_-]+@[\.a-z0-9-]+\.[a-z]+$/i)) {
		return true;
	}
return false;
}