function SearchLocationRender(){

 window.flr = this;
 this.ptype = "location";
 this.htmlTitleId = "ploc";
 
}

//function render(object,contentRenderer){
SearchLocationRender.prototype.render = function(object,htmlElementId){

	var textBox = document.getElementById(htmlElementId);
	var titleBox = null;
	if (this.htmlTitleId) titleBox = document.getElementById(this.htmlTitleId);
	// if (this.ptype == undefined) this.ptype = "location";
	
	// clear textbox.
	while(textBox.childNodes.length > 0){
	  	textBox.removeChild(textBox.childNodes.item(0));
	}

	var setList = object.getElementsByTagName("set");
	if (setList && setList != null && setList.length > 0) {
	
		for(var i = 0 ; i < setList.length ; i++){
  			
  			var node = setList[i];
  	  		var type = node.getAttribute("type");
  			
  			if (type==this.ptype) { 

	  			var cSRDiv = document.createElement("div");
				// cSRDiv.className = "categorisedSearchResult";
			    cSRDiv.className = "parametricResult";
			
  	  			var rubrikSpan = document.createElement("span");
  	  			rubrikSpan.className = "rubrik";
  	  	
  	  			if (type=="location") {

  	  				
 					levelStr = "l\u00e4n";
					if (node.getAttribute("level") == "2") levelStr = "kommuner";
					if (node.getAttribute("level") == "3") levelStr = "orter";
				
					// cSRDiv.id = "locationdiv";
  	  				rubrikSpan.appendChild(document.createTextNode(" dina tr\u00e4ffar uppdelat p\u00e5 "+levelStr+": "));
  	  			
  	  				textBox.appendChild(rubrikSpan);
  	  				if (titleBox) titleBox.innerHTML = levelStr;
				
					var locationName = node.getAttribute("name");				
				
				} else {

					rubrikSpan.appendChild(document.createTextNode("i resultatet finns dessutom dessa kategorier: "));
  	  				textBox.appendChild(rubrikSpan);
  	  			
  	  			}
  	  		
  	  			var valList = node.getElementsByTagName("val");
  	  		
  	  			for (var j = 0; j < valList.length; j++) {
					var val = valList[j];
	  	  		
	 	 	  		var a = document.createElement("a");
	  		  		var name = val.getAttribute("name");
  			  	  	a.className = "phint";
  			  	  	if (val.firstChild && val.firstChild.nodeValue){
  			  	  		a.setAttribute("alt",val.firstChild.nodeValue); 
  			  	  	}
  			  	  	a.href="search";
  			  	  	a.val=name;
  			  	  	a.appendChild(document.createTextNode(name+"("+val.getAttribute("count")+")"));
  		  	  	
  			  	  	if (type=="location"){	  	  	
  			  	  	    a.onclick = function() { findL(this.val);return false;}
  			  	  	} else {
  			  	  	    a.onclick = function() { findQ(document.getElementById("q").value+", "+this.val);return false;}
  			  	  	}
  		  	  	    
  		  	  	    if (j > 0){ cSRDiv.appendChild(document.createElement("br")); } 
  		  	  	    cSRDiv.appendChild(a);
  		  	  	    
  	  			}
  	  			
  	   	 		textBox.appendChild(cSRDiv);
  	 		
 	 	 		//open locations from start.
  		 		if(cSRDiv.id == "locationdiv"){
  		 			SearchListRender.openFirmInfo("location");
  		 		}
  	 		
  	 		   textBox.appendChild(document.createElement("br"));
			}else{
				
			}
 	    }
	}else{
		textBox.appendChild($t("Inga tr\u00e4ffar."));
	}
}
