function OpenCustomWindow(sUrl, sName, nWidth, nHeight, bScrollBars, bToolBar, bLocation, bResizable, bMenuBar, bStatus, nX, nY) {
   if ((typeof nWidth == 'undefined') || (nWidth == null)) nWidth = 600;
   if ((typeof nHeight == 'undefined') || (nHeight == null)) nHeight = 400;
   if ((typeof bScrollBars == 'undefined') || (bScrollBars == null)) bScrollBars = false;
   if ((typeof bToolBar == 'undefined') || (bToolBar == null)) bToolBar = false;
   if ((typeof bLocation == 'undefined') || (bLocation == null)) bLocation = false;
   if ((typeof bResizable == 'undefined') || (bResizable == null)) bResizable = false;
   if ((typeof bMenuBar == 'undefined') || (bMenuBar == null)) bMenuBar = false;
   if ((typeof bStatus == 'undefined') || (bStatus == null)) bStatus = false;
   if ((typeof nX == 'undefined') || (nX == null)) nX = 1;
   if ((typeof nY == 'undefined') || (nY == null)) nY = 1;
  
   var param = "width=" + nWidth + ",height=" + nHeight 
                                 + ",scrollbars=" + (bScrollBars ? "yes" : "no")
                                 + ",toolbar=" + (bToolBar ? "yes" : "no")
                                 + ",menubar=" + (bMenuBar ? "yes" : "no")
                                 + ",location=" + (bLocation ? "yes" : "no")
                                 + ",resizable=" + (bResizable ? "yes" : "no")
                                 + ",status=" + (bStatus ? "yes" : "no")
                                 + ((nX != -1) ? ",left=" + nX : "" )
                                 + ((nY != -1) ? ",top=" + nY : "" );
    
   window.open(sUrl, sName == null ? "" : sName, param);
}


var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
	var keyCode = (isNN) ? e.which : e.keyCode; 
	var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
	if(input.value.length >= len && !containsElement(filter,keyCode)) 
	{
		input.value = input.value.slice(0, len);		
		input.form[(getIndex(input)+1) % input.form.length].focus();
	}

	function containsElement(arr, ele) 
	{
	var found = false, index = 0;
	while(!found && index < arr.length)
		if(arr[index] == ele)
		found = true;
		else
		index++;
	return found;
	}

	function getIndex(input) 
	{ 
		var index = -1, i = 0, found = false;
		while (i < input.form.length && index == -1)
		if (input.form[i] == input)index = i;
		else i++;
		return index;
	}
	return true;
}


