function openwin(url){
	Window = window.open(url, 'Win', 'width=180,toolbar=no,resizable=no,scrollbars=yes');
    Window.focus();
}
function disableRightClick(e)
{
  var message = "";
  
  if(!document.rightClickDisabled) // initialize
  {
    if(document.layers) 
    {
      document.captureEvents(Event.MOUSEDOWN);
      document.onmousedown = disableRightClick;
    }
    else document.oncontextmenu = disableRightClick;
    return document.rightClickDisabled = true;
  }
  if(document.layers || (document.getElementById && !document.all))
  {
    if (e.which==2||e.which==3)
    {
      //alert(message);
      return false;
    }
  }
  else
  {
    //alert(message);
    return false;
  }
}
disableRightClick();
function describe(text){
    window.status = text;
    return true;
}function clearstatus(){
    window.status="";
}function hideprint(){
		print(document); 
		//self.close();
	}function testprint()	{
		if(document.getElementById('myprint').click)	{
		print(document.getElementById('pp'));
		}
}
function handleEnter (field, event) {
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if (keyCode == 13) {
			var i;
			for (i = 0; i < field.form.elements.length; i++)
				if (field == field.form.elements[i])
					break;
			i = (i + 1) % field.form.elements.length;
			field.form.elements[i].focus();
			return false;
		} 
		else
		return true;
}  
	
function controlPrintButton()	{
	var total = document.orderform.totspan.value;
	var newtt = document.getElementById('ddp');			with(newtt, total)	{
				///CHECK BOX
				if(document.orderform.IsMedicare.checked)	{
					///MEDICARE SALES
					if(document.orderform.collectedby.value == '')	{
						document.orderform.printbut.disabled = true;
					}	else if(document.orderform.orderedby.value == '')	{
						document.orderform.printbut.disabled = true;
					}	else	{						
						document.orderform.printbut.disabled = false;	
					}
					////END MEDICARE SALES
				}	else	{
						document.orderform.printbut.disabled = false;	
				}
				///END CHECK BOX
		}
	////END EMPTY CASH FIELD
}function recalculate(one)	{
	dtxt = 'txt_' + one;
	dprice = 'price_' + one;
	dtotal = 'total_' + one;
	dsubtotdiv = 'tot_' + one;
	
	thequan = prompt('New Quantity','');
	
	if(isNaN(thequan))	{
		alert('INVALID VALUE');		
		return;
	}
	if(thequan == null)	{
		alert('INVALID VALUE');
		return;	
	}
	if(thequan == '')	{
		alert('INVALID VALUE');		
		return;	
	}
	if(thequan*1 < 0)	{
		alert('INVALID VALUE');
		return;
	}
	theprice = document.getElementById(dprice).value;
	bar = document.getElementById('toptop');
	thefield = document.getElementById(dtotal);
	subtotal = document.getElementById(dtotal).value;	
	gtotal = document.orderform.totspan.value;		
	thetotal = document.getElementById('ddp');	
	sstotal = document.getElementById(dsubtotdiv);
	grosstotal = '0';
	quan_string = "";
	
	with(dtxt, thequan, theprice, thefield, subtotal, gtotal, thetotal, sstotal)	{
		if(isNaN(thequan))	{
			thequan = document.getElementById(dtxt).value = '1';
		}	
		if(thequan == '0')	{
			thequan = document.getElementById(dtxt).value = '1';	
		}
		
		if(thequan == '')	{
			thequan = document.getElementById(dtxt).value = '1';	
		}
		
		sstotal.innerHTML = thequan*theprice;
		thefield.value = thequan*theprice;
		grosstotal = (gtotal-subtotal)+(thequan*theprice);
		thetotal.innerHTML = grosstotal;
		document.orderform.totspan.value = grosstotal;
		bar.innerHTML = '<font color="##000000">Current Total is : </font>' + grosstotal;
		document.getElementById(dtxt).value = thequan;
		document.allform.productnameid_txt.focus();
		
		for(var i = 0; i < document.orderform.elements.length;++ i)	{
		form_field = document.orderform.elements[i];
		form_name = form_field.name;
		
		if(form_name.substring(0,4) == "txt_")	{
			if(quan_string == "")	{
			quan_string = form_field.value;	
			}	else	{
				quan_string = quan_string + "," + form_field.value;	
				}
		}
		}
		document.allform.itids_.value = quan_string;
	}
}function changeColour(elementId) {
var interval = 500;
var colour1 = "red", colour2 = "lightyellow";
if (document.getElementById) {
var ele = document.getElementById(elementId);
if(ele == null)	{}
else	{
if(ele.style.color == colour1)	{
	ele.style.color = colour2;
}	else	{
	ele.style.color = colour1;
}setTimeout("changeColour('" + elementId + "')", interval);
}
}
}