function fillContact(id)
{
	var selObj = document.getElementById('contact_'+id);
	var txtValueObj = document.getElementById('recip_email_'+id);
	var txtTextObj = document.getElementById('recip_name_'+id);
	
	var selIndex = selObj.selectedIndex;
	txtValueObj.value = selObj.options[selIndex].value;
	txtTextObj.value = selObj.options[selIndex].text;
	selObj.blur();

}

function changeBg()
{
	var newBg = document.getElementById('bg_color').value;
	tinyMCE.getInstanceById('message').dom.setStyle('tinymce','background-color', newBg)
	document.getElementById('bg_color').blur();
}

function doPoem()
{
	var poem_box = document.getElementById('poem_changer');
	var poem_id = poem_box.selectedIndex;
	var poem_body = poem_box.options[poem_id].value;

	poem_box.selectedIndex=0;
	poem_box.blur();

	var current_body = tinyMCE.activeEditor.getContent();
	var new_body = current_body + poem_body;

	tinyMCE.activeEditor.setContent(new_body);
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function CUA(ch) {
var v = ch.checked;
var f = ch.form;
for(var i=0;i<f.elements.length;i++) {
    if(f.elements[i].type=="checkbox") {
       f.elements[i].checked = v; 
     }
}
}

var xmlhttp;

function findEvent(year,mon,day)
{
document.getElementById("calendar_data").innerHTML="";
xmlhttp=GetEventXmlHttpObject()
if (xmlhttp==null)
  {
  alert ("Your browser does not support XML HTTP Request");
  return;
  }
var url="index.php?act=cal_data";
url=url+"&year="+year;
url=url+"&mon="+mon;
url=url+"&day="+day;
xmlhttp.onreadystatechange=stateChanged ;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateChanged()
{
if (xmlhttp.readyState==4)
  {
document.getElementById("calendar_data").innerHTML=xmlhttp.responseText;
  }
}

function GetEventXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}

function fillDate(dVal)
{
	opener.document.forms['main_form'].send_date_box.value = dVal;
	window.close();
}



function delContact(id)
{
xmlHttp=GetContXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }        
var url="index.php";
url=url+"?act=contacts&what=del_single";
url=url+"&id="+id;
xmlHttp.onreadystatechange=contStateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);

document.getElementById(id).style.backgroundColor='red';
setTimeout("document.getElementById("+id+").style.display='none';", 300);

} 

function contStateChanged()
{ 
if (xmlHttp.readyState==4)
   {
/*
alert('Done');
   document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
*/
   }
}

function GetContXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function hideAll()
{
	document.getElementById('google_details').style.display='none'
	document.getElementById('live_details').style.display='none'
	document.getElementById('yahoo_details').style.display='none'
	document.getElementById('csv_details').style.display='none'
}
