/* ------------------------------------------------------------
 * PROJECT        : 
 * FILENAME       : jqload.js
 * ------------------------------------------------------------
 * LAST UPDATED   : 02 Jan 2010
 * ------------------------------------------------------------
 * AUTHOR(S)      : Kevin Scholl (kevin@ksscholl.com)
 * ------------------------------------------------------------
 * NOTE(S)        : 
 * ------------------------------------------------------------ */

$(document).ready(function(){
 
	// adjust margin(s)
  $(""
		+ "div:last-child,"
		+ "fieldset:last-child,"
		+ "form:last-child,"
		+ "img:last-child,"
		+ "li:last-child,"
		+ "ol:last-child,"
		+ "p:last-child,"
		+ "table:last-child,"
		+ "ul:last-child,"
		+ "").css("margin-bottom","0");
	
	$("div.withBorder").parent().find("div.withBorder:first").css("margin-top","10px");
	$("div.withBorder").parent().find("div.withBorder:last").css("margin-bottom","10px");
	
	// rounded corners
	$(".errorMsg, .systemMsg, .warningMsg").cornerz({background:"#EED", radius:8});
	$("ul.tabBar li a")                    .cornerz({background:"#AADDAA", radius:10, corners:"tl tr"});

  // data grids and tables
  // alternate row coloring and row/column hover highlighting

	// dropdown navigation
	$("ul.tabBar li").hover(
		function () {
			$(this).find(" > ul").slideDown("slow");
			}, 
		function () {
			$(this).find(" > ul").fadeOut("fast");
			}
		);
	// add subnavigation indicator
	$("ul.tabBar li:has(ul)").find("> a")
	  .css("padding-right","16px")
	  .click(function () {
			return false;
			})
	  .append("<span class=\"hasChildren\">&nbsp;</span>");
	// account for current tab status
	// $("ul.tabBar li a.current").parent().find("ul").css("background","#EEE").find("a").css("border-bottom","1px solid #DDD");
	$("ul.tabBar li.current").find("ul").css("background","#EEE").find("a").css("border-bottom","1px solid #DDD");
	$("ul.tabBar li ul li:last-child a").css({
	  "border-bottom"  : "0",
		"padding-bottom" : "6px"
	  });

	// do nothing when clicking disabled tab
	$("ul.tabBar li a.disabled").click(function () {
		return false;
		}).parent("[class*='nav']").append("<span class=\"disabled\">&nbsp;</span>");
	
	// form field focus
 	$("input:file, input:password, input:text, select, textarea").not("[readonly]").toggleActive();

	// position radio buttons and checkboxes
	$("input:radio").addClass("radioBtn");
	$("input:checkbox").addClass("checkBox");
	
	// cover slide show on home page
	$("#homeCovers").cycle({
	  pause : 1,
		speed : 500
		});

  // cover display on magazine page
	$("div.issueDisplay p a")
	  .css("opacity","0.70")
		.mouseover(function(){
      $(this).css("opacity","1.0");
      })
		.mouseout(function(){
      $(this).css("opacity","0.70");
      });
;
	
  // hide search box
   $('#siteSearch, #ccoptin').hide();
   
  // external links
  $('a[href^=http]').not('[href*=' + location.hostname + ']').attr('target', '_blank');
  });
  
  

/* ------------------------------------------------------------
 * PLUGINS
/* ------------------------------------------------------------ *?



/* ------------------------------------------------------------
 * FUNCTIONS
 * ------------------------------------------------------------ */

// reset the form
function frmReset(theForm) {
	jqResetForm(theForm);
	document.forms[theForm].reset();
	}