// Help fend off spam spiders

document.write('<a name="clean_contact"></a><form method="post" action="#clean_contact" name="clean_contact" id="clean_contact" enctype="multipart/form-data" onsubmit="return clean_contact_validate(this)">');

document.write('<input type="hidden" name="clean_contact_token" value="<?=clean_contact_token()?>">');

document.write('<fieldset class="clean-contact">');



document.write('<label for="clean_contact_from_name" style="display: inline;">Your First Name<em>*</em></label><input type="text" name="clean_contact_from_name" id="clean_contact_from_name" onchange="clean_contact_msg_clr()" />');



document.write('<label for="clean_contact_from_lname" style="display: inline;">Your Last Name<em>*</em></label><input type="text" name="clean_contact_from_lname" id="clean_contact_from_lname" onchange="clean_contact_msg_clr()" />');



document.write('<label for="clean_contact_from_email" style="display: inline;">Your E-mail Address<em>*</em></label><input type="text" name="clean_contact_from_email" id="clean_contact_from_email"  onchange="clean_contact_msg_clr()"  />');

/*Added by kaushik*/

document.write('<label for="clean_contact_from_phone" style="display: inline;">Your Phone<em>*</em></label><input type="text" name="clean_contact_from_phone" id="clean_contact_from_phone"  onchange="clean_contact_msg_clr()"  />');



document.write('<label for="clean_contact_from_file" style="display: inline;">Attach Your Resume<em>*</em></label><input type="file" name="clean_contact_from_file" id="clean_contact_from_file" size="50" onchange="clean_contact_msg_clr()"  />');

/*end of addition*/



document.write('<label for="clean_contact_subject">Subject<em>*</em></label><input type="text" id="clean_contact_subject" name="clean_contact_subject"  onchange="clean_contact_msg_clr()"  />');

document.write('<label for="clean_contact_body">Message<em>*</em></label>');

document.write('<textarea id="clean_contact_body" name="clean_contact_body"  onchange="clean_contact_msg_clr()" ></textarea>');

document.write('<div class="clean-contact-msg err" id="clean_contact_msg"></div>');

document.write('<input type="Submit" id="clean_contact_send" value=" Send &raquo; ">');

document.write('</fieldset>');

document.write('</form>');

function clean_contact_validate() {

	var email  = /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/;

	var str = 	/\w+/;

	if(!str.test(document.getElementById('clean_contact_from_name').value)) {

		clean_contact_msg('Please provide your first name');

		return false;

	}

	if(!str.test(document.getElementById('clean_contact_from_lname').value)) {

		clean_contact_msg('Please provide your last name');

		return false;

	}

	if(!email.test(document.getElementById('clean_contact_from_email').value)) {

		clean_contact_msg('Please provide a valid e-mail address');

		return false;

	}

	if(!str.test(document.getElementById('clean_contact_from_phone').value)) {

		clean_contact_msg('Please provide a phone number');

		return false;

	}

   if(!str.test(document.getElementById('clean_contact_from_file').value)) {

		clean_contact_msg('Please attach a file');

		return false;

	}

	if(!str.test(document.getElementById('clean_contact_subject').value)) {

		clean_contact_msg('Please provide a Subject');

		return false;

	}



	

	if(!str.test(document.getElementById('clean_contact_body').value)) {

		clean_contact_msg('Please write some message');

		return false;

	}

	return true;

}



function clean_contact_msg(msg) {

	em = document.getElementById('clean_contact_msg');

	em.innerHTML = msg;

	em.style.display = 'block';

}



function  clean_contact_msg_clr() {

	document.getElementById('clean_contact_msg').style.display = 'none';

	

}

function clean_contact_sent(msg,url) {

	for (var elm, i = 0; ( elm = document.clean_contact.elements[i] ); i++) {

		elm.disabled = true;

	}

	document.getElementById('clean_contact_msg').className = 'clean-contact-msg ok';

	document.getElementById('clean_contact_send').style.display = 'none';

	clean_contact_msg(msg);

	if(url) window.location = url;

}