function fncEstablecerCorrigiendo( bool )
{
  var obj = document.getElementById("Operadora");
  if(obj)obj.value=bool?1:0;
  obj = document.getElementById("BloqueOperadora");
  obj.style.display = bool?'block':'none';
}
  
function fncagregarafavoritos(txt)
{   window.external.AddFavorite(location.href, document.title);
    event.returnValue = false;

}
   
function fncpaginainicio(txt)
{  
  HomePage.setHomePage(txt);
  event.returnValue = false;  
}

function Valida(frmg)
{
  if ((frmg.q.value == '') && (frmg.z.value == '') && (frmg.cf.value == ''))
  {
    alert("Debes indicar alguna palabra o elegir una provincia o una categorķa.");
    frmg.q.focus();
    return false;
  }
  frmg.submit();
}
		

var myrules = {
	'input' : function(el){ 
	                         el.onfocus = function(){ el.select(); el.style.background = 'white'; }
						  },
	'textarea' : function(el){ 
	                         el.onfocus = function(){ el.select(); }
							 },
	'#FormBuscar' : function(el){ el.onsubmit = function() { return Valida(el); } },
	'#HomePage' : function(el){ el.onclick = function() { return fncpaginainicio(location); } },
	'#PagFavoritos' : function(el){ el.onclick = function() { return fncagregarafavoritos(location); } },
	'#Corrigiendo':function(el){ el.onclick = function() { return fncEstablecerCorrigiendo( el.checked ) } }
	};
Behaviour.register(myrules);


		//<![CDATA[	
		function handleHttpResponse() { 
			if (http.readyState == 4) { 
			if (http.status == 200) { 
				if (http.responseText.indexOf('invalid') == -1) {
					// Armamos un array, usando la coma para separar elementos
					results = http.responseText.split("	"); 
					
					//alert(results[0]);			
					//var i;
					//for (i=0; i<results.length-1 ; i++)
					//{
					//	anadirOpcion(unescape(results[i+1]),results[i]);
					//	i++;
					//}
					enProceso = false;
				}
			}
			}
		}
		
		function InsertarVisitasWeb(dominio) {
		    
			if (!enProceso && http) {
		    var f = new Date();
			var url = dominio + "/std/insertarVisitas.asp?n=" + f.getHours() + f.getMinutes() + f.getSeconds() + f.getMilliseconds() + Math.random();
			http.open("GET", url, true);
			http.onreadystatechange = handleHttpResponse;
			enProceso = true;
			http.send(null);
			}
		}
		
		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 enProceso = false; // lo usamos para ver si hay un proceso activo
		var http = getHTTPObject(); // Creamos el objeto XMLHttpRequest
		 //InsertarVisitasWeb("http://www.cambalache.es");
		  
