$(document).ready(function(){
//activamos el carusel para mostrar
$("#mycarousel").css({'visibility' : 'visible'});
						 
$("#btn_recordar").click(function (){
$("#cap_olvido").removeClass("textosciclo2");

})

$("#link_olvido").click(function () {
	 // $("#registrate").css({'z-index' : '5'});
	  if ($("#cap_olvido:first").is("#cap_olvido:hidden")) {
        $("#cap_olvido").slideDown("slow");
      } else {
        $("#cap_olvido").hide();
		//$("#registrate").css({'z-index' : '1'});
		
      }
}); 



	  
$("#button_login").click(function () {
	 // $("#registrate").css({'z-index' : '5'});
	  if ($("#mensaje_login:first").is("#mensaje_login:hidden")) {
        $("#mensaje_login").slideDown("slow");
      } else {
        $("#mensaje_login").hide();
		//$("#registrate").css({'z-index' : '1'});
		
      }
});

$("#button_olvido").click(function(){
$("#cap_olvido").css("background-image","url(images/limpio_olvido_nube.png)");
$("#cap_olvido").addClass("info_mensaje");
								   
})



});


function filtro(capa,url)
{
$("#"+capa).load(url,{evalScripts:true});
	
}



function limitattach(form, file) {
extarray = new Array(".JPG", ".jpg");
allowSubmit = false;
if (!file) return;
while (file.indexOf("\\") != -1)
file = file.slice(file.indexOf("\\") + 1);
ext = file.slice(file.indexOf(".")).toLowerCase();
for (var i = 0; i < extarray.length; i++) {
if (extarray[i] == ext) { allowSubmit = true; break; }
}
if (allowSubmit)
{}
else
{
alert("se permiten unicamente archivos con la extencion: "
+ (extarray.join(" ")) + "\npor favor, seleccione otro archivo "
+ "e intente de nuevo.");
}}




function validar_busqueda(frm)
{
if (frm.departamento.value=='')
{
alert('Debe seleccionar un departamento');
frm.departamento.focus()
return false
}

if (frm.marcas.value=='')
{
alert('Debe seleccionar una marca');
frm.marcas.focus()
return false
}

if (frm.modelos.value=='')
{
alert('Debe seleccionar un modelo');
frm.modelos.focus()
return false
}


if (frm.ano_desde.value=='')
{
alert('Debe seleccionar el ano del modelo');
frm.ano_desde.focus()
return false
}

if (frm.ano_hasta.value=='')
{
alert('Debe seleccionar el ano del modelo');
frm.ano_hasta.focus()
return false
}


if (frm.precio_desde.value=='')
{
alert('Debe seleccionar el precio del modelo');
frm.precio_desde.focus()
return false
}

if (frm.precio_hasta.value=='')
{
alert('Debe seleccionar el precio del modelo');
frm.precio_hasta.focus()
return false
}


return true
}





function objetoAjax(){

	var xmlhttp=false;

	try {

		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");

	} catch (e) {

		try {

		   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

		} catch (E) {

			xmlhttp = false;

  		}

	}



	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {

		xmlhttp = new XMLHttpRequest();

	}

	return xmlhttp;

}

		var nav4 = window.Event ? true : false;
function acceptNum(evt){	
// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57	
var key = nav4 ? evt.which : evt.keyCode;	
return (key <= 13 || (key >= 48 && key <= 57));
}




function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function cargar(capa,url)
{
	

	divresultado=document.getElementById(capa);

	var Aleatorio=parseInt(Math.random()*99999999);

	ajax=new objetoAjax();
	
	//aki sacamos la varia que seguira a la url si es un & o ?
	
	if (url.indexOf("?")>0){encadenar="&";}else{encadenar="?";}

	ajax.open("GET",url + encadenar +"rand=" + Aleatorio,true);

	ajax.onreadystatechange=eval(useHttpResponse);
 
	ajax.send(null);
}


function useHttpResponse() {
  if (ajax.readyState == 4) 
   {
   		 if(ajax.status == 200) 
		{
divresultado.innerHTML=ajax.responseText;
		}
 } 
 else 
  {
  divresultado.innerHTML = '<br /><br /><br /><br /><center><div id="preloading">Cargando<br /><img src="images/load.gif" /></div></center>';
  }
}

	
	

function imprimir_pop(que) {
var ventana = window.open("", "", "");
var contenido = "<html><head><link href='css/estilo_popup.css' rel='stylesheet' type='text/css' /><link href='css/slider_style.css' rel='stylesheet' type='text/css' /><script type='text/javascript' src='js/jquery-1.2.6.min.js'></script>	<script type='text/javascript' src='js/jquery-easing-1.3.pack.js'></script>	<script type='text/javascript' src='js/jquery-easing-compatibility.1.2.pack.js'></script>	<script type='text/javascript' src='js/coda-slider.1.1.1.pack.js'></script>		<script type='text/javascript'>			var theInt = null;		var $crosslink, $navthumb;		var curclicked = 0;				theInterval = function(cur){			clearInterval(theInt);						if( typeof cur != 'undefined' )				curclicked = cur;						$crosslink.removeClass(\"active-thumb\");			$navthumb.eq(curclicked).parent().addClass(\"active-thumb\");				$(\".stripNav ul li a\").eq(curclicked).trigger('click');						theInt = setInterval(function(){				$crosslink.removeClass(\"active-thumb\");				$navthumb.eq(curclicked).parent().addClass(\"active-thumb\");				$(\".stripNav ul li a\").eq(curclicked).trigger('click');				curclicked++;				if( 6 == curclicked )					curclicked = 0;							}, 3000);		};				$(function(){						$(\"#main-photo-slider\").codaSlider();						$navthumb = $(\".nav-thumb\");			$crosslink = $(\".cross-link\");						$navthumb			.click(function() {				var $this = $(this);				theInterval($this.parent().attr('href').slice(1) - 1);				return false;			});						theInterval();		});	</script><style type='text/css'>body{ font-family:arial;font-size:12px;color:#000000; }#baseimp{margin-right:auto;margin-left: auto;}</style></head><body onload='window.print();window.close()'><div id='baseimp'>" + document.getElementById(que).innerHTML + "</div></body></html>";
ventana.document.open();
ventana.document.write(contenido);
ventana.document.close();
}

function imprimir(que,css) {
var ventana = window.open("", "", "");
var contenido = "<html><head><link href='css/"+css+".css' rel='stylesheet' type='text/css' /><style type='text/css'>body{ font-family:arial;font-size:12px;color:#000000; }#baseimp{margin-right:auto;margin-left: auto;}</style></head><body onload='window.print();window.close()'><div id='baseimp'>" + document.getElementById(que).innerHTML + "</div></body></html>";
ventana.document.open();
ventana.document.write(contenido);
ventana.document.close();
}

function confirmar(url,mensaje)
{
if (confirm(mensaje))
{
window.location=url;
}
}

		var nav4 = window.Event ? true : false;
function acceptNum(evt){	
// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57	
var key = nav4 ? evt.which : evt.keyCode;	
return (key <= 13 || (key >= 48 && key <= 57));
}

