
        	bName = navigator.appName;
        	bVer = parseInt(navigator.appVersion);
        	bAgent = navigator.userAgent
        	//alert("bName: "+ bName + "\nbVer: " + bVer + "\nbAgent: " + bAgent);
        	if (bName == "Microsoft Internet Explorer"){
        		br = "ms";
        	} else {
        		br = "ns";
        	}

        function popup(page,name,prefix,widthR,heightR){

        	bName = navigator.appName;
        	bVer = parseInt(navigator.appVersion);
        	bAgent = navigator.userAgent
        	ponerlo = false

        	//alert(bName + " " + bVer + " " + bAgent)
        	if (bName == "Microsoft Internet Explorer"){
        		br = "ms";
        	} else {
        		br = "ns";
        	}

        	if (br == "ns" ||
        		(br == "ms" && bAgent.indexOf("Mac") != -1) ||
        		(br == "ms" && bAgent.indexOf("MSIE 7") != -1)){
        		ponerlo = true
        	}
        	if (ponerlo == true){
        		page = prefix + page
        	}

        	window.name="Parent"

        	if (!widthR == ''){
        		Ancho = widthR
        	} else {
        		Ancho = 600
        	}

        	if (!heightR == ''){
        		Alto = heightR
        	} else {
        		Alto = 400
        	}

        	if (widthR == 'fullpg'){
        		Ancho = screen.width
        	}
        	if (heightR == 'fullpg'){
        		Alto = screen.height
        	}

        	DistArriba = ((screen.height / 2) - Math.round(Alto / 2))
        	DistIzq = ((screen.width / 2) - Math.round(Ancho / 2))
        	// alert(DistArriba)
        	// alert(DistIzq)
        	params = "toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1"
        	params = params + ",width="+Ancho +",height="+ Alto
        	params = params + ",top=" + DistArriba + ",left=" + DistIzq + ", screenY=" + DistArriba + ", screenX=" + DistIzq
        		popwindow = open(page,name,params);
        		popwindow.focus();
        	return false;
        }



        function popup2(page,name,prefix,widthR,heightR){

        	bName = navigator.appName;
        	bVer = parseInt(navigator.appVersion);
        	bAgent = navigator.userAgent
        	ponerlo = false

        	//alert(bName + " " + bVer)
        	if (bName == "Microsoft Internet Explorer"){
        		br = "ms";
        	} else {
        		br = "ns";
        	}

        	if (br == "ns" ||
        		(br == "ms" && bAgent.indexOf("Mac") != -1) ||
        		(br == "ms" && bAgent.indexOf("MSIE 7") != -1)){
        		ponerlo = true
        	}
        	if (ponerlo == true){
        		page = prefix + page
        	}

        	window.name="Parent"

        	if (!widthR == ''){
        		Ancho = widthR
        	} else {
        		Ancho = 600
        	}

        	if (!heightR == ''){
        		Alto = heightR
        	} else {
        		Alto = 400
        	}

        	if (widthR == 'fullpg'){
        		Ancho = screen.width
        	}
        	if (heightR == 'fullpg'){
        		Alto = screen.height
        	}

        	DistArriba = ((screen.height / 2) - Math.round(Alto / 2))
        	DistIzq = ((screen.width / 2) - Math.round(Ancho / 2))
        	// alert(DistArriba)
        	// alert(DistIzq)
        	params = "toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1"
        	params = params + ",width="+Ancho +",height="+ Alto
        	params = params + ",top=" + DistArriba + ",left=" + DistIzq + ", screenY=" + DistArriba + ", screenX=" + DistIzq
        		popwindow = open(page,name,params);
        		popwindow.focus();
        	return false;
        }







		function asyncProcessForm(form, url, formType){

		    var poststr = "";
		    var formType = formType == "GET" ? formType : "POST";
    		for(i=0; i<form.elements.length; i++){

    		    if(form.elements[i].name!="" && form.elements[i].value!=""){
                    poststr += form.elements[i].name + ":" + encodeURI(form.elements[i].value) + ",";
    		    }

    		    //document.write("The field name is: " + form.elements[i].name + " (" + form.elements[i].type + ") and it's value is: " + form.elements[i].value + ".<br />");

    		}
    		poststr = poststr.substr(0, poststr.length-1);

    		//$("mainContent").innerHTML=poststr;
    		manageLoadingDiv("show");

        	//var url = ('shopping.class.php?accion=compraDirectaProcess');
        	new Ajax.Request(url,  {
                method: formType,
                parameters:
                            //{
                                //accion  : target
                                Form.serialize(form)
                            //}
                            ,
                onSuccess: function(transport) {
                    result = '<img src="images/nbsp.gif" width="1" height="350" align="left">';
                    result += transport.responseText

                    	$("mainContent").innerHTML=(result);

                },
                onFailure: function(response) {
                    alert("Error al leer los datos");
                },
                onException: function(request,  ex) {
                    alert("Excepcion detectada: No se pudo realizar la accion");
                },
                onComplete: function() {
                    manageLoadingDiv("hide");
                }
            });

            //manageLoadingDiv("hide");
            return false;
		}


        cancelHide1 = false;
        cancelHide2 = false;
        cancelHide3 = false;
        cancelHide4 = false;
        cancelHide5 = false;
        cancelHide6 = false;


        function scrollToTop(){
            new Effect.ScrollTo('page', {offset: -24, duration:1.2});
        }

        function stopCarousel(){

            if($('carousel-content-hidden').innerHTML == ""){
                homeCarousel.stop();
                //alert(homeCarousel);
                //homeCarousel.first();
                $('carousel-content-hidden').innerHTML = $('carousel-content').innerHTML;
            }

            return true;

        }


        function getUrl(url, params){

            params = params != 'undefined' ? "?" + params : "";
            manageLoadingDiv("show");


            if(stopCarousel()){

	        	var url = (url + params);
	        	new Ajax.Request(url,  {
	                method: 'GET'/*,
	                parameters: {
	                                accion  : target
	                            }*/,
	                onSuccess: function(transport) {
	                    result = '<img src="images/nbsp.gif" width="1" height="350" align="left">';
	                    result += transport.responseText

	                    	$("mainContent").innerHTML=(result);

	                },
	                onFailure: function(response) {
	                    alert("Error al leer los datos");
	                },
	                onException: function(request,  ex) {
	                    alert("Exception detectada: No se pudo realizar la accion");
	                },
	                onComplete: function() {
	                    manageLoadingDiv("hide");
	                }
	            });
			}


            return false;

        }


        function getShopUrl(url, params){

            params = params != 'undefined' ? "?" + params : "";
            manageLoadingDiv("show");

        	var url = (url + params);
        	new Ajax.Request(url,  {
                method: 'GET'/*,
                parameters: {
                                accion  : target
                            }*/,
                onSuccess: function(transport) {
                    result = '<img src="images/nbsp.gif" width="1" height="220" align="left">';
                    result += transport.responseText

                    	$("shopContent").innerHTML=(result);

                },
                onFailure: function(response) {
                    alert("Error al leer los datos");
                },
                onException: function(request,  ex) {
                    alert("Exception detectada: No se pudo realizar la accion");
                },
                onComplete: function() {
                    manageLoadingDiv("hide");
                }
            });


            return false;

        }


        function getWebContents(target, params){

            params = params != 'undefined' ? "?" + params : "";
            manageLoadingDiv("show");

        	var url = ('getWebContents.class.php' + params);
        	new Ajax.Request(url,  {
                method: 'GET',
                parameters: {
                                accion  : target
                            },
                onSuccess: function(transport) {
                    result = '<img src="images/nbsp.gif" width="1" height="350" align="left">';
                    result += transport.responseText

                    	$("mainContent").innerHTML=(result);

                },
                onFailure: function(response) {
                    alert("Error al leer los datos");
                },
                onException: function(request,  ex) {
                    alert("Exception detectada: No se pudo realizar la accion");
                },
                onComplete: function() {
                    manageLoadingDiv("hide");
                }
            });

            //manageLoadingDiv("hide");

        }

        function getWebContentsJson(target, params){

            manageLoadingDiv("show");

        	var url = ('getWebContents.class.php');
        	new Ajax.Request(url,  {
                method: 'GET',
                parameters: {
                                accion  : target
                            },
                onSuccess: function(transport) {
                    json = transport.responseText.evalJSON();//(true);
                    resultJsonQuery = json.success;

                    if(resultJsonQuery == false){

                    	alert("Error al consultar con el servidor");

                    } else if(resultJsonQuery == true){

                    	//document.getElementById('loadingDiv').innerHTML=(json.data[0].result);
                    	$("mainContent").innerHTML=(json.data[0].result);

                    }
                },
                onFailure: function(response) {
                    alert("Error al realizar la selección");
                },
                onException: function(request,  ex) {
                    alert("Exception detectada: No se pudo realizar la accion");
                },
                onComplete: function() {
                    manageLoadingDiv("hide");
                }
            });

            //manageLoadingDiv("hide");

        }

        function manageLoadingDiv(action){
            //scrollToTop();
            if(action == "show"){
                //console.log("Showing Loading DIV");
                if(br=="ms"){
                    $('loadingDiv').style.position = "absolute";
                    $('loadingDiv').style.top = "0";
                    $('loadingDiv').style.left = "0";
                    $('loadingDiv').style.width = document.body.clientWidth;
                    $('loadingDiv').style.height = document.body.clientHeight;
                    $('loadingDiv').style.border = "1px solid"
                } else {
                    $('loadingDiv').clonePosition('princBox', {setLeft: true, setTop: true, setWidth: true, setHeight: true, offsetLeft: -8, offsetTop: -7});
                    $('loadingDiv').style.width = parseInt($('loadingDiv').getWidth()+10) + "px";
                    $('loadingDiv').style.height = parseInt($('loadingDiv').getHeight()) + 10 + "px";
                    /*$('loadingDiv').style.paddingTop = parseInt(($('loadingDiv').getHeight()/2)-50) + "px";*/
                }
                $('loadingDiv').style.paddingTop = "100px";
                //$('loadingDiv').style.backgroundColor = "#f7f7f7";
                $('loadingDiv').style.backgroundColor = "#fff";
                $('loadingDiv').setOpacity(.95);
                $('loadingDiv').style.display = "block";
            } else {
                //console.log("Hidding Loading DIV");
                $('loadingDiv').style.display = "none";
            }
        }

        //search.class.php
    	/*function submitForm(form){
    		form.submit();
    		return false
    	}*/

    	function chkNum(field){
            valor = field.value;

    		/*if(valor == ""){
        		alert("¡Debe introducir la cantidad deseada!");
        		field.value = "";
        		field.focus();
        		return false;
    		}*/

    		if(valor.indexOf(",") != -1){
        		alert("¡No está permitido introducir decimales!");
        		field.value = "";
        		field.focus();
        		return false;
    		}

    		if(valor.indexOf(".") != -1){
        		alert("Por favor, no introduzca puntos separadores.");
        		field.value = "";
        		field.focus();
        		return false;
    		}
    		return true
    	}

        function displayProds(destLayer){
            capa = $("prod"+destLayer);
            //alert("alto de " + destLayer + ": " + capa.getHeight());
            if(capa.style.display == "none"){
              if(br == "ms"){
                Effect.Appear("prod"+destLayer, { duration: 0.5, scaleContent: false });
              } else {
                Effect.Appear("prod"+destLayer, { duration: 3.0, scaleContent: false });
              }
                $("showProdsLink"+destLayer).innerHTML = "Ocultar productos";
            } else {
                Effect.Fade("prod"+destLayer);
                $("showProdsLink"+destLayer).innerHTML = "Ver productos";
            }
            return false;
        }


        function validateCommentsForm(formA){
          if (formA.nick.value == "")
          { alert("Por favor, escribe tu nick o apodo"); formA.nick.focus(); return false; }

          if (formA.email.value == "")
          { alert('Debes indicar una dirección de correo electrónico.'); formA.email.focus(); return false; }

          if (!(validatEmail(formA.email))){
        	  formA.email.focus; return false;
          }

          if (formA.city.value == "")
          { alert('Debes indicar un tema o asunto'); formA.city.focus(); return false; }

          if (formA.mensaje.value == "")
          { alert('No olvides tu mensaje!'); formA.mensaje.focus(); return false; }

          if (formA.cf_verif_box.value == "")
          { alert('No es posible enviar el formulario sin el texto de comprobación'); formA.cf_verif_box.focus(); return false; }

          //formA.submit();
          asyncProcessForm(formA, "getWebContents.class.php?accion=participateFormProcess", "POST");

        }


        function validateContactForm(formA){
          if (formA.Nombre.value == "")
          { alert("Por favor, escribe tu nombre completo"); formA.Nombre.focus(); return false; }

          if (formA.eMail.value == "")
          { alert('Debes indicar una dirección de correo electrónico.'); formA.eMail.focus(); return false; }

          if (!(validatEmail(formA.eMail))){
        	  formA.eMail.focus; return false;
          }

          if (formA.Tel.value == "")
          { alert('Debes indicar un número de teléfono'); formA.Tel.focus(); return false; }

          if (formA.Comentarios.value == "")
          { alert('No olvides tus comentarios!'); formA.Comentarios.focus(); return false; }

          if (formA.cf_verif_box.value == "")
          { alert('No es posible enviar el formulario sin el texto de comprobación'); formA.cf_verif_box.focus(); return false; }

          //formA.submit();
          asyncProcessForm(formA, "getWebContents.class.php?accion=contactFormProcess", "POST");

        }

        function validatEmail(emailRCV)	{
        	emailRCVV = emailRCV.value;
        	if(emailRCVV.length==0)
        		return true;
        	var indice;
        	indice = emailRCVV.search("@");
        	if ( indice == (-1)){
        		alert("Por favor, indica una dirección de correo electrónico correcta.");
        		//emailRCV.focus();
        		return false;
        	}

        	var longitud = emailRCVV.length;
        	delnumber = emailRCVV.indexOf('@',0);
        	if ( delnumber == -1){
        		alert("Por favor, indica una dirección de correo electrónico correcta.");
        		//emailRCV.focus();
        		return false;
        	}
        	domain = emailRCVV.substring(delnumber +1);
        	if( domain.charAt(0) == '.' || domain.charAt(0) == '@'){
        		alert("Por favor, indica una dirección de correo electrónico correcta.");
        		//emailRCV.focus();
        		return false;
        	}
        	lastdom = emailRCVV.lastIndexOf('.');
        	if ( lastdom == -1 || lastdom == longitud -1 ){
        		alert("Por favor, indica una dirección de correo electrónico correcta.");
        		//emailRCV.focus();
        		return false;
        	}
        	return true;
        }


        /*function irA(elemID) {
        	var offsetTrail = document.getElementById(elemID);
        	var offsetLeft = 0;
        	var offsetTop = 0;
        	while (offsetTrail) {
        		offsetLeft += offsetTrail.offsetLeft;
        		offsetTop += offsetTrail.offsetTop;
        		offsetTrail = offsetTrail.offsetParent;
        	}
        	if (navigator.userAgent.indexOf("Mac") != -1 && typeof document.body.leftMargin != "undefined" && navigator.appName=="Microsoft Internet Explorer" ) {
        		offsetLeft += parseInt(document.body.leftMargin);
        		offsetTop += parseInt(document.body.topMargin);
        	}
        	window.scrollTo(offsetLeft,offsetTop)
        }*/
