


function mailing_signup(the_form){
	//check all items
	msg = "";
	form_name = the_form.name.value;
	form_company = the_form.company.value;
	form_email = the_form.email.value;
	if(form_name.length == 0){
		msg += "Name\n";
	}
	if(form_company.length == 0){
		msg += "Company\n";
	}
	if(form_email.length == 0){
		msg += "Email\n";
	}
	if(msg.length != 0){
		msg = "Please complete the following items:\n"+msg;
		alert(msg);
	}else{
		$('mg_load_img').style.visibility = "visible";
		the_form.name.disabled = true;
		the_form.company.disabled = true;
		the_form.email.disabled = true;
		the_form.join.disabled = true;

		url = "web_scripts/mailing_list.php?name="+form_name+"&company="+form_company+"&email="+form_email;
		new Ajax.Request(url,{ method:'get', onSuccess: mailing_signup_done});
	}
}

function mailing_signup_done(response){
	$('mg_load_img').style.visibility = "hidden";
	if(response.responseText == 'fail'){
		the_form.name.disabled = true;
		the_form.company.disabled = true;
		the_form.email.disabled = true;
		the_form.join.disabled = true;
		alert("Please complete all the form fields");
	}else{
		$('mg_right').style.textAlign = "left";
		$('mg_right').innerHTML = response.responseText;
	}
}

var repeatHeight;
var stopScroll = 0;
var time_ticker;
first_time = true;
function scrollMe(){
	if(first_time){
		repeatHeight = $('new_customers').scrollHeight; //get the current height so we know when to wrap
		$('new_customers').innerHTML = $('new_customers').innerHTML + $('new_customers').innerHTML;  //add a second copy so we can scroll down to the wrap point
		first_time = false;
	}
	clearTimeout(time_ticker);
	if(stopScroll==1) {
		return;
	}
	$('new_customers').scrollTop=$('new_customers').scrollTop+1;
	if($('new_customers').scrollTop == repeatHeight){
		$('new_customers').scrollTop = 0;
	}
	time_ticker = setTimeout("scrollMe()",85);
}

time_ticker = setTimeout("scrollMe()",1000);

