//var $j = jQuery.noConflict();
	    $(function() {
		    /* COMBO BOX */
		    var comboboxSettings = {animationSpeed: 100};
	    	// Create the example combobox
			var comboP=$('.styledComboProvincia').combobox(
				{
					comboboxContainerClass: "comboboxContainerGde",
					comboboxValueContentContainerClass: "comboboxValueContainer",
					comboboxValueContentClass: "comboboxValueContent",
					comboboxDropDownClass: "comboboxDropDownContainer",
					comboboxDropDownButtonClass: "comboboxDropDownButton",
					comboboxDropDownItemClass: "comboboxItemGde",
					comboboxDropDownItemHoverClass: "comboboxItemHover",
					comboboxDropDownGroupItemHeaderClass: "comboboxGroupItemHeader",
					comboboxDropDownGroupItemContainerClass: "comboboxGroupItemContainer"
				},
				{
					animationType: 'slide',
					width: 134
				});
			$('.styledComboProvincia').combobox.onChange = 
					function()
					{
					    if ($('#valProvincia').val()!=$("#listProvincias").val())
					    {
					    	xajax_cargaSelectCentros($("#listProvincias").val(), -1);
					    }
					};
				setupCentro();
	    });	
	    
	    function setupCentro()
	    {	    	
	    	var comboC = $('.styledComboCentros').combobox(
					{
						comboboxContainerClass: "comboboxContainerGde",
						comboboxValueContentContainerClass: "comboboxValueContainer",
						comboboxValueContentClass: "comboboxValueContent",
						comboboxDropDownClass: "comboboxDropDownContainer",
						comboboxDropDownButtonClass: "comboboxDropDownButton",
						comboboxDropDownItemClass: "comboboxItemGde",
						comboboxDropDownItemHoverClass: "comboboxItemHover",
						comboboxDropDownGroupItemHeaderClass: "comboboxGroupItemHeader",
						comboboxDropDownGroupItemContainerClass: "comboboxGroupItemContainer"
					},
					{
						animationType: 'slide',
						width: 154
					});
	    	
	    	
	    }
	    
	    function pintaCupon(tipocupon){

	    	var idCentro = document.getElementById('listCentros').value;
	    	if (idCentro != '-1'){
	    		window.open("rn_cupon.php?tc="+tipocupon+"&centro="+idCentro,'Renault','toolbar=0,location=1,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=650,height=530');
	    	}else{
	    	  alert("Debes seleccionar un centro");
	      }
	    	
	    	
	    }

               
	    function pintaCita(tipocupon)
	    {
			var idCentro = document.getElementById('listCentros').value;
			
			if (idCentro != '-1') 
			{
				// document.getElementById("botonPopup").click();
				// enablePopup();
				muestraPopCitaTaller(idCentro);
			} 
			else 
			{
				alert("Debes seleccionar un centro");
			}
	    }

	    
	    function muestraCentros(){	    	
	    	window.location ='/rn_postventa.php?promo=true';
	    }
	    
	    
	    function citaPrevia(){
	    	var prov = document.getElementById("listForm").value;
	    	xajax_comboCentrosForm(prov);
	    	return false;
	    	
	    }
	    
	    

	    function isNoCampoVacio (theElement){
	    	if (theElement.value == ''){
	            document.getElementById('error_form').innerHTML="Por favor, rellene todos los campos obligatorios";
	            theElement.focus();
	            return false;        
	        }
	    	else{
	    		return true;
	    	}
	    		
	    }

	    function isEmailAddress(theElement){
	        var email = theElement.value;
	        var filter=/^[A-Za-z][.A-Za-z0-9_]*@[A-Za-z0-9_]+.[A-Za-z0-9_.]+[A-za-z]$/;
	        if (filter.test(email))
	            return true;
	        document.getElementById('error_form').innerHTML="Proporcione una dirección de eMail válida";
	        theElement.focus();
	        return false;
	    }

	    function isPhoneNumber(theElement){
	        var filter = /[0-9]{3}[-]?[0-9]{3}[-]?[0-9]{3}/;
	        if (!filter.test(theElement.value)){
	       	 document.getElementById('error_form').innerHTML="Proporcione un teléfono válido";
	       	 theElement.focus();
	         return false;
	        }
	        return true;
	    }

	    function isAcepted(theElement){
	        if (!theElement.checked){
	       	 document.getElementById('error_form').innerHTML="Acepte la política de protección de datos";
	       	 theElement.focus();
	            return false;
	        }
	        return true;
	    }
	    
	    function selecionaCentro(theElement){
	        if (theElement.value==-1){
	       	 document.getElementById('error_form').innerHTML="Seleccione un Centro";
	       	 theElement.focus();
	            return false;
	        }
	        return true;
	    }


	    function pideCita(f){
	    	frm=document.getElementById(f);
	    	
	    	if (isAcepted(frm.acepto)){	    		
	    		if (selecionaCentro(frm.listCentros)){
		    		if (isEmailAddress(frm.mail)){
		    			if (isPhoneNumber(frm.telefono)){
		    				if (isNoCampoVacio(frm.nombre) && isNoCampoVacio(frm.marca) && isNoCampoVacio(frm.modelo)){
		    					xajax_mailPideCitaPost(xajax.getFormValues(frm));
		    				}
		    			}
		    		}
	    		}
	    	}
	    	return false;
	    }
	    




      function getHTTPObject() {
        var xmlhttp;
        /*@cc_on
        @if (@_jscript_version >= 5)
          try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
          } catch (e) {
            try {
              xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
              xmlhttp = false;
            }
          }
        @else
        xmlhttp = false;
        @end @*/
        if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
          try {
            xmlhttp = new XMLHttpRequest();
          } catch (e) {
            xmlhttp = false;
          }
        }
        return xmlhttp;
      }
      
      var http = getHTTPObject();
      
      function muestraPopCitaTaller(centro)
      {
      	if (http != null) 
      	{
      		//http.open("GET", "rn_formulario6.php?cen="+centro, true);
      		http.open("GET", "/formularios/rn_form_citataller.php?cen="+centro, true);
      		http.onreadystatechange = muestraPopUp;
      		http.send(null);
      	}
      	return false;
      }

      function muestraPopUp(){
      	if (http.readyState == 4){
          	if (http.status==200){
      			document.getElementById('popupmotor').innerHTML = http.responseText;
      		}
      	}
      	enablePopup('popupmotor');
      	return false;
      }
