function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function AWCow(url, width, height, attributes) { var r = Math.floor(Math.random()*99999); var Win = window.open(url,'pop'+r,'width='+width+',height='+height+','+attributes); }
function adShareWebsiteToggle() {
	if (trim($('#websiteurl').val()) == '') {
		$('#adshare_form_website_options').hide();
	}
	else {
		$('#adshare_form_website_options').show();
	}
}

function adshareValidate() {
	
	if ($('#agreeterms:checked').val() == null) {
		alert('You must agree to the Terms and Conditions and Contest Rules before continuing.');
		$('#agreeterms').focus();
		return false;
		
  	}
  	
  	if (trim($('#websiteurl').val()) != '') {
  		if($('#optone').val() == 0) {
  			alert('You must select a category for your website.');
  			$('#optone').focus();
  			return false;
  		}
  		else if ($('input[name=target]:checked').val() == null) {
			alert('You must select your website target audience.');
			$('#target').focus();
			return false;
		}
  	}
	return true;
}
function adshareValidateWebsite() {
  	if (trim($('#websiteurl').val()) != '') {
  		if($('#optone').val() == 0) {
  			alert('You must select a category for your website.');
  			$('#optone').focus();
  			return false;
  		}
  		else if ($('input[name=target]:checked').val() == null) {
			alert('You must select your website target audience.');
			$('#target').focus();
			return false;
		}else if($('#pageviews').val() == '') {
  			alert('You must select total monthly page views for your website.');
  			$('#pageviews').focus();
  			return false;
  		}
		return true;
  	}
  	alert('You must enter your website address to continue.');
  	$('#websiteurl').focus();
	return false;
}
function SelectAll(element) {
		element.focus();
		element.select();
}
