// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

//a custom format option callback
var addressFormatting = function(text){
	var newText = text;
	//array of find replaces
	var findreps = [
		{find:/^([^\-]+) \- /g, rep: '<span class="ui-selectmenu-item-header">$1</span>'},
		{find:/([^\|><]+) \| /g, rep: '<span class="ui-selectmenu-item-content">$1</span>'},
		{find:/([^\|><\(\)]+) (\()/g, rep: '<span class="ui-selectmenu-item-content">$1</span>$2'},
		{find:/([^\|><\(\)]+)$/g, rep: '<span class="ui-selectmenu-item-content">$1</span>'},
		{find:/(\([^\|><]+\))$/g, rep: '<span class="ui-selectmenu-item-footer">$1</span>'}
	];
	
	for(var i in findreps){
		newText = newText.replace(findreps[i].find, findreps[i].rep);
	}
	return newText;
};

$(document).ready(function() {
	$(".column").equalHeights();
});  

$(function() {

  $(".anyClass").jCarouselLite({
    btnNext: ".next",
    btnPrev: ".prev"
  });

	$('select#acct_type').selectmenu({
		style:'dropdown',
		width:217,
		maxHeight:100
	});

  $('#account_selector a.btn').click(function(e) {
    $('#wrap').toggle();
    e.preventDefault();
  });
  
  $('#wrap').mouseleave(function(){
    $('#wrap').hide();
  });
  
});

