
//Search web
function WebSearch(searcstr){
	document.getElementById("LoadImage").style.display='block';
	indexNew.GetWebResult(searcstr, 1, ParseWebResult);
}
function ParseWebResult(response){
	var ds = response.value;
	if(ds != null && typeof(ds) == "object" && ds.Tables != null){
		if(ds.Tables[1]!=null){
			var s = "";
			for(var i=0; i<ds.Tables[1].Rows.length; i++)
			{
				s = s+"<table id='"+i+"' border='0' cellspacing='0' style='cursor:hand; BORDER-BOTTOM:1px solid gray;' width='100%' title='"+ds.Tables[1].Rows[i].Summary+"' onclick='SetPreeView(\""+i+"\");' ondblclick='OpenPage(\""+i+"\");' border='0' onmouseover='MouseOverResult(\""+i+"\");' onmouseout='MouseOutResult(\""+i+"\");' >";
				s = s+"<tr>";
				s = s+"<td rowspan='3' width='10px' valign='top'><img id='"+i+"' src='images/"+ds.Tables[1].Rows[i].MimeType.split("/")[1]+".gif' border='0' /></b></td>";
				s = s+"<td class='textTahoma'>" + ds.Tables[1].Rows[i].Title + "</td>";
				s = s+"</tr>";
				s = s+"<tr>";
				s = s+"<td class='textTahomaGray'>" + ds.Tables[1].Rows[i].Summary.substring(0, 150) + "...";
				s = s+"<input type='hidden' id='Title_"+i+"' value='"+ds.Tables[1].Rows[i].Title+"' />";
				s = s+"<input type='hidden' id='Summary_"+i+"' value='"+ds.Tables[1].Rows[i].Summary+"' />";
				s = s+"<input type='hidden' id='Url_"+i+"' value='"+ds.Tables[1].Rows[i].Url+"' />";
				s = s+"<input type='hidden' id='MimeType_"+i+"' value='"+ds.Tables[1].Rows[i].MimeType+"' />";
				s = s+"</td>";
				s = s+"</tr>";
				s = s+"</table>";
			}
			document.getElementById("tableDisplay").innerHTML = s;
			//window.frames["SavedItemsFrame"].Search(CurrentSearchStr);
		}else
			alert("No results found...");
	}
	else
		alert("Error. [3001] " + response.request.responseText);
	
	document.getElementById("LoadImage").style.display='none';
}
//Search Images
function ImageSearch(searcstr){
	document.getElementById("LoadImage").style.display='block';
	indexNew.GetImageResult(searcstr, 1, ParseImageResult); 
}
function ParseImageResult(response){
	var ds = response.value;
	if(ds != null && typeof(ds) == "object" && ds.Tables != null){
		if(ds.Tables[1]!=null){
			var s = "";
			for(var i=0; i<ds.Tables[1].Rows.length; i++){
				s = s+"<table id='"+i+"' border='0' cellspacing='0' style='cursor:hand; BORDER-BOTTOM:1px solid gray;' width='100%' title='"+ds.Tables[1].Rows[i].Summary+"' onclick='SetPreeView(\""+i+"\");' ondblclick='OpenPage(\""+i+"\");' border='0' onmouseover='MouseOverResult(\""+i+"\");' onmouseout='MouseOutResult(\""+i+"\");' >";
				s = s+"<tr>";
				s = s+"<td rowspan='3' width='10px' valign='top'><img id='"+i+"' src='images/"+ds.Tables[1].Rows[i].FileFormat+".gif' border='0' /></b></td>";
				s = s+"<td class='textTahoma'>" + ds.Tables[1].Rows[i].Title + "</td>";
				s = s+"</tr>";
				s = s+"<tr>";
				s = s+"<td class='textTahomaGray'>" + ds.Tables[1].Rows[i].Summary.substring(0, 150) + "...";
				s = s+"<input type='hidden' id='Title_"+i+"' value='"+ds.Tables[1].Rows[i].Title+"' />";
				s = s+"<input type='hidden' id='Summary_"+i+"' value='"+ds.Tables[1].Rows[i].Summary+"' />";
				s = s+"<input type='hidden' id='Url_"+i+"' value='"+ds.Tables[1].Rows[i].Url+"' />";
				s = s+"<input type='hidden' id='MimeType_"+i+"' value='"+ds.Tables[1].Rows[i].FileFormat+"' />";
				s = s+"</td>";
				s = s+"</tr>";
				s = s+"</table>";
			}
			tableDisplay.innerHTML = s;
			//window.frames["SavedItemsFrame"].Search(CurrentSearchStr);
		}else
			alert("No results found...");
	}
	else
		alert("Error. [3001] " + response.request.responseText);
		
	document.getElementById("LoadImage").style.display='none';
}
//Search Movies
function MovieSearch(searcstr){
	document.getElementById("LoadImage").style.display='block';
	indexNew.GetMovieResult(searcstr, 1, ParseMovieResult);   
}
function ParseMovieResult(response){
	var ds = response.value;
	if(ds != null && typeof(ds) == "object" && ds.Tables != null){
		if(ds.Tables[1]!=null){
			var s = "";
			for(var i=0; i<ds.Tables[1].Rows.length; i++){
				if((ds.Tables[1].Rows[i].FileFormat=="mpeg")||(ds.Tables[1].Rows[i].FileFormat=="msmedia")){

					s = s+"<table id='"+i+"' border='0' cellspacing='0' style='cursor:hand; BORDER-BOTTOM:1px solid gray;' width='100%' title='"+ds.Tables[1].Rows[i].Summary+"' onclick='PlayMedia(\""+i+"\");' ondblclick='OpenPage(\""+i+"\");' border='0' onmouseover='MouseOverResult(\""+i+"\");' onmouseout='MouseOutResult(\""+i+"\");' >";
					s = s+"<tr>";
					s = s+"<td rowspan='3' width='10px' valign='top'><img id='"+i+"' src='images/"+ds.Tables[1].Rows[i].FileFormat+".gif' border='0' /></b></td>";
					s = s+"<td class='textTahoma'>" + ds.Tables[1].Rows[i].Title + "</td>";
					s = s+"</tr>";
					s = s+"<tr>";
					s = s+"<td class='textTahomaGray'>" + ds.Tables[1].Rows[i].Summary.substring(0, 150) + "...";
					s = s+"<input type='hidden' id='Title_"+i+"' value='"+ds.Tables[1].Rows[i].Title+"' />";
					s = s+"<input type='hidden' id='Summary_"+i+"' value='"+ds.Tables[1].Rows[i].Summary+"' />";
					s = s+"<input type='hidden' id='Url_"+i+"' value='"+ds.Tables[1].Rows[i].Url+"' />";
					s = s+"<input type='hidden' id='MimeType_"+i+"' value='"+ds.Tables[1].Rows[i].FileFormat+"' />";
					s = s+"</td>";
					s = s+"</tr>";
					s = s+"</table>";
				}
			}
			tableDisplay.innerHTML = s;
			//window.frames["SavedItemsFrame"].Search(CurrentSearchStr);
		}else
			alert("No results found...");
	}
	else
		alert("Error. [3001] " + response.request.responseText);
	
	document.getElementById("LoadImage").style.display='none';
}
