function redirecciona(pageWeb){
	document.location.href = pageWeb;
}

function openWindow(mypage, myname, w, h, t, l, scroll,resizable) {				
	if (t == 0 || l == 0){
		var winl = (screen.width - w) / 2;
		var wint = (screen.height - h) / 2;
	}else{
		var winl = l;
		var wint = t;
	}
	
	var winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable='+resizable+',toolbar=no'
	var win = window.open(mypage, myname, winprops)
		if (parseInt(navigator.appVersion) >= 4)
		{
			win.window.focus();
		}
}	

function vbuscar()
{
if(document.buscador.q.value=='')
{ alert('Debe escribir el texto a buscar.'); return; }

if(document.buscador.donde.selectedIndex==0)
{  alert('Debe seleccionar en donde realizar la busqueda'); return; }

document.buscador.submit();

}

function checkforo(theForm){
	if (theForm.nombre.value == ""){
		alert(": Alerta : \n _______________________________________\n\n El campo Nombre no puede se omitido.")
		theForm.nombre.focus()
		return (false)
	}else if(theForm.codigo.value == ""){
		alert(": Alerta : \n _______________________________________\n\n Introduce el Código de Seguridad que aparece en la imagen.")
		theForm.codigo.focus()
		return (false)
	}else if(theForm.comentarios.value == ""){
		alert(": Alerta : \n _______________________________________\n\n El campo Comentarios no puede se omitido.")
		theForm.comentarios.focus()
		return (false)
	}
}


$(document).ready(function()
{
	 	     $("#formulario").submit( function(){
				var datos_form= $("#formulario").serialize();
				$("#log_msg").removeClass().addClass('status-msg').text('Procesando...').fadeIn(1000);	
				$.post("procesar.php",datos_form, function(data){
					switch(data)
		  			{
					  case '1':
		  				$("#log_msg").fadeTo(200,0.1,function()  
						{ $(this).html('Proceso Completado').removeClass().addClass('ok').fadeTo(900,1, function(){	
						
						$('#mail').val('');	document.location.reload(); 
						
												});});
		 			 break;
		 			 case '0':
		 				 $("#log_msg").fadeTo(200,0.1,function() 
						 {$(this).html('Datos Incompletos.').removeClass().addClass('error').fadeTo(900,1);});	
		     		 break;
		 			 case '2':
		  				$("#log_msg").fadeTo(200,0.1,function() 
						{ $(this).html('Datos Incorrectos.').removeClass().addClass('error').fadeTo(900,1);});	
					  break;
					  }
						
				});
				return false;
		});
	
});











