// creator Katz Web Services
(function ($) {
// VERTICALLY ALIGN FUNCTION
$.fn.vAlign = function() {
	return this.each(function(i){
	var ah = $(this).height();
	var ph = $(this).parent().height();
	var mh = (ph - ah) / 2;
	$(this).css('padding-top', mh);
	});
};
})(jQuery);

//preload
(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery)

$(document).ready(function() {
	$("#preferred-provider header #co-brand,#preferred-provider header #co-brand a").vAlign();
	
	//target="_blank"
	$("a[rel='nofollow'], a[rel='external']").click( function() {
		window.open(this.href);
        return false;
    });
	
	//let prettyPhoto run
	if(typeof $("a[class*='prettyPhoto']").prettyPhoto == 'function') {
		$("a[class*='prettyPhoto']").prettyPhoto({
			animationSpeed: 'slow', /* fast/slow/normal */
			padding: 40, /* padding for each side of the picture */
			opacity: 0.35, /* Value betwee 0 and 1 */
			showTitle: true, /* true/false */
			allowresize: true, /* true/false */
			counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
			theme: 'light_square', /* light_rounded / dark_rounded / light_square / dark_square */
			callback: function(){}
		});
	}
	
	jQuery.preLoadImages("/icon/ajax-loader.gif");
	
	$('#forgot_trigger').toggle(function() {
		$('#forgot').show();
		$('#login-form').hide();
		return false;
	},
	function() {
		$('#forgot').hide();
		$('#login').show();
		return false;
	});
	
	$('#login_trigger').toggle(function() {
		$('#forgot').hide();
		$('#login-form').show();
		return false;
	},
	function() {
		$('#forgot').show();
		$('#login-form').hide();
		return false;
	});
});
