
function openAWindow( pageToLoad, winName, width, height, center, scroll)
{

	if (winName == 'itdetailWin')
	{
		var idxEquals = pageToLoad.indexOf('=')+1
		pageToLoad = (pageToLoad.substr(0,idxEquals))+(escape(pageToLoad.slice(idxEquals)))
	}
//	
	xposition=10; yposition=10;
		if ((parseInt(navigator.appVersion) >= 4 ) && (center)) {
			xposition = (screen.width - width) / 2;
			yposition = (screen.height - height) / 2;
		}
		 
	args = 'width=' + width + ',';
	args += 'height=' + height + ',';
	args += 'location=0,';
	args += 'menubar=0,';
	args += 'resizable=0,';
	args += 'scrollbars=' + scroll + ',';
	args += 'status=1,';
	args += 'titlebar=0,';
	args += 'toolbar=0,';
	args += 'hotkeys=0,';
	args += 'left=' + xposition + ',';
	args += 'top=' + yposition;

	var objNewWindow = window.open(pageToLoad,winName,args);
	//return objNewWindow;
}

function openImageWindow( pageToLoad, winName, width, height, center, scroll)
{
	if (winName == 'itdetailWin')
	{
		var idxEquals = pageToLoad.indexOf('=')+1
		pageToLoad = (pageToLoad.substr(0,idxEquals))+(escape(pageToLoad.slice(idxEquals)))
	}
//	
	xposition=10; yposition=10;
		if ((parseInt(navigator.appVersion) >= 4 ) && (center)) {
			xposition = (screen.width - width) / 2;
			yposition = (screen.height - height) / 2;
		}
		 
	args = 'width=' + width + ',';
	args += 'height=' + height + ',';
	args += 'location=0,';
	args += 'menubar=0,';
	args += 'resizable=1,';
	args += 'scrollbars=' + scroll + ',';
	args += 'status=1,';
	args += 'titlebar=0,';
	args += 'toolbar=0,';
	args += 'hotkeys=0,';
	args += 'left=' + xposition + ',';
	args += 'top=' + yposition;

	var objNewWindow = window.open(pageToLoad,winName,args);
	//return objNewWindow;
}

function openHelpWindow( pageToLoad, winName, width, height, center, scroll)
{
	if (winName == 'itdetailWin')
	{
		var idxEquals = pageToLoad.indexOf('=')+1
		pageToLoad = (pageToLoad.substr(0,idxEquals))+(escape(pageToLoad.slice(idxEquals)))
	}
//	
	xposition=10; yposition=10;
		if ((parseInt(navigator.appVersion) >= 4 ) && (center)) {
			xposition = (screen.width - width) / 2;
			yposition = (screen.height - height) / 2;
		}
		 
	args = 'width=' + width + ',';
	args += 'height=' + height + ',';
	args += 'location=0,';
	args += 'menubar=0,';
	args += 'resizable=1,';
	args += 'scrollbars=' + scroll + ',';
	args += 'status=1,';
	args += 'titlebar=0,';
	args += 'toolbar=0,';
	args += 'hotkeys=0,';
	args += 'left=' + xposition + ',';
	args += 'top=' + yposition;

	var objNewWindow = window.open(pageToLoad,winName,args);
	//return objNewWindow;
}

function openUPSTrackingWindow(upsUrl, accessKey, trackingNumber)
{
	var width;
	var height;
	var xposition;
	var yposition;
	var args;
	
	width = 800;
	height = 600;
	
	//center window
	xposition = (screen.width - width) / 2;
	yposition = (screen.height - height) / 2;
		 
	args = 'width=800,';
	args += 'height=600,';
	args += 'location=0,';
	args += 'menubar=0,';
	args += 'resizable=1,';
	args += 'scrollbars=1,';
	args += 'status=1,';
	args += 'titlebar=0,';
	args += 'toolbar=0,';
	args += 'hotkeys=0,';
	args += 'left=' + xposition + ',';
	args += 'top=' + yposition;

	var objNewWindow = window.open('','UPS',args);
	
	with(objNewWindow.document) {
		writeln('<HTML>');
		writeln('<HEAD>');
		writeln('<TITLE>UPS Package Tracking</TITLE>');
		writeln('</HEAD>');
		writeln('<BODY onLoad="document.Form1.submit()">');
		writeln('<FORM method="post" action="' + upsUrl + '" ID="Form1" name="Form1"><BR>');
		writeln('<INPUT type="text" size="35" name="InquiryNumber1" ID="Text1" value="' + trackingNumber + '"><BR>');
		writeln('<INPUT type="hidden" name="TypeOfInquiryNumber" value="T" ID="Hidden1"><BR>');
		writeln('<INPUT type="hidden" name="UPS_HTML_License" value="' + accessKey + '" ID="Hidden2"><BR>');
		writeln('<INPUT type="hidden" name="UPS_HTML_Version" value="3.0" ID="Hidden3"><BR>');
		writeln('<INPUT type="hidden" name="IATA" value="us" ID="hidden1"><BR>');
		writeln('<INPUT type="hidden" name="Lang" value="eng" ID="1"><BR>');
		writeln('<INPUT type="submit" name="Submit1" value="Track package(s)" ID="Submit1">');
		writeln('<INPUT type="reset" value="Clear package(s)" ID="Reset1" NAME="Reset1">');
		writeln('</FORM>');
		writeln('</BODY>');
		writeln('</HEAD>');
		close();
		//focus();
	}
	
	objNewWindow.document.forms(0).submit();
}

//Image swap function

function hiLite(imgDocID,imgObjName)
{
	document.images[imgDocID].src = imgObjName;
}
function hiLiteOff(imgDocID,imgObjName)
{
	document.images[imgDocID].src = imgObjName;
}

			/***********************************************
			* Highlight Table Cells Script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
			* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
			* This notice must stay intact for legal use
			***********************************************/

			//Specify highlight behavior. "TD" to highlight table cells, "TR" to highlight the entire row:
			var highlightbehavior="TR";
			var selectedRow;
			var ns6=document.getElementById&&!document.all;
			var ie=document.all;

			function changeto(e, highlightcolor, backgroundColor, isDataGrid) {

				source=ie? event.srcElement : e.target
				
				if (source.tagName=="TABLE")
					return;
					
				while(source.tagName!=highlightbehavior && source.tagName!="HTML")
					source=ns6? source.parentNode : source.parentElement;
			
				if(selectedRow!=null)
					selectedRow.style.backgroundColor=backgroundColor;
					
				if (source.style.backgroundColor!=highlightcolor&&source.id.indexOf("ignore")!=0){
					if (isDataGrid!=null){	//highlight datagrid row
						if (isDataGrid==true){
							if (source.rowIndex>0){
								//alert('source.rowIndex=='+source.rowIndex);
								//alert('source.parentNode.rows.length=='+source.parentNode.rows.length);
								if (source.rowIndex<source.parentNode.rows.length-1){
									source.style.backgroundColor=highlightcolor;
									selectedRow=source;
									//alert('source.Cells(0).innerText=='+source.cells[0].innerHTML);
									var hCode = document.getElementById('hdnCode');

									if (source.cells[0].innerHTML.indexOf("<") > -1)
									    hCode.value = '';
									else
									    hCode.value = source.cells[0].innerHTML;
									    
									//hCode.value = source.cells[0].innerHTML;
									return;
								}
							}
						}
					}
					else {	//highlight table row
						source.style.backgroundColor=highlightcolor;
						selectedRow = source;
						var hRow = document.getElementById('hdnRow');
						hRow.value = source.rowIndex - 2;
					}
				}
			}

			function contains_ns6(master, slave) { //check if slave is contained by master
				while (slave.parentNode)
					if ((slave = slave.parentNode) == master)
						return true;
					
				return false;
			}

			function changeback(e,originalcolor){
				if (ie&&(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id.indexOf("ignore")==0)||source.tagName=="TABLE")
					return;
				else if (ns6&&(contains_ns6(source, e.relatedTarget)||source.id.indexOf("ignore")==0))
					return;
					
				if (ie&&event.toElement!=source||ns6&&e.relatedTarget!=source)
					source.style.backgroundColor=originalcolor;
			}

			function hiLiteFirstRow(source, highlightcolor) {
			    source.style.backgroundColor = highlightcolor;
			    selectedRow = source;
			    var hCode = document.getElementById('hdnCode');

			    if (source.cells[0].innerHTML.indexOf("<") > -1)
			        hCode.value = '';
			    else
			        hCode.value = source.cells[0].innerHTML;
			        
			    return;
			}