// JavaScript Document
<!--Javascript Appartager -->

	<!-- 
		// javascript triggered when the user tries to preview - called on clicking the links

		function Trim (Str)
		{
			if (Str != null)
			{
				var start = 0 ;
				var newstr = new String(Str);
				var end = newstr.length - 1 ;
				while (start < end && Str.charAt(start) == " ") start++ ;
				while (end >= 0 && newstr.charAt(end) == " ") end-- ; 
				if (end < start) return "" ;
				return newstr.substring(start, (end + 1)) ;
			}
			else
			{
				return newstr;
			}
		}
		
		function DoPreview(a)
		{
			with (window.document.indexfrm)
			{ 
				var errString = ""; var focusOn = ""; var t = "";
					if (search[0].checked){t = 'L';}
				else
				{
					if (search[1].checked){t = 'H';}
					else{alert("Seleccionar Busco o tengo");}
				}
				
				if (Trim(t) != "")
				{
					if (metroSelect.options[metroSelect.selectedIndex].value == '' || metroSelect.options[metroSelect.selectedIndex].value == '-')
					{
						errString = errString + "\nSelecciona una ciudad"; focusOn=typeof(focusOn)=="object" ? focusOn : metroSelect;
					}
					if (errString.length > 0)
					{
						alert(errString); 
						focusOn.focus();
					}
					else
					{
						if (t == 'L')
						{
							if (a == 'P')
								window.location.href="http://www.easypiso.com/default.aspx?pt=L&lc=3&mc="+metroSelect.options[metroSelect.selectedIndex].value+'&t='+t+'&ac=nicolas1'; 
							else
								window.location.href="http://www.easypiso.com/default.aspx?at=L&lc=3&mc="+metroSelect.options[metroSelect.selectedIndex].value+'&t='+t+'&ac=nicolas1';
						}
						else
						{
							if (a == 'P')
								window.location.href="http://www.easypiso.com/default.aspx?pt=H&lc=3&mc="+metroSelect.options[metroSelect.selectedIndex].value+'&t='+t+'&ac=nicolas1';
							else
								window.location.href="http://www.easypiso.com/default.aspx?at=H&lc=3&mc="+metroSelect.options[metroSelect.selectedIndex].value+'&t='+t+'&ac=nicolas1';
						}		
					}
				}
			}
		}
			
		function searchclk(c){
			with (window.document)
			{
				if (c == 'bl'){
					getElementById('bl');
				}
				else{
					getElementById('bj');
				}
			}
		}
	//-->
