function LaunchVirtuaLab(mylinks) {
  linkwindow = window.open(mylinks,'pc','toolbar=no,location=no,scrollbars=yes,resizable=yes')
  linkwindow.focus()
}

function LaunchRules(mylinks) {
  linkwindow = window.open(mylinks,'pc2','width=400,height=400,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 DisplayFile(file) {
    window.location = "../files/" + file + ".zip";
    return false;
}

function toggleT(_w,_h) {
	if (document.all) { 
		if (_h=='s') 
			eval("document.all."+_w+".style.visibility='visible';");
		if (_h=='h') 
			eval("document.all."+_w+".style.visibility='hidden';");
	} else { 
		if (_h=='s') 
			eval("document.layers['"+_w+"'].visibility='show';");
		if (_h=='h') 
			eval("document.layers['"+_w+"'].visibility='hide';");
	}
}

function DropDownOther() {
  var HowHearVal = document.Form1.HowHear[document.Form1.HowHear.selectedIndex].value;
  
  var OtherBox = getobject('divt1');
  
  if ((HowHearVal == "Other") || (HowHearVal == "Referral")) {
	OtherBox.style.visibility='visible';
  } else {
    OtherBox.style.visibility='hidden';
  }
}

function DropDownTechnology() {
  var HowHearVal = document.Form1.fslTechnology[document.Form1.fslTechnology.selectedIndex].value;
  
  var OtherBox = getobject('divtFSL');
  
  if (HowHearVal == "Other") {
	//toggleT('divt1','s');
	OtherBox.style.visibility='visible';
  } else {
    //toggleT('divt1','h');
    OtherBox.style.visibility='hidden';
  }
}

function Step3SetFields() {
	DropDownGroup();
	DropDownPackage();
	OnCheck1();
	OnCheck2();
	OnCheck3();
	OnCheck4();
	OnCheck5();
	OnCheck6();
	OnCheck7();
	OnCheck8();
	OnCheck9();
	OnCheck10();
	OnCheck11();
	OnCheck12();
	OnCheck13();
	OnCheck14();
	OnCheck15();
	OnCheck16();
	OnCheck17();
}

function DropDownGroup() {
  var HowHearVal = document.Form1.GroupEntry[document.Form1.GroupEntry.selectedIndex].value;
  
  var OtherBox = getobject('GroupEntrySpan');
  
  if (HowHearVal == "Yes") {
	//toggleT('divt1','s');
	OtherBox.style.visibility='visible';
  } else {
    //toggleT('divt1','h');
    OtherBox.style.visibility='hidden';
  }
}

function DropDownPackage() {
  var HowHearVal = document.Form1.Package[document.Form1.Package.selectedIndex].value;
  
  var OtherBox = getobject('PackageSpan');
  
  if (HowHearVal != "Select") {
	//toggleT('divt1','s');
	OtherBox.style.visibility='visible';
  } else {
    //toggleT('divt1','h');
    OtherBox.style.visibility='hidden';
  }
}

function OnCheck1() {
  var OtherBox = getobject('check1');
  if (document.Form1.CheckBox1.checked)
    OtherBox.style.visibility='visible';
  else
    OtherBox.style.visibility='hidden';
}

function OnCheck2() {
  var OtherBox = getobject('check2');
  if (document.Form1.Checkbox2.checked)
    OtherBox.style.visibility='visible';
  else
    OtherBox.style.visibility='hidden';
}

function OnCheck3() {
  var OtherBox = getobject('check3');
  if (document.Form1.Checkbox3.checked)
    OtherBox.style.visibility='visible';
  else
    OtherBox.style.visibility='hidden';
}

function OnCheck4() {
  var OtherBox = getobject('check4');
  if (document.Form1.Checkbox4.checked)
    OtherBox.style.visibility='visible';
  else
    OtherBox.style.visibility='hidden';
}

function OnCheck5() {
  var OtherBox = getobject('check5');
  if (document.Form1.Checkbox5.checked)
    OtherBox.style.visibility='visible';
  else
    OtherBox.style.visibility='hidden';
}

function OnCheck6() {
  var OtherBox = getobject('check6');
  if (document.Form1.Checkbox6.checked)
    OtherBox.style.visibility='visible';
  else
    OtherBox.style.visibility='hidden';
}

function OnCheck7() {
  var OtherBox = getobject('check7');
  if (document.Form1.Checkbox7.checked)
    OtherBox.style.visibility='visible';
  else
    OtherBox.style.visibility='hidden';
}

function OnCheck8() {
  var OtherBox = getobject('check8');
  if (document.Form1.Checkbox8.checked)
    OtherBox.style.visibility='visible';
  else
    OtherBox.style.visibility='hidden';
}

function OnCheck9() {
  var OtherBox = getobject('check9');
  if (document.Form1.Checkbox9.checked)
    OtherBox.style.visibility='visible';
  else
    OtherBox.style.visibility='hidden';
}

function OnCheck10() {
  var OtherBox = getobject('check10');
  if (document.Form1.Checkbox10.checked)
    OtherBox.style.visibility='visible';
  else
    OtherBox.style.visibility='hidden';
}

function OnCheck11() {
  var OtherBox = getobject('check11');
  if (document.Form1.Checkbox11.checked)
    OtherBox.style.visibility='visible';
  else
    OtherBox.style.visibility='hidden';
}

function OnCheck12() {
  var OtherBox = getobject('check12');
  if (document.Form1.Checkbox12.checked)
    OtherBox.style.visibility='visible';
  else
    OtherBox.style.visibility='hidden';
}

function OnCheck13() {
  var OtherBox = getobject('check13');
  if (document.Form1.Checkbox13.checked)
    OtherBox.style.visibility='visible';
  else
    OtherBox.style.visibility='hidden';
}

function OnCheck14() {
  var OtherBox = getobject('check14');
  if (document.Form1.Checkbox14.checked)
    OtherBox.style.visibility='visible';
  else
    OtherBox.style.visibility='hidden';
}

function OnCheck15() {
  var OtherBox = getobject('check15');
  if (document.Form1.Checkbox15.checked)
    OtherBox.style.visibility='visible';
  else
    OtherBox.style.visibility='hidden';
}

function OnCheck16() {
  var OtherBox = getobject('check16');
  if (document.Form1.Checkbox16.checked)
    OtherBox.style.visibility='visible';
  else
    OtherBox.style.visibility='hidden';
}

function OnCheck17() {
  var OtherBox = getobject('check17');
  if (document.Form1.Checkbox17.checked)
    OtherBox.style.visibility='visible';
  else
    OtherBox.style.visibility='hidden';
}

function DisableHowHear() {
  var OtherBox = getobject('divt1');
  OtherBox.style.visibility='hidden';
}

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 DisableSubmitButtonMarketing() {
	document.Form1.Button1.disabled = true;
	document.Form1.marketing.checked = false;
}

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.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;
	} else {
		DisableRegistrationFields();
	}
}

function RegisterOnCheck() {
  if (document.Form1.CheckBox1.checked) {
	document.Form1.Button1.disabled = false;
  } else {
	document.Form1.Button1.disabled = true;
  }
}

function RegisterMarketing() {
  if (document.Form1.marketing.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;
 }
}
