// Help fend off spam spiders
function clean_contact_form() {
	var send = document.getElementById('str_clean_contact_send').value;
	document.write('<div id="form-wrapper"><a name="clean_contact"></a><form method="post" action="#clean_contact" name="clean_contact" id="clean_contact" onsubmit="return clean_contact_validate(this)">');
	document.write('<input type="hidden" name="clean_contact_token" value="cc" />');
	document.write('<fieldset class="CleanContact">');
	document.write('<span class="talk">Let\'s Talk</span>');
	document.write('<p>We\'ve helped startups, businesses, non-profits and Fortune 500 companies achieve success online. <span>We\'d like to help you too.</span></p>');
	document.write('<input type="text" value="Name" name="clean_contact_from_name" id="clean_contact_from_name" onchange="clean_contact_msg_clr()" onfocus="if(this.value==\'Name\') {this.value=\'\';}" onblur="if(this.value==\'\') {this.value=\'Name\';}" />');
	document.write('<input type="text" value="Email" name="clean_contact_from_email" id="clean_contact_from_email"  onchange="clean_contact_msg_clr()" onfocus="if(this.value==\'Email\') {this.value=\'\';}" onblur="if(this.value==\'\') {this.value=\'Email\';}" />');
	document.write('<input type="hidden" id="clean_contact_subject" name="clean_contact_subject" value="Getting started" />');
	document.write('<textarea id="clean_contact_body" name="clean_contact_body" onchange="clean_contact_msg_clr()" onfocus="if(this.value==\'Message\') {this.value=\'\';}" onblur="if(this.value==\'\') {this.value=\'Message\';}">Message</textarea><br />');
	document.write('<div id="clean_contact_msg"></div>');
	document.write('<input type="submit" id="clean_contact_send" value=" ' + send + ' " />');
	document.write('</fieldset>');
	document.write('</form>');
	document.write('<div id="email-listing"><p>Send us an Email:</p><ul class="email-list"><li><span>Projects</span><a href="mailto:getstarted@uptrending.com">getstarted@uptrending.com</a></li><li><span>Careers</span><a href="mailto:careers@uptrending.com">careers@uptrending.com</a></li><li><span>General</span><a href="mailto:info@uptrending.com">info@uptrending.com</a></li></ul><p>Drop us a line:</p><ul class="email-list"><li><span>Palo Alto</span>650-681-9327</li></ul></div></div>');
}

function clean_contact_validate() {
	var email  = /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/;
	var error = document.getElementById('str_clean_contact_send').value + ': ';
	var str = 	/\w+/;

	var error = document.getElementById('str_clean_contact_error').value + ': ';
	if(document.getElementById('clean_contact_from_name').value == '') {
		clean_contact_msg(error + document.getElementById('str_clean_contact_name').value);
		return false;
	}
	if(!email.test(document.getElementById('clean_contact_from_email').value)) {
		clean_contact_msg(error + document.getElementById('str_clean_contact_email').value);
		return false;
	}
	if(document.getElementById('clean_contact_subject').value == '') {
		clean_contact_msg(error + document.getElementById('str_clean_contact_subject').value);
		return false;
	}

	if(document.getElementById('clean_contact_body').value == '') {
		clean_contact_msg(error + document.getElementById('str_clean_contact_body').value);
		return false;
	}
	return true;
}

function  clean_contact_msg_clr() {
	document.getElementById('clean_contact_msg').style.display = 'none';
}

function clean_contact_msg(msg) {
	em = document.getElementById('clean_contact_msg');
	em.innerHTML = msg;
	em.style.display = 'block';
} 

function clean_contact_url(url) {
	window.location = url;
}


