﻿//Character Count Script
function KeyUpdate(varTxt, varCount) {
    var maxLength = document.getElementById(varTxt).getAttribute("maxlength");
    var text = document.getElementById(varTxt);
    var control = document.getElementById(varCount);
    if (text.value.length > maxLength) {
        text.value = text.value.substring(0, maxLength);
    }
    else {
        control.innerText = maxLength - text.value.length;
    }
}

//Oen new window from drop down
function NewWindow() {
    var control = document.getElementById('SiteDropDown');
    //alert('This will open a new window');		
    window.open(control.value, 'this', '', '');
   
}

//submits form for Product code searches
function submitForm(theForm) {
var lotNum;
var codeNum;
  	codeNum=document.getElementById('WPQ3ndc').value.replace(/-/g, "");
  	lotNum=document.getElementById('WPQ3lot').value.toUpperCase();
	//alert('This will open a new window');
    	myWindow = window.open('http://ctr.bms.com/cpsc/CertificateServlet?ndc=' + codeNum + '&lot=' + 	lotNum,'mywin','left=20,top=20,width=500,height=500,toolbar=1,resizable=1');
    	myWindow.focus();
}