/**
 * $Id: main_page.js 24 2008-04-27 10:18:29Z manfred $
 * 
 * $Log: main_page.js,v $
 * Revision 1.3  2007/06/25 13:11:53  administrator
 * Param String f�r Hersteller -Suche darf nicht von der Klasse String sein.
 *
 * Revision 1.2  2007/04/24 05:44:12  administrator
 * Session id in fastviewSearchCriteria() erg�nzt
 *
 * Revision 1.1  2007/04/18 05:27:42  administrator
 * Neues JS-File für allle Seiten um die Schnellübersicht zu realisieren
 *
 * 
 * Created 15.04.2007
 * by manfred ursprung email : manfred.ursprung@manfred-ursprung.de
 * 
 * 
**/

	/* Ajax call to get either all manufacturers as a dropdown list or 
	 * all categories in a drop down list
	 * @param String	forWhat either manufacturers or categories
	 * @param String  node4Succes	id of node where the result will be shown
	 */
var fastviewIndicator;		//node for Indicator that system is making a request. Is needed for hideSearchIndicator

var fastviewSearchCriteria = function(forWhat, node4Success, languageCode, sessionId){
	 var pars = "action=fastview&searchCriteria=" + forWhat +"&language=" + languageCode + "&osCsid=" + sessionId;
	 if(forWhat == 'manufacturers'){
	 	fastviewIndicator = 	$('fastviewManufacturerIndicator');
	 }else if(forWhat == 'designer'){
	 	fastviewIndicator = 	$('fastviewDesignerIndicator');
	 }else if(forWhat == 'categories'){
	 	fastviewIndicator = 	$('fastviewCategoriesIndicator');
	 }
	 fastviewIndicator.style.display = "inline";
	 var myAjax = new Ajax.Updater({
			success: node4Success,
			failure: node4Success},
			"ajax_driven.php", 
			{
				method: 'get', 
				parameters: pars, 
				onFailure: showError,
				onComplete: hideSearchIndicator
				//onSuccess: wrapForm
			});
}

var showError = function(response)	{
	alert("Error: " + response.status + "\t" + response.statusText + "\t" + response.responseText);
} 

var hideSearchIndicator = function(response){
	fastviewIndicator.style.display = "none";
}



var manufacturer_selected = function(form){
	//var id = form.fastview_selection_list.options[form.fastview_selection_list.selectedIndex].value;
	//alert("Manufacturers ID: " + id);
	//$('manufacturers_id').value = id;
	form.submit();
}

var category_selected = function(form){
	var id = form.fastview_selection_list.options[form.fastview_selection_list.selectedIndex].value;
	alert("cPath: " + id);
	$('cPath').value = id;
	form.submit();
}