function revealModal_tellFriend(divID)
{
    document.getElementById(divID).style.display = "block";
    document.getElementById(divID).style.top = document.body.scrollTop;
    
    
    //initialize
    document.getElementById('toemail_tellFriend1').value = '';
    document.getElementById('toemail_tellFriend2').value = '';
    document.getElementById('toemail_tellFriend3').value = '';
    document.getElementById('toemail_tellFriend4').value = '';
    document.getElementById('toemail_tellFriend5').value = '';
    
    document.getElementById('toname_tellFriend1').value = '';
    document.getElementById('toname_tellFriend2').value = '';
    document.getElementById('toname_tellFriend3').value = '';
    document.getElementById('toname_tellFriend4').value = '';
    document.getElementById('toname_tellFriend5').value = '';
    document.getElementById('replaceme_tellFriend').innerHTML = '';
    document.getElementById('sackdata_tellFriend').innerHTML = '';
    document.getElementById('captcha').value = '';
    new_captcha('2');
}

function doit_tellFriend(){
	var form = document.getElementById('sbm_story_tellFriend');
	form.action = '/submit_tellFriend.php';
	
	var strto = '';
	var strtoemail = '';
	var strcaptcha = '';
	var strshortmsg = '';
	var strSid = '';
	
	
	strtoemail1 = form.toemail_tellFriend1.value;
  strtoemail2 = form.toemail_tellFriend2.value;
  strtoemail3 = form.toemail_tellFriend3.value;
  strtoemail4 = form.toemail_tellFriend4.value;
  strtoemail5 = form.toemail_tellFriend5.value;
  
  strtoname1 = form.toname_tellFriend1.value;
  strtoname2 = form.toname_tellFriend2.value;
  strtoname3 = form.toname_tellFriend3.value;
  strtoname4 = form.toname_tellFriend4.value;
  strtoname5 = form.toname_tellFriend5.value;
  
  strcsid = form.csid.value;
	strCaptcha = form.captcha.value;
	
	
	clear_ajax_vars()
    ajax.setVar("csid", strcsid);
  	ajax.setVar("toemail_tellFriend[1]", strtoemail1); 
    ajax.setVar("toemail_tellFriend[2]", strtoemail2); 
    ajax.setVar("toemail_tellFriend[3]", strtoemail3); 
    ajax.setVar("toemail_tellFriend[4]", strtoemail4); 
    ajax.setVar("toemail_tellFriend[5]", strtoemail5); 
    
    ajax.setVar("toname_tellFriend[1]", strtoname1); 
    ajax.setVar("toname_tellFriend[2]", strtoname2); 
    ajax.setVar("toname_tellFriend[3]", strtoname3); 
    ajax.setVar("toname_tellFriend[4]", strtoname4); 
    ajax.setVar("toname_tellFriend[5]", strtoname5); 
    
  	
  	ajax.setVar("captcha", strCaptcha); 
  	
  
	ajax.requestFile = "/submit_tellFriend.php";
	ajax.method = 'post';
	ajax.element = 'replaceme_tellFriend';
	ajax.onCompletion = whenCompleted_tellFriend;
	ajax.runAJAX();	
}

function whenCompleted_tellFriend(){
	var e_r = document.getElementById('tellFriend_return'); 
  
  if(e_r.value == '1') {
  }
  else {
	hideModal('tellFriend_modalPage');
  }
}
function clear_ajax_vars()
{
ajax = new sack();
}
