//	AJAX
	function GetXmlHttpObject() {
		var xmlHttp=null;
		try {
			// Firefox, Opera 8.0+, Safari
			xmlHttp = new XMLHttpRequest();
		}
		catch (e) {
			// Internet Explorer
			try {
				xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e) {
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
		return xmlHttp;
	}	
	

//	AJAX SÖK

	var xmlHttp

	function find_it(str) {
		if (str.length==0) { 
			document.getElementById("search_result").innerHTML = "";
			return;
		}
		xmlHttp = GetXmlHttpObject();
		
		if (xmlHttp == null) {
			alert ("Your browser does not support AJAX!");
			return;
		} 
		
		var url = "ajax_search.asp?search=" + str;
		xmlHttp.onreadystatechange = stateChanged;		
		xmlHttp.open("GET", url, true);
		xmlHttp.send(null);
	} 

	function stateChanged() { 
		if (xmlHttp.readyState == 4) { 
			document.getElementById("search_result").innerHTML = xmlHttp.responseText;
		}
	}
	
	function show_hide_result(str) { 
		if (str.length >= 3) { 
			showDiv('sr'); 
		}
		else { 
			hideDiv('sr'); 
		}
	}	

	
//	AJAX KONTOR	
	function office_tel(officeid) {
		if (officeid.length==0) { 
			document.getElementById("office_tel").innerHTML = "";
			return;
		}
		xmlHttp = GetXmlHttpObject();
		
		if (xmlHttp == null) {
			alert ("Your browser does not support AJAX!");
			return;
		} 
		
		var url = "ajax_office.asp?officeid=" + officeid;
		xmlHttp.onreadystatechange = stateChanged2;		
		xmlHttp.open("GET", url, true);
		xmlHttp.send(null);
	} 

	function stateChanged2() { 
		if (xmlHttp.readyState == 4) { 
			document.getElementById("office_tel").innerHTML = xmlHttp.responseText;
		}
	}

//	Visa / Göm DIVS
	var ie, ns, ns6;

	ns6 = (document.getElementById);
	ns = (document.layers);
	ie = (document.all);

	function showObj(obj) {
		if(ie)document.all[obj].style.visibility='visible'
		if(ns)document.layers[obj].visibility='visible'
		if(ns6)document.getElementById(obj).style.visibility = "visible";
	}

	function hideObj(obj) {
		if(ie)document.all[obj].style.visibility='hidden'
		if(ns)document.layers[obj].visibility='hidden'
		if(ns6)document.getElementById(obj).style.visibility = "hidden";
	}

	function createPopup(filename, w, h, scroll)  {
		window.open(filename, '', 'resizable=0,menubar=no,scrollbars=' + scroll + ',location=no,toolbar=0,status=0,directories=no,width=' + w + ',height=' + h);	
	}

	function overlay() {
		if (window.innerHeight && window.scrollMaxY || window.innerWidth && window.scrollMaxX) {
			yScroll = window.innerHeight + window.scrollMaxY;
			xScroll = window.innerWidth + window.scrollMaxX;
			var deff = document.documentElement;
			var wff = (deff&&deff.clientWidth) || document.body.clientWidth || window.innerWidth || self.innerWidth;
			var hff = (deff&&deff.clientHeight) || document.body.clientHeight || window.innerHeight || self.innerHeight;
			xScroll -= (window.innerWidth - wff);
			yScroll -= (window.innerHeight - hff);
		}
		else if (document.body.scrollHeight > document.body.offsetHeight || document.body.scrollWidth > document.body.offsetWidth){ // all but Explorer Mac
			yScroll = document.body.scrollHeight;
			xScroll = document.body.scrollWidth;
		}
		else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			yScroll = document.body.offsetHeight;
			xScroll = document.body.offsetWidth;
		}
		return "<div style=position:absolute; left:0; top:0; height:" + yScroll + "; width:100%; background-color: #FFFFFF; z-index: 100; opacity: .9; filter: alpha(opacity=80);></div>";
	}

	function showDiv(divName) {
		document.getElementById(divName).style.visibility='visible';
	}

	function hideDiv(divName) {
		document.getElementById(divName).style.visibility='hidden';
	}
	
	function ClearTxT(txt)
	{
		if (txt.value == txt.defaultValue)
		{
			txt.value = ""
		}
	}
		

