<!--
function errortrap(msg,url,line){
	return true;
}
onerror=errortrap;

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function goBack()
{
	if (history)
		history.go(-1);
}

function changePage(URL)
{
	location.href=URL;
}

function openPopup(URL)
{
	var WWidth=500;
	var WHeight=500;
	var centerx=(screen.width-WWidth)/2; 
	var centery=(screen.height-WHeight)/2;
			
	PDFwin=window.open(URL,"PDFProof","height=" + WHeight + ",innerHeight=" + WHeight + ",width=" + WWidth + ",innerwidth=" + WWidth + ",top=" + centery + ",left=" + centerx + ",resizable=1,scrollbars=1,menubar=0,dependent=1");					
	if (PDFwin) PDFwin.focus();	
}

function openComments(IID)
{
	var WWidth=500;
	var WHeight=230;
	var centerx=(screen.width-WWidth)/2; 
	var centery=(screen.height-WHeight)/2;
			
	PDFwin=window.open("cstmr_wine_comments.aspx?ID=" + IID,"Comments","height=" + WHeight + ",innerHeight=" + WHeight + ",width=" + WWidth + ",innerwidth=" + WWidth + ",top=" + centery + ",left=" + centerx + ",resizable=1,scrollbars=1,menubar=0,dependent=1");					
	if (PDFwin) PDFwin.focus();	
}

function closeComments()
{
	if (window && window.opener)
		window.opener.changePage('cstmr_wine_inventory_listing.aspx');

	window.close();
}

function setFocus(ID)
{
	var elm = getElement(ID);
	if (elm && !elm.disabled)
		elm.focus();
}

var currentField = "";
var startupFocusField = "";

function hiLiteBtn(elm)
{		
	if (elm && elm.className && elm.className.substring(0,3) == 'btn')
		{
			if (elm.className.substring(elm.className.length - 6) != '_focus')
				elm.className = elm.className + '_focus';			
		}
}

function blurBtn(elm)
{	
	if (elm && elm.className && elm.className.substring(0,3) == 'btn')
		{	
			if (elm.className.length > 6 && elm.className.substring(elm.className.length - 6) == '_focus')
					elm.className = elm.className.substring(0,elm.className.length - 6);								
		}
}


function textFocus(textbox)
{
	if (textbox && textbox.className)
		{					
			textbox.className = 'textbox_focus';
			hiLite(textbox.id);						
		}
	
}

function textBlur(textbox)
{
	if (textbox && textbox.className)
			textbox.className = 'textbox';
}

function hiLite(ID)
{
	var elm = getElement(ID);
	if (elm)
		{
			currentField = ID;
			if (elm.select)
				elm.select();
		}
}

/* This will hi-lite any element */
function clearValue(elm)
{
	if (elm)
		elm.value='';
}

function clearCombo(elm)
{
	if (elm)
		elm.selectedIndex=0;
}

function setComboValue(ID, setValue)
{
	var elm = getElement(ID);
	if (elm && elm.options)
		for (var i=0; i<elm.options.length; i++)
			if (elm.options[i].value == setValue)
				elm.options[i].selected = true;
}

/* This will submit any form */
function submitForm(ID)
{
	var elm = getElement(ID);
	if (elm)
		elm.submit();
}


/* This is called in the body onload event to set inital focus */
function initialFocus(ID)
{
	setTimeout("setFocus('" + ID + "')",1);
}

/* This returns the element for an ID passed */
function getElement(ID)
{
	return MM_findObj(ID)
}

function confirmMessage(msg)
{
	if (confirm(msg)==true)
		return true;
	else
		return false;
}
function hide(E)
{
	var elm = getElement(E);
	if (elm && elm.visibility)
		elm.visibility = "hidden";		
	else if (elm && elm.style)
		elm.style.visibility = "hidden";	
}
function show(E)
{
	var elm = getElement(E);
	if (elm && elm.visibility)
		elm.visibility = "visible";		
	else if (elm && elm.style)
		elm.style.visibility = "visible";	
}

function showReport(SortOrder, BoxID, VineYardID, RegionID, WineTypeID, BottleSizeID)
{	
	oWindow=window.open("report.aspx?s=" + SortOrder + "&Bx=" + BoxID + "&V=" + VineYardID + "&R=" + RegionID + "&W=" + WineTypeID + "&Bs=" + BottleSizeID ,"","resizable=1,menubar=0,dependent=1");					
	if (oWindow) oWindow.focus();	
}
//-->