// JavaScript Document
function checkEstado(objetoId){
	var sel = document.getElementById(objetoId);
	sel.checked = true;
}

function openSubCategory(n, nn) {
      var i = 0
      for(i=1;i<n+1;i++) {
      var sel = document.getElementById('insideSubCategory'+i);
      //sel.style.display = 'none';
      }
      var sel = document.getElementById('insideSubCategory'+nn);
      sel.style.display = 'block';
   }

function openInsideSubCategory(n, nn, imagen) {
      var i = 0
      for(i=1;i<n+1;i++) {
      var sel = document.getElementById('showProducts'+i);
      //sel.style.display = 'none';
      }
      var sel = document.getElementById(nn);
//	  alert (imagen);
	  var img = document.getElementById(imagen);
	  if (sel.style.display == 'block'){
	  		//si el usuario clickea en uno abierto lo cierra
	  	  	sel.style.display = 'none'
			img.src = 'img/plus.gif';
		} else {
	      sel.style.display = 'block';
		  img.src = 'img/minus.gif';
		}
   }
function cambia (objeto, color){
   		objeto.style.backgroundColor = color;
   }

function cambiatodo (objeto, color, url, color2){
   		objeto.style.backgroundColor = color;
		obj = document.getElementById(url);
		obj.style.color = color2;
   }

function cambiaColorLetra(objeto, color){
	   //var obj = document.getElementById(objeto);
	   objeto.style.color = color;
   }
   
  
/*
Usage: The link is written as follows: 
onclick="newWindow(this.href, 'popup', 600, 500, 1, 1, 0, 0, 0, 1, 0);

Usage Description:
"this.href" refers to the URL given in the "a" tag; "'popup'" is the name of the popup window;
600 is the width of the popup window; 500 is the height of the popup window; the numbers that
follow designate whether a property is turned on ("1") or off ("0"), in this order:
scrollbars, resizable, menubar, toolbar, addressbar, statusbar, fullscreen
*/

	function newWindow(a_str_windowURL, a_str_windowName, a_int_windowWidth, a_int_windowHeight, a_bool_scrollbars, a_bool_resizable, a_bool_menubar, a_bool_toolbar, a_bool_addressbar, a_bool_statusbar, a_bool_fullscreen) {
		var int_windowLeft = (screen.width - a_int_windowWidth) / 2;
		var int_windowTop = (screen.height - a_int_windowHeight) / 2;
		var str_windowProperties = 'height=' + a_int_windowHeight + ',width=' + a_int_windowWidth + ',top=' + int_windowTop + ',left=' + int_windowLeft + ',scrollbars=' + a_bool_scrollbars + ',resizable=' + a_bool_resizable + ',menubar=' + a_bool_menubar + ',toolbar=' + a_bool_toolbar + ',location=' + a_bool_addressbar + ',statusbar=' + a_bool_statusbar + ',fullscreen=' + a_bool_fullscreen + '';
		var obj_window = window.open(a_str_windowURL, a_str_windowName, str_windowProperties)
		if (parseInt(navigator.appVersion) >= 4) {
		  obj_window.window.focus();
		}
	}
	
	
function isValidEmail(str) {

   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}


function checkform()
{
	
	var email = document.getElementById('email');
	
	if (email.value != '')
	{
	
		var valid = isValidEmail(email.value);
	
		if (!valid)
		{
			alert('Error: el email debe ser valido');
			document.getElementById('email').focus();
			return false;
		}

	}
	else
	{
		alert('Error: el email es requerido');
		document.getElementById('email').focus();
		return false;
	}
	return true;
}	