/**
 * For use with the Product Search controller
 *
 * @copyright  2008-2009 eFashionSoutions
 * @license    ???
 * @version    $Id: productsearch.js 8550 2010-08-04 19:57:51Z teastmond $
 * @link       ???
 * @since      Initial Release
 * @package    EFS2
 * @subpackage JavaScript
 * @author     Reha Sterbin <rsterbin@efashionsolutions.com>
 */

EFS.onDomReady(function(){
	/**
	 * Pagination updates from select lists
	 */
    var selects = $$('select.pagination-update');
    for (var i = 0; i < selects.length; i++) {
        selects[i].observe('change', function (e) {
            var target = e.element();
            if (target.nodeName == 'SELECT') {
                var href = target.options[target.selectedIndex].value;
                window.location.replace(href);
            }
        });
    }

	/**
	 * Add other events
	 */
	if (typeof(Paginator) != 'undefined') {
		var paginator = new Paginator();
		paginator.addEvents();
	}

});

