css_factor = 1;
//OK, stupid browser detect, because IE's so buggy with the CSS
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent) && parseInt(navigator.appVersion) <= 6) {
	var ieversion=new Number(RegExp.$1);
	if (ieversion <= 6) {
		css_factor = 2;
	}
}

function nav(which) {
	changeClass(which.id, "here");
}

function navoff(which) {
	changeClass(which.id, "");
}

function addToMailingList(which) {
	var path = '';
	if (which == 'top') {
		email = document.enews_signup_top.email_input_top.value;
	} else {
		email = document.enews_signup.email_input_left.value;
	}
	if (!email || !emailCheck(email) || email == 'email') {
		return false;
	}
	if (which == 'left') {
		getRawObject('bt_mailinglist_submit').disabled = true;
	}
	if (document.body.id != 'home') {
		path = '../';
	}
	makeHttpRequest(path + 'includes/mailingListAdd.php?email=' + email + '&which=' + which, 'mailingListAdd', false);
}

function mailingListAdd(which) {
	if (which == 'left') {
		getRawObject('enews_signup').innerHTML = '<span style="color:#eb5932">thank you</span>';
	} else {
		hideSubscribe();
	}
}

function toggleContact() {
	if (getObject("contact_email").display == 'block') {
		hideContact();
	} else {
		showContact();
	}
}

function showContact() {
	getObject("subscribe").cursor = "pointer";
	unsetDisplay('subscribe_formholder');
	getObject("subscribe").marginLeft = (51 / css_factor) + "px";
	setDisplay('contact_email');
}

function hideContact() {
	unsetDisplay('contact_email');
	getObject("subscribe").marginLeft = (146 / css_factor) + "px";
}

function showSubscribe() {
	if (getObject("subscribe_formholder").display == 'block') {
		return;
	}
	hideContact();
	getObject("subscribe").marginLeft = "0px";
	getObject("subscribe").cursor = "default";
	setDisplay('subscribe_formholder');
	getObject("email_input_top").color = "#AAA";
	document.enews_signup_top.email_input_top.value = 'email';
	getObject("email_input_top").textAlign = 'center';
}

function hideSubscribe() {
	getObject("subscribe").marginLeft = (146 / css_factor) + "px";
	getObject("subscribe").cursor = "pointer";
	unsetDisplay('subscribe_formholder');
}

function setEmailInput() {
	i = document.enews_signup_top.email_input_top;
	if (i.value=='email') {
		i.value='';
		getObject(i).textAlign='left';
		getObject(i).color='#000';
	}
}

function unsetEmailInput() {
	i = document.enews_signup_top.email_input_top;
	if (i.value=='') {
		i.value='email';
		getObject(i).textAlign='center';
		getObject(i).color='#AAA';
	}
}

