function loadApplication(location,title,features) {
	if(location!= null && title!=null && features!=null) {
		loadNewWindow(location,title,features);
		//closeWindow();
	}				
}	

function loadNewWindow(location,title,features) {
	var sourceWindow;

	sourceWindow=window.open(location,title,features);
	sourceWindow.focus();
}

function loadNews(location)
  {
  loadNewWindow(location,'popnews','width=610, height=450, scrollbars=1, location=0, status=1, menubar=1, resizable=1, toolbar=1');
  }

function loadPrint()
  {
  window.print();
  closeWindow();
  }

function closeWindow() {
	var thisWindow; 
	thisWindow = window.self;
	thisWindow.opener = window.self;
	thisWindow.close();
}

function btnSubmitClicked() {
	submitForm();
}

function btnSubmitPricing() {
	submitFormPricing();
}

function btnNoSearchClicked() {
	document.aspnetForm.hidNoSearchClicked.value = "true";
}

function submitForm() {
	document.aspnetForm.submit();
}

function submitaspnetForm() {
	document.aspnetForm.method = "post"
	document.aspnetForm.action = "pharmacy_search.aspx"
	document.aspnetForm.submit();	
}

function btnSubmitClickedS() {
	document.frmLocatorS.submit()
}

function btnSubmitClicked_751() {
	document.aspnetForm.submit()
}

function btnSubmitClicked_100() {
	document.aspnetForm.submit()
}

function submitFormPricing() {
	document.aspnetForm.method = "post"
	document.aspnetForm.action = "hsdp_step4.aspx"
	document.aspnetForm.submit();
}

//Menu and rollover
function show_menu(mname)
  {
  document.getElementById(mname).style.visibility = "visible";
  }
  
function hide_menu(mname)
  {
  document.getElementById(mname).style.visibility = "hidden";
  }
  
function rover(roname, rocolor)
  {
  document.getElementById(roname).style.backgroundColor = rocolor;
  //document.getElementByID('td_photo').style.backgroundImage = url(../images/photo
  }
  
function rout(roname, rocolor)
  {
  document.getElementById(roname).style.backgroundColor = rocolor;
  //document.getElementByID('td_photo').style.backgroundPosition = pos;
  }
  
function getObjRow(ID)
  {
  var tr
  tr = eval("document.all." + ID + ".style")
  return tr;
  }

function highlightrow(ID, color)
  {
  var tr
  tr = getObjRow(ID)
  tr.backgroundColor = color
  }
  
function FilterKeys()
  {
  if (8==window.event.keyCode)
    {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
    return false; return false;
    }
  }
  
//use onchange="runcheck()" in srcElement
function runcheck(){
	var element = event.srcElement;
	var n = event.srcElement.value;
	//var pattern = '(xxx)xxx-xxxx';
	var pattern = 'xxx-xxx-xxxx';
	var tstr = "" + n;
	var Findex = 0;
	var Nindex = 0;
	var rex = /[ A-Za-z\+\(\)\-]/;
	var parts = tstr.split(rex);
	
	strProcessed = parts.join("");
	var formatted = "";
	while(Nindex < strProcessed.length){
		if(formatted.length == pattern.length) break;
		while(pattern.charAt(Findex) != "x"){
			formatted += pattern.charAt(Findex++);}
		Findex++;
		formatted += strProcessed.charAt(Nindex++);}
	element.value = formatted;
	}
	
function showProcessingMsg(pStrId) {
		document.getElementById(pStrId).style.visibility='hidden';
		document.getElementById(pStrId).style.display='none';
		document.getElementById('divProcessingMsg').style.visibility='visible';
		document.getElementById('divProcessingMsg').style.display='inline';
	}

var timerID = null;
var timerRunning = false;
var timeValue = 400;
var count = 0;
var finish = false;
//load up the images for the progress bar
image00 = new Image(); image00.src='images/image-00.gif';
image01 = new Image(); image01.src='images/image-01.gif';
image02 = new Image(); image02.src='images/image-02.gif';
image03 = new Image(); image03.src='images/image-03.gif';
image04 = new Image(); image04.src='images/image-04.gif';
image05 = new Image(); image05.src='images/image-05.gif';
image06 = new Image(); image06.src='images/image-06.gif';
image07 = new Image(); image07.src='images/image-07.gif';
image08 = new Image(); image08.src='images/image-08.gif';
image09 = new Image(); image09.src='images/image-09.gif';
image10 = new Image(); image10.src='images/image-10.gif';
image11 = new Image(); image10.src='images/image-11.gif';
image12 = new Image(); image10.src='images/image-12.gif';
image13 = new Image(); image10.src='images/image-13.gif';
image14 = new Image(); image10.src='images/image-14.gif';
image15 = new Image(); image10.src='images/image-15.gif';


function increment() {
	count += 1;
	if (count == 0) {document.images.bar.src=image00.src;}
	if (count == 1) {document.images.bar.src=image01.src;}
	if (count == 2) {document.images.bar.src=image02.src;}
	if (count == 3) {document.images.bar.src=image03.src;}
	if (count == 4) {document.images.bar.src=image04.src;}
	if (count == 5) {document.images.bar.src=image05.src;}
	if (count == 6) {document.images.bar.src=image06.src;}
	if (count == 7) {document.images.bar.src=image07.src;}
	if (count == 8) {document.images.bar.src=image08.src;}
	if (count == 9) {document.images.bar.src=image09.src;}
	if (count == 10) {document.images.bar.src=image10.src;}
	if (count == 11) {document.images.bar.src=image11.src;}
	if (count == 12) {document.images.bar.src=image12.src;}
	if (count == 13) {document.images.bar.src=image13.src;}
	if (count == 14) {document.images.bar.src=image14.src;}
	//repeat the bar continuously:
	//if (count == 15) {document.images.bar.src=image15.src; count=-1;}
	//stop repeating the bar:
	if (count == 15) {document.images.bar.src=image15.src; end();}
}

function stopclock() {
	if (timerRunning)
		clearInterval(timerID);
	timerRunning = false;	
}

function end() {
	if (finish == true) {
		stopclock();
		window.close();
	}
	else {
		finish = true; 
	}
}

function startclock() {		
	stopclock();
	timerID = setInterval("increment()", timeValue);
	timerRunning = true;
	document.images.bar.src=image00.src;
}

function Send_onclick(frmSubmit) {
	startclock();
	frmSubmit.submit();			
}
	

function selectRad(index)
    {
        if (document.getElementById('ctl00_flHolder_radQuantity0')) {
            var rad0 = document.getElementById('ctl00_flHolder_radQuantity0');
        }
        if (document.getElementById('ctl00_flHolder_radQuantity1')) {
            var rad1 = document.getElementById('ctl00_flHolder_radQuantity1');
        }
        if (document.getElementById('ctl00_flHolder_radQuantity2')) {
            var rad2 = document.getElementById('ctl00_flHolder_radQuantity2');
        }
        if (document.getElementById('ctl00_flHolder_radQuantity3')) {
            var rad3 = document.getElementById('ctl00_flHolder_radQuantity3');
        }
    if (index == 3){
            rad0.checked = false
            rad1.checked = false
            rad2.checked = false
            rad3.checked = true
        }
    if (index == 2){
            rad0.checked = false
            rad1.checked = false
            rad2.checked = true
        }
    if (index == 1) {
            rad0.checked = false
            rad1.checked = true
        }
    }

    function clearBox(index) {
        document.getElementById('ctl00_flHolder_txtDrugQty').value = "";
    }
