
function getID(obj){
	return document.getElementById(obj);
}

String.prototype.trim = function(){
	return this.replace(/(^\s*)|(\s*$)/g, '');
}

var map = null;

function zoomControl(obj){
	var currentZoom = obj.GetZoomLevel();

	if(currentZoom > zoomMax){
		map.SetZoomLevel(zoomMax);
	}else if(currentZoom < zoomMin){
		map.SetZoomLevel(zoomMin);
	}
}

function ResizeMap(){
	var intWidth = 0;
	if(getID('divCategories') || getID('divCompanies')){
        intWidth = 300;
	}

	if(typeof(window.innerWidth)=='number'){
		//Non-IE
		getID('myMap').style.width = (window.innerWidth - intWidth) + 'px';
		getID('myMap').style.height = window.innerHeight + 'px';

		if(getID('divCategories'))
			getID('divCategories').style.height = (window.innerHeight - 95) + 'px';
		if(getID('divCompanies'))
			getID('divCompanies').style.height = (window.innerHeight - 95) + 'px';

		if(getID('divNav'))
			getID('divNav').style.left = (window.innerWidth - 115) + 'px';

		getID('divBottom').style.left = ((window.innerWidth - 420) / 2) + 'px';
		getID('divBottom').style.top = (window.innerHeight - 49) + 'px';
	}else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)){
		//IE 6+ in 'standards compliant mode'
		getID('myMap').style.width = (document.documentElement.clientWidth - intWidth) + 'px';
		getID('myMap').style.height = document.documentElement.clientHeight + 'px';

		if(getID('divCategories'))
			getID('divCategories').style.height = (document.documentElement.clientHeight - 95) + 'px';
		if(getID('divCompanies'))
			getID('divCompanies').style.height = (document.documentElement.clientHeight - 95) + 'px';

		if(getID('divNav'))
			getID('divNav').style.left = (document.documentElement.clientWidth - 115) + 'px';

		getID('divBottom').style.left = ((document.documentElement.clientWidth - 420) / 2) + 'px';
		getID('divBottom').style.top = (document.documentElement.clientHeight - 49) + 'px';
	}

	if(getID('divNav'))
		getID('divNav').style.display = 'block';

	getID('divBottom').style.display = 'block';
}

function DisposeMap(){
	if(map!=null){
		map.Dispose();
		map = null;
	}
}

function createRequestObject(){
	var request_o; //declare the variable to hold the object.
	var browser = navigator.appName; //find the browser name
	if(browser == "Microsoft Internet Explorer"){
		/* Create the object using MSIE's method */
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		/* Create the object using other browser's method */
		request_o = new XMLHttpRequest();
	}
	return request_o; //return the object
}

var http = createRequestObject();

function findPosX(obj){
	var curleft = 0;
	if (obj.offsetParent){
		while (obj.offsetParent){
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	}else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj){
	var curtop = 0;
	if (obj.offsetParent){
		while (obj.offsetParent){
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	}else if (obj.y)
		curtop += obj.y;
	return curtop;
}


