                               // xajax para procesar loadings
                        xajax.callback.global.onRequest = function() {xajax.$('cargando').style.display = 'none';}
                        xajax.callback.global.beforeResponseProcessing = function() {xajax.$('cargando').style.display='none';}
                              
                                // clase para procesar los valores del editor, LLAMAR ANTES DE ENVIAR A XAJAX
                                function MyClass()
                                {
        this.UpdateEditorFormValue = function()
                                        {
                for ( i = 0; i < parent.frames.length; ++i )
                        if ( parent.frames[i].FCK )
                                parent.frames[i].FCK.UpdateLinkedField();
                                        }
                                }
                                // inicia la clase
                                var MyObject = new MyClass();
                                
                                // funciones propias
                                function muestra_simple(obj)
                                {
																document.getElementById(obj).style.display = "block";
                                }
                                function oculta_simple(obj)
                                {
																document.getElementById(obj).style.display = "none";
                                }
                                function muestra(obj) 
                                {
																document.getElementById("forms_container").style.display = "block";
																document.getElementById(obj).style.display = "block";   
                                document.getElementById(obj).style.height = "600px";       
                                document.getElementById(obj).style.width = "800px";                
                                }

                                function oculta(obj) 
                                {
																document.getElementById("forms_container").style.display = "none";
																document.getElementById(obj).style.display = "none";                    
                                document.getElementById(obj).style.width = "0";    
                                document.getElementById(obj).style.height = "0";   
                                }
                                
                                function send_form_header()
                                {
                                xajax_update_header(xajax.getFormValues("form_header"));        
                                return false;
                                }
                                function send_form_headers(obj)
                                {
																//alert(obj);
																if (obj == "E")
																	 {
                                	 xajax_update_headers(obj,xajax.getFormValues("form_header_escaparate"));  
																	 }
																if (obj == "N")
																	 {
                                	 xajax_update_headers(obj,xajax.getFormValues("form_header_novedad"));  
																	 }
																if (obj == "O")
																	 {
                                	 xajax_update_headers(obj,xajax.getFormValues("form_header_oferta"));  
																	 }																 																      
                                return false;
                                }
                                function send_form_footer()
                                {
                                xajax_update_footer(xajax.getFormValues("form_footer"));        
                                return false;
                                }
                                function send_form_css()
                                {
																arriba();
                                xajax_save_css(xajax.getFormValues("form_css"));        
                                return false;
                                }
                                function send_form_html()
                                {
																arriba();
                                xajax_save_html(xajax.getFormValues("form_html"));        
                                return false;
                                }
                                function send_form_info_legal()
                                {
                                xajax_update_info_legal(xajax.getFormValues("form_info_legal"));        
                                return false;
                                }
                                function send_form_articulo()
                                {
                                xajax_update_articulo(xajax.getFormValues("form_articulo"));    
                                return false;
                                }
                                function send_form_busca()
                                {
                                xajax_show_posts_list('nulo',xajax.getFormValues("form_busca"));    
                                return false;
                                }
                                function send_form_coment()
                                {
                                xajax_insert_coment(xajax.getFormValues("form_coment"));    
                                return false;
                                }
																function del_post(id_post)
																{
																if (confirm('Confirme que desea eliminar el articulo'))
																	 {
																	 xajax_del_post(id_post);
																	 }
																}
																function asigna_form_articulo(id_articulo,titulo,id_seccion,cuerpo)
																{
																muestra('div_articulo');
																newcuerpo = cuerpo.replace(/comilla/g,"'");
																newcuerpo = newcuerpo.replace(/punto_y_coma/g,";");
																var oeditor = FCKeditorAPI.GetInstance('cuerpo');
																oeditor.SetHTML(newcuerpo, true );
																document.form_articulo.id_articulo.value = id_articulo;
																document.form_articulo.titulo.value = titulo;
																document.form_articulo.id_seccion.value = id_seccion;
																}
																function asigna_form_coment(id_articulo)
																{
																muestra('div_coment');
																var oeditor = FCKeditorAPI.GetInstance('coment');
																oeditor.SetHTML('', true );
																document.form_coment.id_articulo.value = id_articulo;
																}
																function js_oper_seccion(oper,id_seccion,nombre)
																{
																if (oper == 'nueva')
																	 {
																	 if (nombre = prompt("Nombre para la nueva seccion","Nueva Secci&oacute;n"))
																	 		{
																	 		xajax_oper_seccion('nueva','',nombre);
																			}
																	 }
																if (oper == 'actualiza')
																	 {
																	 nombre = prompt("Nuevo nombre para la seccion","Nuevo nombre");
																	 xajax_oper_seccion('actualiza',id_seccion,nombre);
																	 }
																if (oper == 'sube')
																	 {
																	 xajax_oper_seccion('sube',id_seccion);
																	 }
																if (oper == 'elimina')
																	 {
																	 if (confirm('confirme que desea eliminar la secci&oacute;n\r\n ATENCION: SE ELIMINARAN TODOS LOS ARTICULOS QUE PERTENEZCAN A LA SECCION'))
																	 		{
																	 		xajax_oper_seccion('elimina',id_seccion,'');
																			}
																	 }
																}
																function arriba() 
																	 {
																	 scrollTo(0,0);
																	 }
															
															  function send_form_busca_productos()
		 	   													 {
				 													 xajax_show_productos('',xajax.getFormValues("form_busca_productos"));
																	 return false;
				 													 }
	
															  function send_form_tallas()
		 	   													 {
				 													 xajax_oper_cesta('inserta',xajax.getFormValues("form_tallas"),'textil');
																	 return false;
				 													 }
																	 
															  function send_cesta_simple()
		 	   													 {
				 													 xajax_oper_cesta('inserta',xajax.getFormValues("cesta_simple"),'unitario');
																	 return false;
				 													 }
																	 
															  function send_cesta()
		 	   													 {
				 													 xajax_oper_cesta('finaliza','','','','',xajax.getFormValues("cesta"));
																	 return false;
				 													 }
																	 
															  function send_form_cliente(valor)
		 	   													 {
																	 if (valor == "session")
																	 {
																	 xajax_show_menu_tienda();
																	 }
																	 else
																	 {
				 													 xajax_show_menu_tienda(xajax.getFormValues("form_cliente"));
																	 }
				 													 return false;
				 													 }
																	 


																function sumar()
																{ 
																total=0; 
																todos = document.form_tallas.length - 2;
																//alert(document.form_tallas.length);
																for(a=2;a<todos;a++){ 
																document.form_tallas.elements[a].value=document.form_tallas.elements[a].value.split(',').join('.'); 
																if (!isNaN(document.form_tallas.elements[a].value)){ 
																pepe=new Number(document.form_tallas.elements[a].value); 
																//alert(pepe);
																total=total+pepe; 
																document.form_tallas.elements['total'].value=total} 
																else{document.form_tallas.elements[a].value=0} 
  															} 
																} 
																
																function posicion(event)
																	 {
																	 var x = event.clientX;
																	 var y = event.clientY + document.body.scrollTop;
																	 if (document.getElementById('cargando'))
																	 {
																	 var capa = document.getElementById('cargando');
																	 capa.style['top'] = y+'px';
																	 capa.style['left'] = x+'px';
																	 //document.getElementById('contents').innerHTML = document.body.scrolltop;
																	 }
																	 }
																	 
																	 
																function inicializa()
																	 {
																	 send_form_cliente('session');
																	 xajax_show_all();
																	 }
																function resalta()
																	 {
																	 var original = document.getElementById("menu_tienda").style.border;
																	 var nuevo = "2px red dashed";
																	 var tiempo = 0;
																	 for (i=0; i<10; i++)
																		{
																		setTimeout("document.getElementById('menu_tienda').style.border = '"+nuevo+"';",tiempo);
																		setTimeout("document.getElementById('menu_tienda').style.border = '"+original+"';",(tiempo + 250));																		
																		tiempo = tiempo + 500;
																		}

																	 }

function borra_busqueda()
{
if (document.form_busca_productos.nombre.value == "Busquedas")
	{
	document.form_busca_productos.nombre.value = "";
	}
}

 



