	function submitSearch() {
		strsearch = document.getElementById('searchstring').value;
		if (strsearch!='') {
			document.forms['searchbox'].submit();
			return false;
		} else {
			return false;
		}
	}
	
	function addLoadEvent(func) {
		var oldonload = window.onload;
		if (typeof window.onload != 'function') {
			window.onload = func;
		} else {
			window.onload = function() {
				if (oldonload) {
		        		oldonload();
				}
				func();
			}
		}
	}

	
	function submitLogin() {
		var acnt = encodeURIComponent(document.getElementById('account').value);
		var pwrd = encodeURIComponent(document.getElementById('password').value);
		var el = document.getElementById('signinalertbox');
		if (acnt==''||pwrd=='') {
			el.innerHTML='The account details you have used are incorrect.<br/>Please re-type and try again.';
		} else {
			actionFolder = sjax('ajax_getCatalogue.asp','un='+acnt+'&pw='+pwrd,el,2,1)
			switch(actionFolder) {
			case('boost'):
				document.forms['loginform'].action='http://www.gpicorporate.com.au/boost_log.asp';
				document.getElementById('account').name='Log';
				document.getElementById('password').name='Passw';
				document.getElementById('formkey').name='Submitted';
				document.getElementById('formkey').value='True';
				document.forms['loginform'].submit();
				el.innerHTML='<span style="color:#333;">Please wait while you are redirected to your catalogue...</span>';
			break;
			case('other'):
				document.forms['loginform'].action='http://www.gpicorporate.com.au/Corp.asp';
				document.getElementById('account').name='Login';
				document.getElementById('password').name='Password';
				document.getElementById('formkey').name='Submitted';
				document.getElementById('formkey').value='True';
				document.forms['loginform'].submit();
				el.innerHTML='<span style="color:#333;">Please wait while you are redirected to your catalogue...</span>';
			break;
			case('error'):
				el.innerHTML='The account details you have used are incorrect.<br/>Please re-type and try again.';
			break;
			default:
				document.forms['loginform'].action='https://gpicomau.bluecentral.com/ssl/corporate/'+actionFolder+'/signin.asp';
				document.forms['loginform'].submit();
				el.innerHTML='<span style="color:#333;">Please wait while you are redirected to your catalogue...</span>';
			break;
			}
		}
		return false;
	}

	function enterPressed(e, func) {
		var keycode;
		if (window.event) {keycode = window.event.keyCode;}
		else if (e) {keycode = e.which;}
		else {return true;}

		if (keycode == 13){ submitLogin(); return false; }
		else { return true; } 
	}

	function addEnquiry(ecoid) {
		var elMsg = document.getElementById('msg'+ecoid);
		var elBtn = document.getElementById('add'+ecoid);
		var elAnim = document.getElementById('anim'+ecoid);
		elBtn.style.display='none';
		elAnim.style.display='block';
		var iEnqResp = dhtmlxAjax.postSync('ajax_cookie_add.asp','eid='+ecoid);
		iEnqResp = iEnqResp.xmlDoc.responseText;
		if (iEnqResp=='OK') {
			elMsg.style.visibility='visible';
		} else {
			alert(iEnqResp);
			elBtn.style.display='block';
		}
		elAnim.style.display='none';
		return false;
	}

	function removeEnquiry(ecoid) {
		var elMsg = document.getElementById('msg'+ecoid);
		var elBtn = document.getElementById('add'+ecoid);
		var elAnim = document.getElementById('anim'+ecoid);
		elMsg.style.visiblity='hidden';
		elAnim.style.display='block';
		var iEnqResp = dhtmlxAjax.postSync('ajax_cookie_del.asp','eid='+ecoid);
		iEnqResp = iEnqResp.xmlDoc.responseText;
		if (iEnqResp=='OK') {
			elMsg.style.visibility='hidden';
			elBtn.style.display='block';
		} else {
			alert(iEnqResp);
			elMsg.style.visiblity='visible';
		}
		elAnim.style.display='none';
		return false;
	}