// JavaScript Document
function send_all(mcid)
{
	//alert('pop');
	document.getElementById('show_process').style.display = "block";
	completeAHAH.ahah('../ajax.php?p=send_tolist&mc_id='+mcid, 'show_process', '', 'get','');	
	
}


function reset_all()
{
	//alert('pop');
	//document.getElementById('show_list').style.display = "none";
	completeAHAH.ahah('../ajax.php?p=reset_all', 'show_process', '', 'get','');
	
	//completeAHAH.ahah('../ajax.php?p=email_list', 'show_list', '', 'get','');
	
}

function check_username(fieldname)
{
	//alert('pop');
	document.getElementById(fieldname).style.display = "block";
	var uid = document.getElementById(fieldname).value ;
	document.getElementById('username_box').style.display = "block";
	completeAHAH.ahah('../ajax.php?p=check_username&uid='+uid, 'username_box', '', 'get','');	
	
}

function check_moremail(fieldname)
{
	//alert('pop');
	//document.getElementById(fieldname).style.display = "block";
	var uid = document.getElementById(fieldname).value ;
	//document.getElementById('username_box').style.display = "block";
	completeAHAH.ahah('../ajax.php?p=check_moremail&uid='+uid, 'new_email_box', '', 'get','');	
	
}

function check_valid_email(fieldname)
{
	//alert('pop');
	document.getElementById(fieldname).style.display = "block";
	var uid = document.getElementById(fieldname).value ;
	document.getElementById(fieldname+'_box').style.display = "block";
	completeAHAH.ahah('../ajax.php?p=check_email&uid='+uid, 'email_box', '', 'get','');	
	
}

function import_csv_loop(grid)
{

	completeAHAH.ahah('../ajax.php?p=import_csv_load&grid='+grid, 'import_loader', '', 'get','');	
	
}

function check_unbounce(fieldname,groupname)
{

	completeAHAH.ahah('../ajax.php?p=check_unbounce&em_id='+fieldname+'&mg_id='+groupname, 'unbounce_box'+fieldname, '', 'get','');
}

function check_activate(coid,orid)
{
	
	completeAHAH.ahah('../ajax_admin.php?p=check_activate&co_id='+coid+'&or_id='+orid, 'div_act'+orid, '', 'get','');
}

function check_delete(emid,mgid)
{
	
	completeAHAH.ahah('../ajax.php?p=check_delete&emid='+emid+'&mgid='+mgid, 'div_remove'+emid, '', 'get','');
}

function check_unsub(emid,mgid)
{
	
	completeAHAH.ahah('../ajax.php?p=check_unsub&emid='+emid+'&mgid='+mgid, 'div_remove'+emid, '', 'get','');
}


function toggle(id)
{

	var checkDisplay = document.getElementById(id).style.display;
	if(checkDisplay=='block')
	{
		document.getElementById(id).style.display='none';
	}
	else
	{
		document.getElementById(id).style.display='block';
	}

}


function enable_disable_user(coid,status)
{
		completeAHAH.ahah('../ajax_admin.php?p=enable_disable_user&co_id='+coid+'&status='+status, 'acc_view_'+coid, '', 'get','');
	
}
function enable_disable_user2(moid,status)
{
		completeAHAH.ahah('../ajax_admin.php?p=enable_disable_user2&mo_id='+moid+'&status='+status, 'acc_view_'+moid, '', 'get','');
	
}

  function showThis(what)
  {

    if (!document.getElementById) 
	{
		return null;
	}

    showWhat = document.getElementById(what);
	//alert(showWhat);
	if(showWhat)
	{
   // hideDivs(what);
    showWhat.style.display = "block";
	}


  }


function hideThese(what)
{
    if (!document.getElementsByTagName) return null;
	if (!what) what = "";
	//alert(what);
    var divs = document.getElementsByTagName("div");
    for(var i=0; i < divs.length; i++)
	{
	  var div = divs[i];
      var id = div.id;
	 if(what.indexOf(',' + id + ',') < 0)
		{
		//div.style.display = "none";	
		//div.className = "";
		}
	else
	 	{
		 div.style.display = "none";		
		// div.className = "";
		 }
	}
}


function changeClass(what,cname)
  {

    if (!document.getElementById) 
	{
		return null;
	}

    showWhat = document.getElementById(what);
	//alert(showWhat);
	if(showWhat)
	{
    //hideDivs(what);
    showWhat.className = cname;

	}


  }

function resetClasses(what)
  {

	if (!what) what = "";
   
	var divs = document.getElementsByTagName("a");
    
	for(var i=0; i < divs.length; i++)
    {
      var div = divs[i];
      var id = div.id;
	  //alert(id);
	  if(what.indexOf(',' + id + ',') < 0)
		{
		//div.style.display = "none";	
		//div.className = "";
		}
	else
	 	{
		// div.style.display = "block";		
		 div.className = "";
		 }

    }
}

function search_email_tab(tabid)
{
		
	document.forms['search_email'].elements['tab'].value=tabid;
}
