
//Search web
function WebSearch(areavalue, searcstr){
	document.getElementById("LoadImage").style.visibility='visible';
	indexNew.GetWebResult(areavalue, searcstr, 1, ParseResult);
}
function ParseResult(response){
	
	var ds = response.value;
	if(ds != null && typeof(ds) == "object" && ds.Tables != null){
		
		var s = "";
		var i=0;
		if(ds.Tables[0]!=null){
			//Gå igenom företagen
			for(var j=0; j<ds.Tables[0].Rows.length; j++)
			{
				s = s+"<table id='"+i+"' border='0' cellspacing='0' style='cursor:hand; BORDER-BOTTOM:1px solid gray;' width='100%' onclick='SetPreeView(\""+i+"\");' ondblclick='OpenPage(\""+ds.Tables[0].Rows[j].DocumentId+"\");' border='0' onmouseover='MouseOverResult(\""+i+"\");' onmouseout='MouseOutResult(\""+i+"\");' >";
				s = s+"<tr>";
				s = s+"<td rowspan='2' width='10px' valign='top'><img id='"+i+"' src='images/"+ds.Tables[0].Rows[j].Extension+".gif' border='0' /></td>";
				s = s+"<td class='textTahoma'>" + ds.Tables[0].Rows[j].MetaTitle + "<input type='hidden' id='Id_"+i+"' value='"+ds.Tables[0].Rows[j].DocumentId+"' /><input type='hidden' id='Extension_"+i+"' value='"+ds.Tables[0].Rows[j].Extension+"' /><input type='hidden' id='Title_"+i+"' value='"+ds.Tables[0].Rows[j].MetaTitle+"' /></td>";
				s = s+"</tr>";
				s = s+"</table>";
				i++;
			}
		}
		if(ds.Tables[1]!=null){
			//Gå igenom de taggade
			for(var h=0; h<ds.Tables[1].Rows.length; h++)
			{
				s = s+"<table id='"+i+"' border='0' cellspacing='0' style='cursor:hand; BORDER-BOTTOM:1px solid gray;' width='100%' onclick='SetPreeView(\""+i+"\");' ondblclick='OpenPage(\""+ds.Tables[1].Rows[h].DocumentId+"\");' border='0' onmouseover='MouseOverResult(\""+i+"\");' onmouseout='MouseOutResult(\""+i+"\");' >";
				s = s+"<tr>";
				s = s+"<td rowspan='2' width='10px' valign='top'><img id='"+i+"' src='images/"+ds.Tables[1].Rows[h].Extension+".gif' border='0' /></td>";
				s = s+"<td class='textTahoma'>" + ds.Tables[1].Rows[h].MetaTitle + "<input type='hidden' id='Id_"+i+"' value='"+ds.Tables[1].Rows[h].DocumentId+"' /><input type='hidden' id='Extension_"+i+"' value='"+ds.Tables[1].Rows[h].Extension+"' /><input type='hidden' id='Title_"+i+"' value='"+ds.Tables[1].Rows[h].MetaTitle+"' /></td>";
				s = s+"</tr>";
				s = s+"<tr>";
				s = s+"<td class='textTahomaGray'>" + ds.Tables[1].Rows[h].Tags + "</td>";
				s = s+"</tr>";
				s = s+"</table>";
				i++;
			}
		}
		if(ds.Tables[2]!=null){
			//Gå igenom de ej taggade
			for(var k=0; k<ds.Tables[2].Rows.length; k++)
			{
				s = s+"<table id='"+i+"' border='0' cellspacing='0' style='cursor:hand; BORDER-BOTTOM:1px solid gray;' width='100%' onclick='SetPreeView(\""+i+"\");' ondblclick='OpenPage(\""+ds.Tables[2].Rows[k].DocumentId+"\");' border='0' onmouseover='MouseOverResult(\""+i+"\");' onmouseout='MouseOutResult(\""+i+"\");' >";
				s = s+"<tr>";
				s = s+"<td width='10px' valign='top'><img id='"+i+"' src='images/"+ds.Tables[2].Rows[k].Extension+".gif' border='0' /></td>";
				s = s+"<td class='textTahoma'>" + ds.Tables[2].Rows[k].MetaTitle + "<input type='hidden' id='Id_"+i+"' value='"+ds.Tables[2].Rows[k].DocumentId+"' /><input type='hidden' id='Extension_"+i+"' value='"+ds.Tables[2].Rows[k].Extension+"' /><input type='hidden' id='Title_"+i+"' value='"+ds.Tables[2].Rows[k].MetaTitle+"' /></td>";
				s = s+"</tr>";
				s = s+"</table>";
				i++;
			}
		}
		document.getElementById("tableDisplay").innerHTML = s;
		//window.frames["SavedItemsFrame"].Search(CurrentSearchStr);
	}
	else
		alert("Error. [3001] " + response.request.responseText);
	
	document.getElementById("LoadImage").style.visibility='hidden';
}
