$(document).ready(
									function(){
		                $('.err').Highlight(1500, 'red');
		                $('.cnf').Highlight(1500, 'green');

                  }
									);

function leadSubmit(id) {
		name = document.getElementById('name-'+id).value;
		phone = document.getElementById('phone-'+id).value;
		email = document.getElementById('email-'+id).value;
		project = document.getElementById('project-'+id).value;
		vars = 'lid=' + id;
		vars += '&name=' + name;
		vars += '&phone=' + phone;
		vars += '&email=' + email;
		vars += '&project=' + project;
		$.get("/ajax.php?action=update_lead&" + vars,
					function(data) {
				      vars = data.split('||');
							$('#name-display-'+id).html(vars[0]);
							$('#phone-display-'+id).html(vars[1]);
							$('#email-display-'+id).html(vars[2]);
							$('#project-display-'+id).html(vars[3]);
							$('#leadview-'+id).show();
							$('#lead-edit-'+id).hide();
							$('#leadview-'+id).Highlight(1500, 'green');
		});
}

function contactedLead(id) {
		vars = 'lid=' + id;
		vars += '&contacted=1';
		$.get("/ajax.php?action=contacted_lead&" + vars,
					function(data) {
											$('#lead-edit-'+id).fadeOut();
		});
}

function touchbaseLead(id) {
		vars = 'lid=' + id;
		vars += '&contacted=1';
		$.get("/ajax.php?action=touchbase_lead&" + vars,
					function(data) {
											$('#leadview-'+id).fadeOut();
		});
}

function showLeadForm(id) {
		$('#leadview-'+id).hide();
		$('#lead-edit-'+id).show();
}

function leadCancel(id) {
		$('#leadview-'+id).show();
		$('#lead-edit-'+id).hide();
}

function getHTTPObject() {
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}

var http = getHTTPObject(); // We create the HTTP Object

