// JavaScript Document

/**
 Synchronize page content columns heights by Matias and Julio
 **/
$(document).ready(function() {
	footer();
});

function SyncHomeHeight() {
	var maxHeight = 0;
	var allColumns = $("div[class^='int_']");
	var _int = $(".vertical_menu_container").height();
	
	/*jQuery.each(allColumns, function() {
		if($(this).height() > maxHeight) {
			maxHeight = $(this).height();
		}
	});
	
	jQuery.each(allColumns, function() {
		//$(this).css("height",maxHeight);
		var _height = maxHeight - _int;
			$(this).find("div.banking_secc_links").css("height", _height);
			$(this).find("div.right_links_grey_box").css("height",_height + 14);
	});	*/
}

function SyncHeight() {
	var maxHeight = 0;
	var allColumns = $("div[class^='int_']");
	
	/*jQuery.each(allColumns, function() {
		if($(this).height() > maxHeight) {
			maxHeight = $(this).height();
		}
	});
	
	jQuery.each(allColumns, function() {
		$(this).css("height",maxHeight);
		if($(this).hasClass("vertical_menu_container")) {
			$(this).find("div.right_links_grey_box").css("height",maxHeight);
		}
	});*/
}


function SyncHeightInterior() {
	var maxHeight = 0;
	var allColumns = $("div[class^='int_']");
	var maxRight = $("div.vertical_menu_container").height();
	
	/*jQuery.each(allColumns, function() {
		if($(this).height() > maxHeight) {
			maxHeight = $(this).height();
		}
	});
	
	jQuery.each(allColumns, function() {
		$(this).css("height",maxHeight);
		if($(this).hasClass("int_left")) {
			$(this).find("div.banking_secc_links").css("height", maxHeight);
		}	
		if($(this).hasClass("div.vertical_menu_container")) {
			var lastmax = maxRight + maxHeight;
			$(this).find("div.int_forcer").css("height", lastmax);
		}
	});*/
}

/**
 Set Pointed separator the height of his container (where available)
 */

function SetPointedSeparatorHeight() {
	var maxHeight = $("div.module_box").height();
	$("div.pointed_separator").height(maxHeight);	
}
 
 /**
 Prepare textbox for a search
 */
 
function SetSearchReady() {
	$("#txt_search").val("Buscar");
	
	$("#txt_search").bind("focus", function(e) {
		$(this).val("");										 
	});	
	$("#txt_search").bind("blur", function(e) {
		$(this).val("Buscar");										 
	});	
}

 /**
 misc
 */
 
 function prepareShowHideDocsSection() {
	$("div#cont_documentacion").hide();
	$("div#cont_table").hide();
	$("ul#cont_ul").hide();
	
	$("a#lnk_cont_docs").bind("click", function(e) {
		$("div#cont_documentacion").toggle("slow");											
	});
	$("a#lnk_cont_table").bind("click", function(e) {
		$("div#cont_table").toggle("slow");											
	});
	$("a#lnk_cont_ul").bind("click", function(e) {
		$("ul#cont_ul").toggle("slow");											
	});	
}
 
  function prepareShowHideDocsSectionUy() {
	$("div#cont_documentacion_nac").hide();
	
	$("a#lnk_cont_docs_nac").bind("click", function(e) {
		$("div#cont_documentacion_nac").toggle("slow");											
	});
 }

 function prepareShowHideDocsSectionUsd() {
	$("div#cont_documentacion_usd").hide();
	
	$("a#lnk_cont_docs_usd").bind("click", function(e) {
		$("div#cont_documentacion_usd").toggle("slow");											
	});
 }
 
 
/***** Agreado por julito ********/

 function HideUL() {
    $("ul.gold_arrow_list ul").each(function() {
			$(this).hide();
	 });
 }

 function AllHide(){
     $("ul.common_grey_12").each(function() {
			$(this).hide();
	 });
  }

 function ShowMaestro() {
	 $("p#function").hide();
	 $("p#function").css("margin-left","10px");
 	 AddLink($("li#maestro"));
	 $("li#maestro").css("text-decoration","underline");
	 $("li#maestro").bind("click", function() {
		  $("p#function").slideToggle("slow");
		});
	 }

 function AddStyle() {
	$("strong.light_green_13").css("cursor","pointer");	 
 }

 function ShowHideP() {
	$("strong.light_green_13").bind("click", function(e) {
		showHideInfoBox($(this));									  
	});	 
 }

 function showHideInfoBox(objCaller) {	
	var arrBoxText = $(objCaller).next();	
	jQuery.each(arrBoxText, function() {
		$(this).toggle("slow");						   			
	});	
 }

 function prepareShowHideRSVP() {
	$("div#cont_beneficios a[rel]").each(function() {
		 var sitch = $(this).attr("rel");
		 var left_ = $("div.info_left_col").height();
		 var right_ = $("div.int_forcer").height();
		  $(this).css({"text-transform":"uppercase","font-size":"11px"});
		  $(this).addClass("destacadoRojo");
		  $(this).attr("href","javascript:;");
		  $("div#"+sitch).hide();
	      $(this).click(function() {						 
			 	prepareStyleEnlace(sitch);
			 	prepareStyle(sitch);
			 	$("div#"+sitch).toggle("slow");				
			 	$("div#"+sitch+" p:first").removeClass("light_green_12");
			 	$("div#"+sitch+" p:first").addClass("light_green_13");				
       });
   });
 }

 function prepareStyleEnlace(parrafo){
	$("div#"+parrafo+" p a").each(function() {
	 $(this).css({"color":"#658591","text-decoration":"underline","text-transform":"lowercase"});
	 $(this).removeClass("destacadoRojo");
  });
 }

 function prepareStyle(parrafo){
	$("div#"+parrafo+" p").each(function() {
	 $(this).addClass("light_green_12");
	 $(this).css({"margin":"10px 0px"});
  });
 }
 
 function ShowDivs() {
     //toUpperCase() y toLowerCase();
	 $("#sucursales").change(function() {
		 var url = $(this).val().toLowerCase();
			if(url == -1){
			 return false;
			  }else{
				 window.location.href = "cajeros-automaticos.asp?dep=" + url;
			  };
		});
 }
 
 function ShowNoticias() {
	 $("ul.servicios a[rel]").each(function () {
		var date = $(this).attr("rel");
		var url = $(this).attr("id");
		$(this).click(function() {
			 $("#load_noticias").html(" ");
			 $("#load_noticias").load("noticias/"+date+"/"+url+".asp");				   
			});
		});
 }
 
 function ShowItems() {
	 $("ul.servicios li.menuShow").each(function() {
			$(this).hide();
			$(this).css({"padding-left":"5px","padding-top":"5px"});
	  });
	 
     $("ul.servicios li[class=actual]").each(function() {
          var id = $(this).attr("id");
		   if(id != 1){	   	 
		   $(this).css({"cursor":"pointer","text-decoration":"underline"});
		   $(this).click(function() {
		     showHideInfoBox($(this));
	       });
		 };
	 });
 }
 
 function ShowItemsP() {
     $("ul#serviciosVisa").hide();
	 $("ul#serviciosMaster").hide();
	 $("ul#leones1").hide();
	 $("ul#leones2").hide();
	 $("div.tarjetas_gral_master").addClass("classAddLeft");
	 $("p.leones a#leones_2").css("cursor","pointer");
	 
	 $("ul#visa li:first a#visa").bind("click", function() {
		  $("ul#serviciosVisa").slideToggle("slow");
	      $("div.tarjetas_gral_visa").addClass("classAdd");
		  $("div.tarjetas_gral_master").removeClass("classAddLeft");
		  });
	 
	 $("ul#master li:first a").bind("click", function() {
		  $("ul#serviciosMaster").slideToggle("slow");
	      $("div.tarjetas_gral_master").addClass("classAddLeft");
		  $("div.tarjetas_gral_visa").removeClass("classAdd");		  
		  });
	 
	 $("p.leones a#leones_1").bind("click", function() {
		  $("ul#leones1").slideToggle("slow");  
		  });
	 
	 $("p.leones a#leones_2").bind("click", function() {
		  $("ul#leones2").slideToggle("slow"); 
		  });	 
 }

 function AddLink(obj) {
	jQuery.each(obj, function() {
		 $(this).css("cursor","pointer")
		});	 
 }
 
 function ShowItemsAll(id) {
    $("ul.servicios li[id="+id+"]").each(function() {
	   var id = $(this).attr("id");
	   if(id!=""){
		  $(this).slideToggle("slow");
	   };
	});	 
 }
 
function showMemorias() {
   $("tr.bp_memorias a").each(function() {
	       var id = $(this).attr("id");
		   $(this).click(function() {
			   attrValue(id);
			 });							 
		 });
}

function attrValue(idObj) {
   $("tr.bp_memorias div").each(function() {
           var value = $(this).attr("title");
		 if(idObj == value){
		   $(this).slideDown("slow");
		 }else{
		   $(this).slideUp("slow");}
   });
}

function moreInfo() {
   $("#more_info").hide();
   $("a.more_info_gold").click(function() {
			 $("#more_info").slideToggle("slow");							
			});
}

function allHeightRSVP() {
	var maxHeight = 0;
	var allColumns = $("div[class='int_middle']").height();
	var allDivs = $("div#cont_beneficios div");
	
	jQuery.each(allDivs, function() {
	  if($(this).is(':hidden')) {
	   max_Height = $(this).height();
	   max_Height--;
	  }
	});	  
	
	if(maxHeight < allColumns) {
		maxHeight = allColumns;
	   $("div.info_left_col").css("height", maxHeight);
	   $("div.int_forcer").css("height", maxHeight);
	};
}

function footer(){
  var alto = $("div.layout_container").height();
  $("div.footer_container").css({"top":alto,"z-index":99});
}

function bc_preferencial(){
  var alto = $("div.int_forcer").height();
  $("div.int_right").css({"height":alto});
}

function bc_sucursales(){
  var alto = $("div.int_forcer").height();
  var alto2 = $("div.int_middle").height();
  if(alto > alto2){
  $("div.int_middle").css({"height":alto});
  }
}