/**
 *  PHPMass Shopping Cart
 * Copyright (C) 2008  PHPMass.com
 * 
 *  This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 *  This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
function makeFilters()
{
 	var filterObj=document.getElementById('filtermenu').getElementsByTagName("ul")
    for (var t=0; t<filterObj.length; t++){
    		filterObj[t].parentNode.onmouseover=function(){
    		this.getElementsByTagName("ul")[0].style.visibility="visible"
    	}
    	filterObj[t].parentNode.onmouseout=function(){
			this.getElementsByTagName("ul")[0].style.visibility="hidden"
    	}
    }
}



// This function makes tabs on the product administration page. a_ (div id) is the tab id of the respective table id
function activateprodtabs(divid)
{
		var divArray = ['primaryinfo', 'otherinfos', 'prodcomments', 'prodrelateditems'];
		for (var index = 0; index < divArray.length; ++index) {
			var buttonName = 'a_'+divArray[index];
			if(divid == divArray[index]){
				if($(divArray[index])){
					$(divArray[index]).show();
					if ($(buttonName)) $(buttonName).addClassName('selected');
				}
			}
			else{
				if($(divArray[index])){
					$(divArray[index]).hide();
					if ($(buttonName)) $(buttonName).removeClassName('selected');
				}
			}
		}
}

function filter(url1, url2, id_filter)
{
	
	var options=
	{
		method:'get',
		evalScripts:'true',
		onCreate: function()
		{
				$('chargement_filtre').style.display="block";
				$('listing_principal').style.display="none";
		},
		onComplete: function(response)
		{
			$('chargement_filtre').style.display='none';
			$('listing_principal').style.display='block';
			$('listing_principal').innerHTML = response.responseText;
		}	
	};
	new Ajax.Updater($('listing_principal'), url1+id_filter+url2+'ajax/', options );
}

function filter2(url1, url2, id_filter)
{
	alert(url1+id_filter+url2+'ajax/');
	

	new Ajax.Updater($('listing_principal'), url1+id_filter+url2+'ajax/', { method: 'get' } );
}