var zeit;
function click() {
if (event.button != 1) {
popup();
return false;
}
}
function nsc(e) {
if (e.which != 1) keinkontext();
}
function popup() {
return false;
}
function nichts(e) {
if (e.which != 1) return false;
}
function keinkontext() {
clearTimeout(zeit);
zeit = setTimeout("kontext()",1);
}
function kontext() {
clearTimeout(zeit);
popup();
}
if (document.all)
if (document.getElementById) document.oncontextmenu=popup;
else document.onmousedown=click0;
if (!(document.all) && document.getElementById)
document.oncontextmenu=popup;
if (document.layers) {
document.captureEvents(Event.MOUSEUP | Event.MOUSEDOWN);
document.onmousedown=nichts;
document.onmouseup=nsc;
}

errorChars = false;
errorEmpty = false;

function checkChars(text,id) {
  var goodChars = /^[\s\w]+$/;
  if ((text != '') && (!goodChars.test(text))) {
	document.getElementById(id).style.color = 'red';
	errorChars = true;
  }
}

function checkEmpty(text,id) {
  if (text == '') {
	document.getElementById(id).style.color = 'red';
	errorEmpty = true;
  }
  else{
  document.getElementById(id).style.color = 'black';
	errorEmpty = false;
  }
}

function checkForm() {
  
  var firstText = document.getElementById("boxfirst").value;
  var lastText = document.getElementById("boxlast").value;
  var companyText = document.getElementById("boxcompany").value;
  var phoneText = document.getElementById("boxphone").value;
  var emailText = document.getElementById("boxemail").value;


  checkEmpty(firstText,'first');
  checkEmpty(lastText,'last');	
  checkEmpty(companyText,'company');	
  checkEmpty(phoneText,'phone');
  checkEmpty(emailText,'email');
  
  if (errorEmpty == true) {
	errorEmpty = false;
	return false;
  }
		
  if (errorChars == true) {
	errorChars = false;
	return false;
  }

  window.location=("http://www.vialunatest.com/CreateTarget.aspx?SalesRepID=<%=LabelSalesRepID.Text%>&RedirectURL=campaign/uk/vltd/vialuna/dev/thanks.aspx&RError=campaign/uk/vltd/vialuna/dev/file_not_found.aspx&campaignGUID=<%=LabelCampaignGUID.Text%>&IsActive=0&CreateGUID=N&URLName="+firstText+lastText+"&FirstName="+firstText+"&LastName="+lastText+"&EmailAddress="+emailText+"&Company="+companyText+"&Phone="+phoneText+"&Custom2=<%=LabelCustom2.Text%>&Custom3=<%=LabelCustom3.Text%>&Custom4=<%=LabelCustom4.Text%>&Custom5=<%=LabelCustom5.Text%>&Custom19=<%=LabelFirstName.Text%>&Custom20=<%=LabelLastName.Text%>&Segment=Referal&Batch=<%=LabelURLID.Text%>");
}