	function LoadApp() {
		//DisallowSafari();
		//rOptions();
	}
	
	function Finalize() {
		document.getElementById('csSummary').style.display = 'none';
		document.getElementById('csUploading').style.display = 'block';
		setTimeout("document.mainform.submit();", 1000);
	}

// general functions

	function toDollar(val) {
		return '$' + val.toFixed(2);
	}

	function get(id) {
		return document.getElementById(id);
	}

	function show(id) {
		document.getElementById('c' + id).style.display = 'block';
		document.getElementById('n' + id).className = 'active';
	}

	function hide(id) {
		document.getElementById('c' + id).style.display = 'none';
		document.getElementById('n' + id).className = 'inactive';
	}

	function radio(f) {
		document.getElementById('f' + f.name).value = f.value;
	}
	
	function l(id) {
		return document.getElementById(id).firstChild;
	}
	
	function value(id) {
		return document.getElementById(id).value;
	}
	
	function lvalue(id) {
		return document.getElementById(id).firstChild.nodeValue;
	}
	
	function totalParts() {
		return (document.mainform.fFamilyMold.value == 'No') ? 1 : 4;
	}
	
	function ExtractFileName(path) {
		path = path.split('\\');
		path = path[(path.length - 1)];
		path = path.split('/');
		path = path[(path.length - 1)];
		return path;
	}

// left nav menu options

	function mReset() {
		hide('Start');
		hide('Options');
		hide('Family');
		hide('Multi');
		//hide('View');
		hide('Submit');
	}

	function m(id) {
	
		// quick validate of frontpage options
		if(!value('femail'))
		{
			alert('Please provide a valid email address.');
			return;
		}
		if(!value('file1'))
		{
			alert('Please select a CAD file.');
			return;
		}
		if(!value('fAnnualVolume'))
		{
			alert('Please choose an expected annual volume.');
			return;
		}
		if(!value('fLifeCycle'))
		{
			alert('Please choose an expected life cycle.');
			return;
		}
		/*if(!get('fOriginChina').checked && !get('fOriginUSA').checked)
		{
			alert('Please select at least one RapidMolds division to quote from.');
			return;
		}*/
	
		switch(id) {
			case 'Family':
				mReset();
				mfReset();
				show(id);
				break;
			case 'Multi':
				mReset();
				mmReset();
				show(id);
				break;
			case 'Options':
				mReset();
				moReset();
				show(id);
				break;
			case 'Submit':
				mReset();
				msReset();
				show(id);
				break;
			case 'View':
				if(mvReset()) {
					mReset();
					show(id);
				}
				break;
			default:
				mReset();
				show(id);
				break;
		}
	}
	
	function CloseRightBar() {
		document.getElementById('rightbar').style.display = 'none';
		document.getElementById('greyarea').className = 'greyarea';
	}
	
	function OpenRightBar() {
		document.getElementById('rightbar').style.display = 'block';
		document.getElementById('greyarea').className = 'greyarea-rightbar';
	}
	
	function Maximize() {
		var C = document.getElementById('sitecontainer');
		C.className = (C.className == 'sitecontainer-fixed') ? 'sitecontainer-maximized' : 'sitecontainer-fixed';
		var I = document.getElementById('rightbar-maximize-img');
		I.src = (C.className == 'sitecontainer-fixed') ? '/images/maximize.gif' : '/images/maxrestore.gif';
	}

	function DisallowIE() {
		if(navigator.appName == 'Microsoft Internet Explorer')
			window.location.href = '/quoting/noie.php';
	}
	
	function DisallowSafari() {
		if(navigator.vendor) {
			if(navigator.vendor.substring(0, 5) == 'Apple')
				window.location.href = '/safari.php';
		}
	}
	
	String.prototype.isNumeric = function() {
		var RegExp = /^(-)?(\d*)(\.?)(\d*)$/;
		return this.match(RegExp);
	}
