// 09/09/2007 22:35pm
// js/place-marche.js
// urls
var uriBase = document.getElementById("urlIdentifier").getAttribute("content");
var urls = new Array();
urls['fi'] = uriBase+"ajax/fi.php5";
urls['gibs'] = uriBase+"ajax/gibs-0.2.php5";
urls['gsl'] = uriBase+"ajax/gsl-0.1.php";
var globs = "apikey=nicowebv3";
/*
	* initBoxes ()
*/
function initBoxes () {
	
	// # enclenchement des img load
	$('boxTPLoad').style.display='inline';
	//$('boxSellerLoad').style.display='inline';
	
	// # byEd
	var opts = { method : 'get' , parameters : globs+"&kwd=tourmaline&page=1",
		onSuccess : function (r) { $('boxTPLoad').style.display='none'; }
		/*
		onFailure : function (r) { alert(r.responseText); }, 
		onComplete : function (r) { alert(r.responseText); }*/
	}
	new Ajax.Updater("byTP",urls['fi'],opts);
	
	// # bySellerLoc
	var opts0 = { method : 'post' , parameters : globs+"&loc=us",
		onSuccess : function (r) { $('boxSellerListLoad').style.display='none'; }
	}
	new Ajax.Updater("sellerList",urls['gsl'],opts0);
	
}

/*
	* updateBox ( string box , string val , int idPage )
*/
function updateBox (box,val,idPage) {
	// # enclenchement de img load
	$('boxTPLoad').style.display='inline';
	// # byTP
	var opts = { method : 'get' , parameters : globs+"&kwd="+val+"&page="+idPage,
		onSuccess : function (r) { $('boxTPLoad').style.display='none'; }
		/*onFailure : function (r) { alert(r.responseText); }, 
		onComplete : function (r) { alert(r.responseText); }*/
	}
	new Ajax.Updater(box,urls['fi'],opts);
}

/*
	* updateBoxSeller ( string box , string val  )
*/
function updateBoxSeller (box,val) {
	//alert('yep');
	$('boxSellerLoad').style.display='inline';
	// # byEd
	var opts = { method : 'post' , parameters : globs+"&se="+val+"&page=1" ,
		onSuccess : function (r) { $('boxSellerLoad').style.display='none'; }/*
		onFailure : function (r) { alert(r.responseText); }, 
		onComplete : function (r) { alert(r.responseText); }*/
	}
	new Ajax.Updater(box,urls['gibs'],opts);
}

/*
	* updateBoxSeller ( string box , string val  )
*/
function updateSellerList (box,val) {
	//alert('yep');
	$('boxSellerListLoad').style.display='inline';
	// # byEd
	var opts = { method : 'post' , parameters : globs+"&loc="+val ,
		onSuccess : function (r) { $('boxSellerListLoad').style.display='none'; }/*
		onFailure : function (r) { alert(r.responseText); }, 
		onComplete : function (r) { alert(r.responseText); }*/
	}
	new Ajax.Updater(box,urls['gsl'],opts);
}