
$(document).ready(function(){      
	$("a.box").colorbox(); 
	$("a.inline").colorbox({width:"50%", inline:true, href:"#login"});
	$("a.menu1").colorbox({width:"80%", inline:true, href:"#menu1"});	
	$("a.menu2").colorbox({width:"80%", inline:true, href:"#menu2"});		
	$("a.menu3").colorbox({width:"80%", inline:true, href:"#menu3"});			
	$("a.iframe").colorbox({width:"50%", height:"50%", iframe:true}); 
	
	$("#accordion").accordion({}); 
	$("a[rel='mapas']").colorbox(); 
	$("#form-login,#form-reg-usr").validate({
	  rules: {
			pass: {
				required: true,
				minlength: 5
			}			
		  }
	});
	// $('a.help').tooltip({ 
	// 	track: true, 
	// 	delay: 0, 
	// 	showURL: false, 
	// 	showBody: " - ", 
	// 	fade: 250 
	// }); 
	$.localScroll();
 
	$('a.ver-requerimientos').click(function(){			
		$(this).parent().parent().find('div.resumen').toggle("slow");
	});   


	
	// $(window).scroll(function(e){ 
	//   $el = $('.secondary'); 
	//   if ($(this).scrollTop() > 200 && $el.css('position') != 'fixed'){ 
	//     $('.secondary').css({'position': 'fixed', 'top': '0px'}); 
	//   } 
	// }); 
	    
});
/**
 NO BORRAR ESTO ES PARA ARREGLAR LAS SESSIONES Y OTROS COMPONENTES QUE SE UTILIECE DE CODE IGNITER O CMS
*/
var appsurl="/pages/index.php/";
//if(checkServerUrl()=="http://www")
//	location.href=redirecciona();
/*  NO BORRAR ESTAS FUNCIONESME FORZA A CREAR LA URL CORRECTA  */
function checkServerUrl(){
	var url=location.href
	var arr=url.split(".");
	return arr[0];
}

function getCorrectUrl(){
	var url=location.host
	if(checkServerUrl()=="www"){//si vino www
		
		var arr=url.split("www.");
		return "http://"+arr[1];
	}else
		return "http://"+url;
}

function redirecciona(){ 
    var hrefurl=location.href;	
    var newurl=hrefurl.replace("www.","");

    return newurl;
}

     
function doBack() {
  if (!document.getElementsByTagName) return false;
  var links = document.getElementsByTagName("a");
  for (var i=0; i < links.length; i++) {
    if (links[i].className.match("back")) {
      links[i].onclick = function() {
        // window.open(this.href);
		window.history.back(this.href);    
        return false;
      }
    }
  }
}
window.onload = doBack;

