function addToBasket(productId) {

}

function focusInput(el) {
	if (el.value == el.getAttribute("blurValue")) {
		el.value = "";
		removeClassName(el, "blurred");
	}
}

function blurInput(el) {
	if (typeof(el)=="string") {
		var els = getElementsByClass(el);
		el = els[els.length-1];
	}
	if (el.value == "" || el.value == el.getAttribute("blurValue")) {
		addClassName(el, "blurred");
		el.value = el.getAttribute("blurValue");
	}
	else {
		removeClassName(el, "blurred");
	}
}

function switchForm(formType, el, formTypes, prevFormType, controlToFocus) {
	/// Use this for session history eventually
	//window.location.href = window.location.href.replace(/#.*$/, '')+"#p:"+formType;
	var ft = formTypes; //["enquiry", "quote" /*, "order"*/];
	for (var i in ft) {
		if (gbid(ft[i]+"Form").style.display == "block") {
			prevFormType = ft[i];
			break;
		}
	}
	var form = gbid(formType+"Form");
	var prevForm = gbid(prevFormType+"Form");
	/// Update tab bar
	var els = getElementsByClass("tab\\s+active");
	removeClassName(els[0], "active");
	addClassName(el, "active");
	/// Copy across the values from previous form
	var newEls = getElementsByClass("plain", form);
	for (var i=0; i<newEls.length; i++) {
		var fn = newEls[i].name.replace(/^\w+_/, '');
		var prevEl = gbid(prevFormType+"_"+fn);
		if (prevEl) {
			newEls[i].value = prevEl.value;
		}
	}
	/// Hide/show the right form
	prevForm.style.display = "none";
	form.style.display = "block";
	gbid(formType+"_"+controlToFocus).focus();
}

function switchContactForm(formType, el) {
	switchForm(formType, el, ["enquiry", "quote"], "enquiry", "YourName");
}

function switchAccountForm(formType, el) {
	switchForm(formType, el, ["weblogin", "createAccount"], "weblogin", "Username");
}