var objForm;

function doForm(thisForm) { 

	var myForm;
	var myTitle;
	
	objForm = thisForm;
	
	switch(thisForm) {
		case 'Stairlift Brochure Request':
			myTitle = 'Stairlift Brochure Request';
		break;
		case 'Chair Brochure Request':
			myTitle = 'Chair Brochure Request';
		break;
		case 'Mobility Product News':
			myTitle = 'Brochure Request';
		break;
		case 'Mobility Scooter News':
			myTitle = 'Scooter Brochure Request';
		break;
		case 'Adjustable Bed News':
			myTitle = 'Bed Brochure Request';
		break;
		case 'Adjustable Chair News':
			myTitle = 'Chair Brochure Request';
		break;
		case 'Walkin Shower News':
			myTitle = 'Shower Brochure Request';
		break;
		case 'Stairlift News':
			myTitle = 'Stairlift Brochure Request';
		break;
		case 'Bath-lift':
			myTitle = 'Bath-lift Brochure Request';
		break;
		case 'Carehome Request':
			myTitle = 'Carehome Brochure Request';
		break;
	}

		
	myForm = '<form action="/mailme.php" method="get" onsubmit="return checkOverlayForm()">';
	myForm += '<img style="cursor: pointer;" onclick="removeLayer(\'PleaseWait\'); displayLayer(\'Container\');"  src="/images/close.gif" align=right>';
	myForm += '<div style="width: 300px; float: left">';
	myForm += '<h1 style="font-size: 28px;">'+myTitle+'</h1>';
	
	myForm += '<input type="hidden" name="FormName" value="'+thisForm+'">';
	myForm += '<input type="hidden" name="Redirect" value="http://www.help-my-mobility.co.uk/request-for-info-thank-you.htm">';
	myForm += '<table width=300>';
	myForm += '<tr><td align=left>First Name</td><td align=left><input type="text" name="FirstName" id="aFirstName"><img src="/images/warning_16.gif" alt="* required" title="* required"></td></tr>';
	myForm += '<tr><td align=left>Last Name</td><td align=left><input type="text" name="LastName" id="aLastName"><img src="/images/warning_16.gif" alt="* required" title="* required"></td></tr>';
	myForm += '<tr><td align=left>Address</td><td align=left><input type="text" name="Address" id="aAddress"><img src="/images/warning_16.gif" alt="* required" title="* required"></td></tr>';
	myForm += '<tr><td align=left></td><td align=left><input type="text" name="Street" id="aStreet"></td></tr>';
	myForm += '<tr><td align=left>Town</td><td align=left><input type="text" name="Town" id="aTown"></td></tr>';
	myForm += '<tr><td align=left>County</td><td align=left><input type="text" name="County" id="aCounty"></td></tr>';
	myForm += '<tr><td align=left>Postcode</td><td align=left><input type="text" name="Postcode" id="aPostcode"><img src="/images/warning_16.gif" alt="* required" title="* required"></td></tr>';
	myForm += '<tr><td align=left>Tel</td><td align=left><input type="text" name="Tel" id="aTel"><img src="/images/warning_16.gif" alt="* required" title="* required"></td></tr>';
	myForm += '<tr><td align=left>Email</td><td align=left><input type="text" name="Email" id="aEmail"></td></tr>';
	myForm += '</table>';
	myForm += '</div>';

	switch(thisForm) {
		case 'Carehome Request':
		    document.getElementById('PleaseWaitText').style.width = '750px';
		
			myForm += '<div style="width: 300px; float: left; margin-left: 60px;">';
			
			
			myForm += '<table width=300>';
			myForm += '<tr>'
			myForm += '<td align=left colspan=2>Do you require funding information?<input type="checkbox" name="Funding" id="Funding"> (please tick)</td>'
			myForm += '</tr>';
			myForm += '<tr>'
			myForm += '</table><br><br>';
			myForm += '<table width=300>';
			myForm += '<td align=left colspan=2>Which counties would you prefer?</td>'
			myForm += '</tr>';
			myForm += '<tr>'
			myForm += '<td align=left>1st Choice</td>'
			myForm += '<td align=left><input type=text name=Choice1 id=Choice1><img src="/images/warning_16.gif" alt="* required" title="* required"></td>'
			myForm += '</tr>';
			myForm += '<tr>'
			myForm += '<td align=left>2nd Choice</td>'
			myForm += '<td align=left><input type=text name=Choice2 id=Choice2></td>'
			myForm += '</tr>';
			myForm += '</table>';
			
			
			myForm += '</div>';
		
		break;
		
		case 'Stairlift Brochure Request':
		    document.getElementById('PleaseWaitText').style.width = '750px';
		
			myForm += '<div style="width: 300px; float: left; margin-left: 60px;">';
			myForm += '<p>Please select the brochures you would like to receive;</p>';
			myForm += '<table width=300>';
			myForm += '<tr>'
			myForm += '<td align=left>Acorn <input type="checkbox" name="Acorn" id="Acorn"></td>'
			myForm += '<td align=left>Brooks <input type="checkbox" name="Brooks" id="Brooks"></td>'
			myForm += '</tr>';
			
			myForm += '<tr>'
			myForm += '<td align=left>Companion <input type="checkbox" name="Companion" id="Companion"></td>'
			myForm += '<td align=left>Stannah <input type="checkbox" name="Stannah" id="Stannah"></td>'
			myForm += '</tr>';
			myForm += '</table>';
			myForm += '</div>';
		
		break;
		
		default:
			document.getElementById('PleaseWaitText').style.width = '750px';
		
			myForm += '<div style="width: 300px; float: left; margin-left: 60px;">';
			myForm += '<p>I would also like brochures on;</p>';
			myForm += '<table width=300>';
			myForm += '<tr>'
			myForm += '<td align=left style="font-size: 12px;"><input type="checkbox" name="Scooters" id="Scooters"> Scooters </td>'
			myForm += '<td align=left style="font-size: 12px;"><input type="checkbox" name="Stairlifts" id="Stairlifts"> Stairlifts </td>'
			myForm += '</tr>';
			
			myForm += '<tr>'
			myForm += '<td align=left style="font-size: 12px;"><input type="checkbox" name="Beds" id="Beds"> Adjustable Beds </td>'
			myForm += '<td align=left style="font-size: 12px;"><input type="checkbox" name="Baths" id="Baths"> Walkin Baths </td>'
			myForm += '</tr>';
			myForm += '</table>';
			myForm += '</div>';
		break;
	}


	myForm += '<div style="clear: both;"><table width="100%">';
	myForm += '<tr><td align=left><a href="/terms-conditions.htm" target=_blank>Terms & Conditions</a></td><td align=right><input type="submit" style="font-size: 18px; background-color: #C00; border-width: 2px; border-style: solid; border-color: white; color: white;" value="send..."></td></tr>';
	myForm += '</table></div>';
	myForm += '<div id=formMessage></div>';

	myForm += '</form>';
	

    document.getElementById('PleaseWaitText').innerHTML = myForm;
    document.getElementById('PleaseWaitText').style.overflow = 'auto';

    var speed = Math.round(200 / 100); 
    var timer = 0; 
     
    //set the current image as background 
     
    changeOpac(100, 'Container'); 
    //fade in image 
    for(i = 100; i > 20; i--) { 
        setTimeout("changeOpac(" + i + ",'Container')",(timer * speed)); 
        timer++; 
    } 
    timer++; 
	
	document.getElementById('Container').style.zIndex = 0;
	

	displayLayer('PleaseWait');
    changeOpac(100, 'PleaseWait'); 
		
}

function checkOverlayForm() {
	var bGo;

	bGo = true;
	
	if (document.getElementById('aFirstName').value == '') {
		document.getElementById('aFirstName').style.backgroundColor = 'red';
		bGo = false;
	}
	if (document.getElementById('aLastName').value == '') {
		document.getElementById('aLastName').style.backgroundColor = 'red';
		bGo = false;
	}
	if (document.getElementById('aAddress').value == '') {
		document.getElementById('aAddress').style.backgroundColor = 'red';
		bGo = false;
	}
	if (document.getElementById('aPostcode').value == '') {
		document.getElementById('aPostcode').style.backgroundColor = 'red';
		bGo = false;
	}
	if (document.getElementById('aTel').value == '') {
		document.getElementById('aTel').style.backgroundColor = 'red';
		bGo = false;
	}
	
	switch(objForm) {
		case 'Carehome Request':
			if (document.getElementById('Choice1').value == '') {
				document.getElementById('Choice1').style.backgroundColor = 'red';
				bGo = false;
			}
			break;
		default :
			break;
	}

	if (bGo == false) {
		document.getElementById('formMessage').innerHTML = '<p>PLEASE COMPLETE ALL MANDATORY FIELDS!</p>';
		return false;
	} else {
		return true;
	}
}

