function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}

function rowOverEffect(object) {
  if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}
function rowOutEffect(object) {
  if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}
function checkBox(object) {
  document.account_newsletter.elements[object].checked = !document.account_newsletter.elements[object].checked;
}
function validarEmail(valor) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3,4})+$/.test(valor)){
		return true;
	} else {
		return false;
	}
}

(function($){
	$.fn.extend({
		Llight_create: function() {
					//Crea el Fondo
						objeto_ventana=$(this);
						tamanio_width='100%';
						if (typeof document.body.style.maxHeight === "undefined") { // es IE 6
								$("body","html").css({height: "100%",width: '100%'});	
								tamanio_width=$(window).width();
							}			
						tamanio_height=$(document).height();
						id_objeto_ventana=objeto_ventana.attr("id");
		
						overlay = $("<div id='modal-overlay' style='z-index:499; padding:0; margin:0; border:none;'></div>").css({
							position: 'absolute',
							top: '0px',
							left: '0px',
							background: '#000',
							display: 'none',
							height: tamanio_height,
							width: tamanio_width
						}).attr("Llightattr",id_objeto_ventana);
							objeto_ventana.centrar_objeto();
							$(overlay.click(function(overlay){ $(objeto_ventana).Llight_destroy();})).appendTo(document.body);
							overlay.css("opacity", 0.6);
							overlay.fadeIn(600);
							$(objeto_ventana).css({display:"none", visibility:"visible"});
							objeto_ventana.fadeIn(600);
							objeto_ventana.Llight_resize();
					/*      Tecla ESC  ***********/
							$(document).keypress(function (e) {
							  if (e.which == 0 || e.which == 27) {
								$(objeto_ventana).Llight_destroy();
							  }
							});
					/*      Tecla ESC  **********/
							return objeto_ventana;
						},
					//Funcion Cerrar y Centrar
					Llight_destroy: function(){
						objeto_cerrar=$(this);
						attr_light=$(overlay).attr("Llightattr");
						var remove = function() { $(overlay).remove(); };
						overlay.fadeOut(600,remove);
						if(attr_light!=""){ objeto_cerrar=$("#"+attr_light); }
						
						objeto_cerrar.fadeOut(600);
						return $(this);
					},centrar_objeto: function(){ 
						var wnd = $(window), doc = $(document),	pTop = doc.scrollTop(), pLeft = doc.scrollLeft(), minTop = pTop;
						pLeft += parseInt((wnd.width() - $(this).width()) / 2); if(pLeft<0){ pLeft=0;  }
						pTop += parseInt((wnd.height() - $(this).height()) / 2); if(pTop<5){ pTop=5;  }
						$(this).css({top: pTop, left: pLeft}); 
					},Llight_resize: function(){
					
							objeto_ventana=$(this);
							tamanio_width='100%';
							if (typeof document.body.style.maxHeight === "undefined") { // es IE 6
									$("body","html").css({height: "100%",width: '100%'});	
									tamanio_width=$(window).width();
								}			
							tamanio_height=$(document).height();
							id_objeto_ventana=objeto_ventana.attr("id");
							
							$('#modal-overlay').css({
							height: tamanio_height,
							width: tamanio_width   });
							
							
					}
		});
})(jQuery);


$('form.form_talla').submit(function(){
										var valor;
										valor=$(this).find('.Talla').attr('value');
										if(valor==0){
											alert('Elige una Talla');
											return false;
										}
								});

$(document).ready(function(){
						   
						   		$('.click_and_clear').click(function(){
																	 	$(this).val('');
																		$(this).css('color','#000000');
																		$(this).removeClass('click_and_clear');
																		$(this).unbind('click');
																	 });
						   
						   
						       $('.img_products').hover(function(){ 
							   										img2_encontrada=$(this).find('.segunda_imagen');
																	img1_encontrada=$(this).find('.primera_imagen')
																	if(img2_encontrada.attr('class')=='segunda_imagen'){  
																		img2_encontrada.css('display','block');   
																		img1_encontrada.css('display','none'); 
																	}  
													    },function(){ 
							   										img2_encontrada=$(this).find('.segunda_imagen');
																	img1_encontrada=$(this).find('.primera_imagen');
																	if(img2_encontrada.attr('class')=='segunda_imagen'){  
																		img1_encontrada.css('display','block');   
																		img2_encontrada.css('display','none'); 
																     }  
														});
						   
						   });
