$(document).ready(function() {

	//Add the form to every single page programatically.
	$('body').append("<div id='contactForm' class='simple_overlay'>"
	+"<h2>Contact Pirean</h2>"
	+"<p>Please complete the form below to send us your question.</p>"
	+"<form id='frmLead' action='https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8' method='POST'>"
	+"<table cellspacing='15'>"
	+"<input type=hidden name='oid' value='00D2000000091XU'/>"
	+"<input type=hidden name='retURL' value='http://www.pirean.com/Thankyou.htm'/><tr>"
	+"<td align='right' valign='top'><label for='salutation'>Salutation:</label></td>"
	+"<td><select class='required' id='salutation' name='salutation'>"
	+"<option value=''>--None--</option><option value='Mr.'>Mr.</option><option value='Ms.'>Ms.</option><option value='Mrs.'>Mrs.</option><option value='Dr.'>Dr.</option><option value='Prof.'>Prof.</option>"
	+"</select></td></tr>"
	+"<tr><td align='right' valign='top'><label for='first_name'>First Name:</label></td>"
	+"<td><input class='required' id='first_name' maxlength='40' name='first_name' size='20' type='text' /></td></tr>"
	+"<tr><td align='right' valign='top'><label for='last_name'>Last Name:</label></td>"
	+"<td><input class='required' id='last_name' maxlength='80' name='last_name' size='20' type='text' /></td></tr>"
	+"<tr><td align='right' valign='top'><label for='email'>E-Mail Address:</label></td>"
	+"<td><input class='required email' id='email' maxlength='80' name='email' size='20' type='text' /></td></tr>"
	+"<tr><td align='right' valign='top'><label for='phone'>Phone Number:</label></td>"
	+"<td><input  id='phone' maxlength='40' name='phone' size='20' type='text' /></td></tr>"
	+"<tr><td align='right' valign='top'><label for='company'>Company Name:</label></td>"
	+"<td><input  id='company' maxlength='40' name='company' size='20' type='text' /></td></tr>"
	+"<tr><td align='right' valign='top'><label for='title'>Your Role:</label></td>"
	+"<td><input  id='title' maxlength='40' name='title' size='20' type='text' /></td></tr>"
	+"<tr><td align='right' valign='top'><label>Areas of Interest:</label></td>"
	+"<td><select name='00N20000002OExW' size='4' multiple='multiple'  id='00N20000002OExW' title='Areas of Interest'>"
	+"<option value='Services: IT Service Management'>Services: IT Service Management</option><option value='Services: Security Management'>Services: Security Management</option>"
	+"<option value='Services: Solution Assured'>Services: Solution Assured</option><option value='Software: IBM ITSM'>Software: IBM ITSM</option>"
	+"<option value='Software: IBM Security'>Software: IBM Security</option><option value='Software: IBM Storage'>Software: IBM Storage</option>"
	+"<option value='Software: Pirean Access: One'>Software: Pirean Access: One</option><option value='Software: Pirean Compliance: One'>Software: Pirean Compliance: One</option>"
	+"<option value='Software: Pirean SMBUS'>Software: Pirean SMBUS</option><option value='Other'>Other</option>"
	+"</select></td></tr>"
	+"<tr><td align='right' valign='top'><label>Initial Enquiry:</label></td>"
	+"<td><textarea class='required' id='00N20000002OO4z' name='00N20000002OO4z' cols='30' rows='5' type='text' wrap='soft'></textarea></td></tr>"
	+"<tr><td colspan='2' align='center'>"
	+"<input type='submit' name='submit' title='Send Enquiry' value='Send Enquiry'/>&nbsp;<input type='reset' id='reset' name='reset' title='Reset Form' value='Reset Form'/></td></tr>"
	+"</table></form>"
	+"<div style='text-align:center;'>"
	+"<p>For other ways to contact Pirean, please visit our <span class='Internal'><a href='ContactPirean.htm'>Contact Details</a></span> page.</p>"
	+"</div></div><!-- End contactForm -->");
	
	// The popup modal dialogue box stuff goes here
	var triggers = $(".modalInput").overlay({

	// some mask tweaks suitable for modal dialogs
	mask: {
		color: '#000000',
		loadSpeed: 200,
		opacity: 0.5
	},

	closeOnClick: false
	});
	
	var v = $("#frmLead").validate({
		focusInvalid: true ,
		errorElement: "div"
	});
	$("#frmLead #reset").click(function () { 
      v.resetForm();//$(this).slideUp(); 
    });

});