function closeResSpe() {
  new Effect.Fade('overlay1', { duration: 0.5}); 
  $('ResSpe').remove();
}
function SendToFriends(rid) { 
	var objBody = document.getElementsByTagName("body").item(0);
	var objOverlay = document.createElement("div");
	objOverlay.setAttribute('id','overlay1');
	objOverlay.style.display = 'none';
	objOverlay.onclick = closeResSpe
	objBody.appendChild(objOverlay);
	
	var aPageSize = getPageSize();
	Element.setWidth('overlay1', aPageSize[0]);
	Element.setHeight('overlay1', aPageSize[1]);
	new Effect.Appear('overlay1', { duration: 1.0, from: 0.0, to: 0.5 });

	var aoll = getPageScroll();
	var aTop = aoll[1] + (aPageSize[3] / 10);
	var aLeft = aoll[0] + (aPageSize[0] / 2 - 250);
	var datacont = document.createElement("div");
	datacont.setAttribute('id','ResSpe');
	objBody.appendChild(datacont);
	$('ResSpe').setStyle({position:'absolute',backgroundColor:'#FFFFFF',width:'450px', height:'250px',top:aTop+'px',left:aLeft+'px',zIndex:100});
	datacont.innerHTML = '<div style="border:5px solid #4A5A7A; width:450px;"><div id="header" style="width:450px; height:22px; background-color:#4A5A7A"><div style="float:left; font-weight:bold;font-size:15px; color:#FFFFFF;">Send to Your Friend(s)</div><div style="float:right;"><span style="cursor:pointer; font-weight:bold;font-size:15px; color:#FFFFFF" onclick="javascript:closeResSpe();">CLOSE (X)</span></div></div><div id="ContainerDiv" style="height:200px; background-color:#F5F5F5;text-align:left;padding:4px;color:#000000;"><table  style="width:448px;" border="0" cellspacing="2" cellpadding="2"><tr><td width="104"><label><strong>Your Name:</strong></label></td><td colspan="2"><input type="text" name="SenderName" id="SenderName" class="textbox" style="width:150px;" /></td></tr><tr><td><label><strong>Your E-Mail:</strong></label></td><td colspan="2"><input type="text" name="SenderEmail" id="SenderEmail" class="textbox" style="width:150px;" /></td></tr><tr><td valign="top"><label><strong>Your Friend\'s E-mail:</strong>:</label></td><td width="145" valign="top"><input type="text" name="receipents" id="receipents" class="textbox" style="width:150px;" />&nbsp;</td><td width="179" valign="top">Use comma (,) for <br />multiple email addresses</td></tr><tr><td colspan="3"><strong>Comments</strong></td></tr><tr><td colspan="3"><textarea name="comments" id="comments" cols="50" rows="3" class="textbox" style="width:420px;height:60px;"></textarea></td></tr><tr><td colspan="3" align="center"><input type="button" value="Send Now &raquo;" name="SendNow" id="SendNow" onClick="javascript:sendToFriendNow(); return false;" class="button1" /></td></tr></table></div><div id="pFooter" style="height:16px; background-color:#4A5A7A" align="center"><span style="cursor:pointer; font-weight:bold;font-size:15px;color:#FFFFFF;" onclick="javascript:closeResSpe();">CLOSE X</span></div></div>';
}

/*_--------------------------------------------------------------------------_*/

function sendToFriendNow() {
 if ( ($('SenderName').value == '') || ($('SenderEmail').value == '') || ($('receipents').value == '') || ($('comments').value == ''))	{
	alert('Required Value Missing. Please Fill Up all the Field And Try Again.');
	return false;
 }
 var emailchar = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
 if (!emailchar.test($('SenderEmail').value) ) {
	alert('Invalid E-Mail Address Given.');
	return false;
 }
 // check receipent email
 var rece = $('receipents').value.split(',');
 for (i = 0; i < rece.length; i++ ) {
	 if (!emailchar.test(rece[i]) ) {
		alert('Invalid E-Mail Address Given for Receipents.');
		return false;
	 }
 }
 var parms = 'SenderName='+$('SenderName').value+'&SenderEmail='+$('SenderEmail').value+'&receipents='+$('receipents').value+'&comments='+$('comments').value+'&url='+location.href;
 $('ContainerDiv').update('Sending To Your Friend(s). Please Wait....');
 new Ajax.Request('./sendEmailToFriends.php', {method: 'post', parameters: parms,  onComplete: function(e) { 
						  $('ContainerDiv').setStyle({backgroundColor:'#FFFFFF',color:'#000000'}).update(e.responseText); 
						}});

}
/*_--------------------------------------------------------------------------_*/

function BookMarkThis(url, resname) {
 var title = resname+" Reviews";
 var utitle = document.title;
 if (typeof utitle != 'undefined') {
	if (utitle != '') 
	   title = utitle;
 }
 if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite(url, title); 
	}
	else if(window.opera && window.print) { // Opera Hotlist
	  var mbm = document.createElement('a');
      mbm.setAttribute('rel','sidebar');
      mbm.setAttribute('href',url);
      mbm.setAttribute('title', title);
      mbm.click();
	}
}












