
document.write('<scr' + 'ipt type="text/javascript" src="http://s3.amazonaws.com/new.cetrk.com/pages/scripts/0010/2822.js"></scr' + 'ipt>');

function stripHead(s) {
  if (s == null || s == "") return s
  i=0
  while (s.charAt(i) == ' ') {
    i++
  }
  return s.substring(i, s.length)
}
function stripTail(s) {
  if (s == null || s == "") return s
  i=s.length - 1
  while (s.charAt(i) == ' ') {
    i--
  }
  return s.substring(0, i+1)
}
function strip(s) {
  if (s == null || s == "") return s
  s2 = stripHead(s)
  s2 = stripTail(s)
  return s2
}
function isBlank(s) {
  if (s == null || s == "") return true
  s2 = stripHead(s)
  if (s2 == null  || s2 == "") return true
  return false
}
function validateContactForm(theform) {
  if (isBlank(theform.first_name.value)) {
    alert("First Name cannot be empty");
	theform.first_name.focus();
    return false
  } 
  else if (isBlank(theform.last_name.value)) {
    alert("Last Name cannot be empty");
	theform.last_name.focus();
    return false
  }
 else if (isBlank(theform.email.value)) {
    alert("Email Address cannot be empty");
	theform.email.focus();
    return false
  }
  else if (isBlank(theform.subject.value)) {
    alert("Subject cannot be  empty");
	theform.subject.focus();
    return false
  }
  else if (isBlank(theform.body_text.value)) {
    alert("Comments cannot be Empty");
	theform.body_text.focus();
    return false
  }else{
  return true;
	}
}
function doPostToServlet()
{
	selectedCategoryInx = document.contactUsForm.category.selectedIndex;
    if (selectedCategoryInx == 0) {
    alert("Please select a category");
	document.contactUsForm.category.focus();
    return;
    }
	document.contactUsForm.hiddenCategory.value = document.contactUsForm.category.options[selectedCategoryInx].value; 
	selectedTypeOfProbInx = document.contactUsForm.type_of_problem.selectedIndex;
    if (selectedTypeOfProbInx == 0) {
    alert("Please select a problem type");
	document.contactUsForm.type_of_problem.focus();
    return;
    }
	document.contactUsForm.hiddenTypeOfProb.value = document.contactUsForm.type_of_problem.options[selectedTypeOfProbInx].value;
    if (validateContactForm(document.contactUsForm)) {
	    document.contactUsForm.submit();
    }else{
		return;
	}
}
function clearForm()
{	
	document.contactUsForm.first_name.value = "";
	document.contactUsForm.last_name.value = "";
	document.contactUsForm.email.value = "";
	document.contactUsForm.subject.value = "";
	document.contactUsForm.body_text.value = "";
}

function GetCookie(cookieName){

    var cookie = ""+document.cookie;
    var index = cookie.indexOf(cookieName + "=");
    if (-1 == index) return "";
    index = cookie.indexOf("=", index) + 1;
    var endstr = cookie.indexOf(";", index);
    if (-1 == endstr) endstr = cookie.length;
    var theCookie = unescape(cookie.substring(index, endstr));
    if ((theCookie == "") || (theCookie == null) || (theCookie == "null") || (theCookie.indexOf("undefined") >= 0) || (theCookie == (cookieName + "="))) theCookie = "";
    return theCookie;
}

function helpOnCookie() {
    window.open("/lx1/authentication/cookiehelp.jsp","","HEIGHT=260,WIDTH=400");
}
function helpOnIE() {
    window.open("/lx1/authentication/enabling_cookie_IE.jsp","","HEIGHT=260,WIDTH=400");
}
function helpOnNC() {
    window.open("/lx1/authentication/enabling_cookie_NC.jsp","","HEIGHT=180,WIDTH=400");
}

