/**
 * JavaScript Document
 * Javascript/Ajax for TinTin - Search media out of refresh page.
 * 
 * This file check the param by variable 'url' and return total media's found and media's.
 * Send url by object XMLHttpRequest to right pages and return always something for the <div>
 * 
 * @author Leandro carvalho <leandro@magicmemories.co.nz>
 * @copyright 27 november 2007
 *
 */

function processResults(url)
{
req = null;

// check if user press buttom
if(document.mmFrmMdSearch.media_code.value != ""){
	var word = document.mmFrmMdSearch.media_code.value;
	var url 		= url+word
}else{
	return false;	
}

// Find objetives (Mozilla/Safari)
if (window.XMLHttpRequest) {
	req = new XMLHttpRequest();
	req.onreadystatechange = loading;
	req.open("GET",url,true);
	req.send(null);

// Find objetives ActiveX (IE)
 } else if (window.ActiveXObject) {
	req = new ActiveXObject("Microsoft.XMLHTTP");
  if (req) {
	req.onreadystatechange = loading;
	req.open("GET",url,true);
	req.send();
  }
 }
}

function loading()
{
	// just when complete process
	//when loading process print loading and total media's
	if(req.readyState == 1) {
		document.getElementById('loading').style.visibility="visible"; 
	}
}
