		function getxmlhttp (){
		//Create a boolean variable to check for a valid microsoft active X instance.
		var xmlhttp = false;
		
		//Check if we are using internet explorer.
		try {
			//If the javascript version is greater than 5.
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			//If not, then use the older active x object.
			try {
				//If we are using internet explorer.
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (E) {
				//Else we must be using a non-internet explorer browser.
				xmlhttp = false;
			}
		}
		
		//If we are using a non-internet explorer browser, create a javascript instance of the object.
		if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
			xmlhttp = new XMLHttpRequest();
		}
		
		return xmlhttp;
	}
	
	//Function to process an XMLHttpRequest.
	function processajax (obj, serverPage){
		//Get an XMLHttpRequest object for use.
		var theimg;
		xmlhttp = getxmlhttp ();
		xmlhttp.open("GET", serverPage);
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				document.getElementById(obj).innerHTML = xmlhttp.responseText;
			}
		}
		xmlhttp.send(null);
	}
	
	
	
	
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function uploadimg(theform)
{
theform.submit();	
}

function doneloading(theframe,thefile)
{
var theloc = "showimg.php?thefile=" + thefile
theframe.processajax ("showimg",theloc);
}

function imageuploaderror(theframe,errors)
{

var theloc = 'image_upload_error.php?error=' + errors
theframe.processajax ("ajax_message_holder",theloc);
}

function imageuploadsuccess(theframe, msg)
{
var theloc = 'image_upload_success.php?msg=' + msg
theframe.processajax ("ajax_message_holder",theloc);
}	
	
function updatecheckbox(querystringvalue, add_or_remove, step)
{
var theloc = "update_checkbox.php?checkbox_id=" + querystringvalue + '&add_or_remove=' + add_or_remove + '&step=' + step
processajax (querystringvalue,theloc);
}

function updatecheckbox_mail(add_or_remove, domain)
{
var theloc = "update_checkbox_mail.php?checkbox_id=" + domain + '&add_or_remove=' + add_or_remove
processajax (domain,theloc);
}

function updatecheckbox_mail2(add_or_remove, domain)
{
var theloc = "update_checkbox_mail2.php?checkbox_id=" + domain + '&add_or_remove=' + add_or_remove
processajax (domain,theloc);
}

function updatecheckbox_email(id)
{
var theloc = "update_email_checkbox.php?id=" + id
processajax (id,theloc);
}

	






function xmlhttpPost(strURL, whichone, xyz) {

    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepage(self.xmlHttpReq.responseText, whichone, xyz);
        }
    }
    self.xmlHttpReq.send(getquerystring(whichone, xyz));
}

function getquerystring(whichone, xyz) {

    var form     = document.forms['f1_'+whichone];
    var word = form.word.value;
	
	//if (form.checked == false) { var boxcheck = '&checked=false'; }
	 //document.write(document.forms['f1_'+whichone]);
	if (document.forms['f1_'+whichone].checkbox.checked == false)  var boxcheck = '&checked=false'; 
	if (document.forms['f1_'+whichone].checkbox.checked == true)  var boxcheck = '&checked=true'; 
	
	
    qstr = 'w=' + escape(word) + boxcheck + '&xyz=' + xyz;  // NOTE: no '?' before querystring
    return qstr;
}

function updatepage(str, whichone, xyz){
   // document.getElementById("result_"+whichone).innerHTML = str;
	document.getElementById("email_list").innerHTML = str;
}

function ShowPopUp(hoveritem)
{
hp = document.getElementById(hoveritem);
hp.style.top = hoveritem.offsetTop + 18;
hp.style.left = hoveritem.offsetLeft + 20;
hp.style.visibility = "Visible";
}

function HidePopUp(hoveritem)
{
hp = document.getElementById(hoveritem);
hp.style.visibility = "Hidden";
}

function build_contact_form(id, launch, email, subjectx, message, name, security, notspammer)
{
	if(launch == true)
	{
		document.getElementById("contact_form").style.visibility = "visible";
		document.getElementById("contact_form").style.display = "block";
		processajax('contact_form', 'update_contact_form.php?id=' + id + '&launch=' + launch);
		//showOverlay();
	}

	if(launch == false)
	{
		processajax('contact_form', 'update_contact_form.php?id=' + id + '&launch=' + launch + '&email=' + email + '&subjectx=' + subjectx + '&message=' + message + '&name=' + name + '&security=' + security + '&notspammer=' + notspammer);	
	}
	
	if(launch == 'close')
	{
		document.getElementById("contact_form").style.visibility = "hidden";
		document.getElementById("contact_form").style.display = "none";
		document.getElementById("contact_form").innerHTML = "";
		//hideOverlay();
	}
}


function showOverlay()
{
	$('overlay').show();
	
	Event.observe(document, 'keypress', escapeOverlay.bfx );
}

// Hides the overlay and stops the ESCAPE event listener
function hideOverlay()
{
	$('overlay').hide();
	
	Event.stopObserving(document, 'keypress', escapeOverlay.bfx );
}