/*
 * Proyecto 83 - http://proyecto83.com - "Simplify, simplify, simplify"
 * Copyright (C) 2008 Emilio Mariscal
 * 
 * == BEGIN LICENSE ==
 * 
 * Licensed under the terms of any of the following licenses at your
 * choice:
 * 
 *  - GNU General Public License Version 2 or later (the "GPL")
 *    http://www.gnu.org/licenses/gpl.html
 * 
 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 *    http://www.gnu.org/licenses/lgpl.html
 * 
 * == END LICENSE ==
 * 
 * 	File Name  :
 *
 * 	visualfx.js
 *
 * File Authors :
 * 		Emilio Mariscal ( emi420@gmail.com )
 */
 
 
var visualFX = {
	
	// Validar formularios
/*
	validateForm: function validateForm( frmFields ) {
		var aFrmFields = frmFields.split(',') ;
		var control = 1 ;
		for ( i = 0 ; i < aFrmFields.length ; i++ ) {
			var field = document.getElementById(aFrmFields[i]) ;
			var validateMsg = document.getElementById(field.id + '_frmv') ;
			
			field.onfocus = function() {
				validateMsg = document.getElementById(this.id + '_frmv') ;
				validateMsg.style.display = 'none' ;				
			}
			validateMsg.onmouseover = function() {
				this.style.display = 'none' ;
			}
			if ( field.value == '' ) {
				validateMsg.style.display = 'block' ;
				validateMsg.setAttribute('class',validateMsg.className.replace('validatemsg hidden','validatemsg')) ;			
				control = 0 ;
			} else {
				validateMsg.setAttribute('class',validateMsg.className.replace('validatemsg','validatemsg hidden')) ;			
			}
		}
		if ( control )
			return true ;
		else
			return false ;
	},
*/
// Mostrar todos los items ocultos

	showAllItems: function showAllItems( eId ) {
		var oUl = document.getElementById( eId )
		var itemsArray = oUl.getElementsByTagName('li') ;
		var btnShowAllItems = document.getElementById('btnShowAllItems') ;
		for( var i = 0 ; i < itemsArray.length ; i++ ) {
			itemsArray[i].className = itemsArray[i].className.replace('hidden','') ;
		}
		btnShowAllItems.style.display = 'none' ;
	},

        compare: function compare(prefijo) {
          
                  url = [];
                  $("input[type=checkbox]:checked").each( function () { if (parseInt($(this).attr('id')) > 0) { url.push($(this).attr('id')); }});
                  if (url.length > 1)
                    {
                  document.location = ('/' + prefijo + '/comparar/' + url.join("-"));
                    }
                    else
                        {
                            alert("Por favor, seleccione varios productos para comparar.")
                        }
              }
              
        
}
