function LaunchVirtuaLab(mylinks) {
  var linkwindow = window.open(mylinks,'pc','toolbar=no,location=no,scrollbars=yes,resizable=yes')
  linkwindow.focus()
}

function PopEmailMessage() {
	alert("Please check your email for an email containing a discount code for 25% off on the Texas Instruments' eZ430-F2013.");
}

function getobject(obj) {
  if (document.getElementById)
    return document.getElementById(obj)
  else if (document.all)
    return document.all[obj]
}

function DisableSubmitButton() {
	document.Form1.Button1.disabled = true;
}

function DisableRegistrationFields() {
	var CountryDolid = document.Form1.CountryDropDown[document.Form1.CountryDropDown.selectedIndex].value;
	if (CountryDolid != "39c09e14-4f17-4ae6-9ac6-02d8ace951dc") {
		document.Form1.StateDropDown.disabled = true;
		document.Form1.ZipCode.disabled = true;
		document.Form1.ZipCode.value = "n/a";
		document.Form1.StateDropDown.selectedIndex = 0;
	}
}

function EnableRegistrationFields() {
	var CountryDolid = document.Form1.CountryDropDown[document.Form1.CountryDropDown.selectedIndex].value;
    //alert(document.Form1.CountryDropDown[document.Form1.CountryDropDown.selectedIndex].value);
    if (CountryDolid == "39c09e14-4f17-4ae6-9ac6-02d8ace951dc") {
		document.Form1.StateDropDown.disabled = false;
		document.Form1.ZipCode.disabled = false;
		document.Form1.ZipCode.value = "";
	} else {
		DisableRegistrationFields();
	}
}

function RegisterOnCheck() {
  if (document.Form1.CheckBox1.checked) {
	document.Form1.Button1.disabled = false;
  } else {
	document.Form1.Button1.disabled = true;
  }
}

function SubmitOnCheck() {
  if (document.Form1.CheckBox1.checked) {
	document.Form1.Button1.disabled = false;
	document.Form1.Title.disabled = false;
	document.Form1.filMyFile.disabled = false;
	document.Form1.UserArea.disabled = false;
  } else {
	document.Form1.Button1.disabled = true;
	document.Form1.Title.disabled = true;
	document.Form1.filMyFile.disabled = true;
	document.Form1.UserArea.disabled = true;
  }
}

function ismaxlength(obj){
	var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
	if (obj.getAttribute && obj.value.length>mlength)
		obj.value=obj.value.substring(0,mlength)
}

function textCounter( field, countfield, maxlimit ) {
 if ( field.value.length > maxlimit ) {
  field.value = field.value.substring( 0, maxlimit );
  field.blur();
  field.focus();
  return false;
 } else {
  countfield.value = maxlimit - field.value.length;
 }
}