			function clickMap(form, x, y) {
				if(form.infoChecked.value=='true') {
					window.open('BranchDetailPopup.aspx?X1='+x+'&Y1='+y, 'search', 'width=520, height=650, left=25, top=25, resizable=no, scrollbars=yes');
					return false;
				}
				//if(form.bufferChecked.value=='true') {
				//	form.X1.value = x;
				//	form.Y1.value = y;
				//	return true;
				//}
			}
			
			function setCoords(e, form)
			{
			// Here updated New Code and this support Both of Browsers.[11/08/2006]
			//START
				if (window.event) {					
					//This value Show in IE Browsers.
					form.X2.value = e.offsetX;
					form.Y2.value = e.offsetY;
				} else if (e.target) {
					//This value Show in NS Browsers.
					var coords = {x: 0, y: 0 };
					var el = e.target;
					do {
						coords.x += el.offsetLeft;
						coords.y += el.offsetTop;
					}
					while ((el = el.offsetParent));			
						var offsetX = e.pageX - coords.x;
						var offsetY = e.pageY - coords.y;
					form.X2.value = offsetX;
					form.Y2.value = offsetY;
				}
			//END
				//if (!e) {
				//	e = window.event;
				//}

				//form.X2.value = e.offsetX;
				//form.Y2.value = e.offsetY;
			}

			var doDrag;
			var startPosX, startPosY, endPosX, endPosY;
		    var map_width = document.branchmapform.MapWidth.value;
   			var map_height = document.branchmapform.MapHeight.value;
   			var tool;
   			var colorTableName;

			function ehMouseUp(e, form) {
				doDrag=false;
				var theDiv = document.getElementById('myDiv');
				theDiv.style.visibility='hidden';
				theDiv.style.cursor = 'auto';
				form.X2.value = endPosX;
				form.Y2.value = endPosY;
				return false;
			}
			
			function ehMouseDown(e, form) {
				var theDiv = document.getElementById('myDiv');			
				if (!e) {
					e = window.event;
				}

				tool='';
				
				if (form.lassoChecked.value=='true' || form.bufferChecked.value=='true')
				{
					tool='lasso';
					form.X1.value = e.offsetX;
					form.Y1.value = e.offsetY;
					
					var mouseX = 0;
					var mouseY = 0;
					mouseX = event.clientX + document.body.scrollLeft;
					mouseY = event.clientY + document.body.scrollTop;
	        
					if(mouseX > document.branchmapform.MapWidth.value) {
						mouseX = document.branchmapform.MapWidth.value;
					}

					doDrag=true;					
					//move div to mouse
					theDiv.style.visibility='visible';
					
					if (form.bufferChecked.value=='true') {
						theDiv.style.borderColor = '#FF0000';
						theDiv.style.borderTopColor = '#FF0000';
						theDiv.style.borderBottomColor = '#FF0000';
						theDiv.style.borderLeftColor = '#FF0000';
						theDiv.style.borderRightColor = '#FF0000';
					}

					theDiv.style.posLeft = e.offsetX;
					theDiv.style.posTop = e.offsetY;
					
					startPosX=e.offsetX;
					startPosY=e.offsetY;
					
					//resize div
					theDiv.style.width=0;
					theDiv.style.height=0;  
					
				}
				else if (form.panChecked.value=='true')
				{
					theDiv.style.visibility='visible';
					theDiv.style.cursor = 'move';
					form.X1.value = e.offsetX;
					form.Y1.value = e.offsetY;
					startPosX=e.offsetX;
					startPosY=e.offsetY;
					doDrag=true;					
					tool='pan';
				}
				
				return false;
			}
   
			function setAction(form, s)
			{
				form.Action.value = s;
			}
			
			function sldMouseMove(e) {
				if (!e) {e = window.event}

//				window.status = "e.X:" + e.offsetX + ", e.Y:" + e.offsetY + " startPosX" + startPosX + ", startPosY:" + startPosY;
				
				if (tool=='lasso'){
					if (doDrag) {
						dragIt(e);
					}     
				}
				else if (tool=='pan'){
					if (doDrag) {
						moveIt(e);
					}     
				}
				return false;
			}
			

			function moveIt(e){
				var theMap=document.getElementById('PageTemplate__ctl0_Mapcontrol1_EsriMapTemplate1_ImageButtonMap');
																
				mouseX = e.offsetX;
				mouseY = e.offsetY;

				var dX=(mouseX-startPosX)/2;
				var dY=(mouseY-startPosY)/2;

				theMap.style.left=(parseInt(theMap.style.left)+dX);
				theMap.style.top=(parseInt(theMap.style.top)+dY);

				endPosX = startPosX+(parseInt(theMap.style.left));
				endPosY = startPosY+(parseInt(theMap.style.top));
			}
			
			function dragIt(e) {
				var theDiv = document.getElementById('myDiv');
				mouseX = window.event.offsetX;
				mouseY = window.event.offsetY;
				if(mouseX > parseInt(map_width) + e.offsetX) {
					theDiv.style.visibility='hidden';
				}
				if(mouseY > parseInt(map_height) + e.offsetY) {
					theDiv.style.visibility='hidden';
				}
				
				theWidth = mouseX - startPosX;
				theHeight = mouseY - startPosY;
				if(theWidth>0&&theHeight>0) { 
					theDiv.style.width=theWidth;
					theDiv.style.height=theHeight;
				}
				else if(theWidth==0 && theHeight==0){
					document.__aspnetForm.BlockForm.value ='true';
					theDiv.style.visibility='hidden';
				}
				return false;

			}
 
<!-- Javascript to move items between list boxes -->
<!-- Begin
sortitems = 0;  // Automatically sort items within lists? (1 or 0)

function move(fboxIn,tboxIn) {
	var fbox = document.getElementById(fboxIn);
	var tbox = document.getElementById(tboxIn);
	for(var i=0; i<fbox.options.length; i++) {
		if(fbox.options[i].selected && fbox.options[i].value != "") {
			var no = new Option();
			no.value = fbox.options[i].value;
			no.text = fbox.options[i].text;
			tbox.options[tbox.options.length] = no;
			fbox.options[i].value = "";
			fbox.options[i].text = "";
		}
	}
	BumpUp(fbox);
	if (sortitems) SortD(tbox);
}

function BumpUp(box) {
	for(var i=0; i<box.options.length; i++) {
		if(box.options[i].value == "") {
			for(var j=i; j<box.options.length-1; j++) {
				box.options[j].value = box.options[j+1].value;
				box.options[j].text = box.options[j+1].text;
			}
			var ln = i;
			break;
		}
	}
	if(ln < box.options.length) {
		box.options.length -= 1;
		BumpUp(box);
	}
}

function SortD(box) {
	var temp_opts = new Array();
	var temp = new Object();
	for(var i=0; i<box.options.length; i++) {
		temp_opts[i] = box.options[i];
	}
	for(var x=0; x<temp_opts.length-1; x++) {
		for(var y=(x+1); y<temp_opts.length; y++) {
			if(temp_opts[x].text > temp_opts[y].text)  {
				temp = temp_opts[x].text;
				temp_opts[x].text = temp_opts[y].text;
				temp_opts[y].text = temp;
			}
		}
	}
	for(var i=0; i<box.options.length; i++) {
		box.options[i].value = temp_opts[i].value;
		box.options[i].text = temp_opts[i].text;
   }
}

function RGBtoHex(R,G,B) {
	a = GiveHex(Math.floor(R / 16));
	b = GiveHex(R % 16);
	c = GiveHex(Math.floor(G / 16));
	d = GiveHex(G % 16);
   	e = GiveHex(Math.floor(B / 16));
   	f = GiveHex(B % 16);
   	z = a + b + c + d + e + f;

  	return '#'+ z;
}
function GiveHex(Dec) {
	if(Dec == 10)
	Value = 'A';
	else
	if(Dec == 11)
	Value ='B';
	else
	if(Dec == 12)
	Value = 'C';
	else
	if(Dec == 13)
	Value = 'D';
	else
	if(Dec == 14)
	Value = 'E';
	else
	if(Dec == 15)
	Value = 'F';
	else
	Value = '' + Dec;
	return Value;
}
function stopSubmit(form) 
{
	if(form.blockSubmit.value=='true') {
		return false;
	}
	else {
		return true;
	}
}

var busy = 'false';

function checkStatus(buttonID){
	var search = document.getElementById(buttonID);
	if (busy == 'true'){
		search.disabled = true;
		return false;
	}
	else{
		busy = 'true';
		return true;
	}
}

function handle_Click(buttonID){
	var button = document.getElementById(buttonID);
	if (event.keyCode == 13){
		button.click();
		event.keyCode = 0
		//return false;
	}
}	


// End -->


