var iPreviousRow = 0;
var DEFAULT_COLOR = "#ffffff";
var DEFAULT_FONTCOLOR = "#000000";
var HIGHLIGHT_COLOR = "#DAD8D9";
var HIGHLIGHT_FONTCOLOR = "#D31D48";

function highlightRow(iRow)
{
	var o;

	if ( iPreviousRow > 0 ) 
	{

		o = document.getElementById("tr" + iPreviousRow);

		if ( o != null )
		{
			o.style.backgroundColor = DEFAULT_COLOR;
			o.style.color = DEFAULT_FONTCOLOR;	
		}
	}

	o = document.getElementById("tr" + iRow);

	if ( o != null )
	{
		o.style.backgroundColor = HIGHLIGHT_COLOR;
		o.style.color = HIGHLIGHT_FONTCOLOR;
		iPreviousRow = iRow;
	}
}

function enableControls(iRow, sGraphic)
{
	parent.document.getElementById("picProduct").src = sGraphic;
	//parent.document.getElementById("butEdit").disabled = false;
	parent.document.getElementById("butDelete").disabled = false;
}

function enableTextBox(txt)
{
	try
	{
		var o = document.getElementById(txt);
	
		if ( o != null )
			o.focus();
	}
	catch(e)
	{}
}

function toggle( targetId ){ 
  if (document.getElementById){ 
        target = document.getElementById( targetId ); 
           if (target.style.display == "none"){ 
              target.style.display = ""; 
           } else { 
              target.style.display = "none"; 
           } 
     } 
} 

function newwindow(mypage, myname, w, h, scroll, sContent) {
	try	
	{
		var winl = (screen.width - w) / 2;
		var wint = (screen.height - h) / 2;
		winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable';
		win = window.open(mypage, myname, winprops);
		if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
		if (sContent.length > 0){win.document.writeln(sContent);}
	}
	catch(e)
	{
		window.alert('A window was trying to open but was blocked by your browser.\n\nTo view the content unrestrict popups and try again');
	}
	return false;
}
