function hide_all() {
		$('#sales-pro-popup').removeClass('active');
		$('#sales-pro-popup').addClass("inactive");

		$('#nav-dd-about-wrapper').removeClass('show');
		$('#nav-dd-about-wrapper').addClass('hide');

		$('#nav-dd-cap-wrapper').removeClass('show');
		$('#nav-dd-cap-wrapper').addClass('hide');
}

// handler for closing all dropdowns and popups on page level clicking
$(function() {
	$('html').click(function() {
		hide_all();
	});

	$('#main-wrapper').mouseover(function() {
		hide_all();
	});

	// handlers for opening and closing sales pro popup
  $('#sales-pro-popup').addClass("inactive");

  $('#sales-pro-copy').mouseover(function() {
		hide_all();
		$('#sales-pro-popup').removeClass('inactive');
		$('#sales-pro-popup').addClass('active');
  });

  $('#close-link').click(function() {
		$('#sales-pro-popup').removeClass('active');
		$('#sales-pro-popup').addClass("inactive");
  });

  // handler for lightbox functionlity
  $(function() {
	$('a.lightbox[@rel=lightbox]').lightBox(); // Select all links with lightbox class
  });

	// handler for enabling tabs functionality
	$(function() {
		$("#tabs").tabs(
		);
	});

	// add category show/hide handler
	$('#admin-new-cat-wrapper').addClass("hide");
	$('#cat-show-hide-link').addClass('expand');

  $('#cat-show-hide-link').click(function() {
		if($('#admin-new-cat-wrapper').hasClass("show")) {
			$('#admin-new-cat-wrapper').removeClass("show");
			$('#admin-new-cat-wrapper').addClass("hide");
			$('#cat-show-hide-link').removeClass('collapse');
			$('#cat-show-hide-link').addClass('expand');
		} else {
			$('#admin-new-cat-wrapper').removeClass("hide");
			$('#admin-new-cat-wrapper').addClass("show");
			$('#cat-show-hide-link').removeClass('expand');
			$('#cat-show-hide-link').addClass('collapse');
		}
  });

	// add product show/hide handler
	$('#admin-new-prod-wrapper').addClass("hide");
	$('#prod-show-hide-link').addClass('expand');

	$('#prod-show-hide-link').click(function() {
		if($('#admin-new-prod-wrapper').hasClass("show")) {
			$('#admin-new-prod-wrapper').removeClass("show");
			$('#admin-new-prod-wrapper').addClass("hide");			
			$('#prod-show-hide-link').removeClass('collapse');
			$('#prod-show-hide-link').addClass('expand');
		} else {
			$('#admin-new-prod-wrapper').removeClass("hide");
			$('#admin-new-prod-wrapper').addClass("show");
			$('#prod-show-hide-link').removeClass('expand');
			$('#prod-show-hide-link').addClass('collapse');
		}
	});

	// add bio show/hide handler
	$('#admin-new-bio-wrapper').addClass("hide");
	$('#bio-show-hide-link').addClass('expand');

	$('#bio-show-hide-link').click(function() {
		if($('#admin-new-bio-wrapper').hasClass("show")) {
			$('#admin-new-bio-wrapper').removeClass("show");
			$('#admin-new-bio-wrapper').addClass("hide");
			$('#bio-show-hide-link').removeClass('collapse');
			$('#bio-show-hide-link').addClass('expand');
		} else {
			$('#admin-new-bio-wrapper').removeClass("hide");
			$('#admin-new-bio-wrapper').addClass("show");
			$('#bio-show-hide-link').removeClass('expand');
			$('#bio-show-hide-link').addClass('collapse');
		}
	});


	// add news show/hide handler
	$('#admin-new-news-wrapper').addClass("hide");
	$('#news-show-hide-link').addClass('expand');

	$('#news-show-hide-link').click(function() {
		if($('#admin-new-news-wrapper').hasClass("show")) {
			$('#admin-new-news-wrapper').removeClass("show");
			$('#admin-new-news-wrapper').addClass("hide");
			$('#news-show-hide-link').removeClass('collapse');
			$('#news-show-hide-link').addClass('expand');
		} else {
			$('#admin-new-news-wrapper').removeClass("hide");
			$('#admin-new-news-wrapper').addClass("show");
			$('#news-show-hide-link').removeClass('expand');
			$('#news-show-hide-link').addClass('collapse');
		}
	});

	// handle cancel button event for new category add form
	$('#newCatCancel').click(function() {
		$('#admin-new-cat-wrapper').removeClass("show");
		$('#admin-new-cat-wrapper').addClass("hide");
		$('#cat-show-hide-link').removeClass('collapse');
		$('#cat-show-hide-link').addClass('expand');
		top.location='/admin.php#tabs-1';
	});

	// handle cancel button event for new product add form
	$('#newProdCancel').click(function() {
		$('#admin-new-prod-wrapper').removeClass("show");
		$('#admin-new-prod-wrapper').addClass("hide");			
		$('#prod-show-hide-link').removeClass('collapse');
		$('#prod-show-hide-link').addClass('expand');
		top.location='/admin.php#tabs-2';
	});

	// handle cancel button event for new bio add form
	$('#newBioCancel').click(function() {
		$('#admin-new-bio-wrapper').removeClass("show");
		$('#admin-new-bio-wrapper').addClass("hide");
		$('#bio-show-hide-link').removeClass('collapse');
		$('#bio-show-hide-link').addClass('expand');
		top.location='/admin.php#tabs-3';
	});

	// handle cancel button event for new bio add form
	$('#editBioCancel').click(function() {
		$('#admin-new-bio-wrapper').removeClass("show");
		$('#admin-new-bio-wrapper').addClass("hide");
		$('#bio-show-hide-link').removeClass('collapse');
		$('#bio-show-hide-link').addClass('expand');
		top.location='/admin.php#tabs-3';
	});

	// handle cancel button event for new news add form
	$('#newNewsCancel').click(function() {
		$('#admin-new-news-wrapper').removeClass("show");
		$('#admin-new-news-wrapper').addClass("hide");
		$('#news-show-hide-link').removeClass('collapse');
		$('#news-show-hide-link').addClass('expand');
		top.location='/admin.php#tabs-4';
	});

	// handle cancel button event for edit news add form
	$('#editNewsCancel').click(function() {
		$('#admin-new-news-wrapper').removeClass("show");
		$('#admin-new-news-wrapper').addClass("hide");
		$('#news-show-hide-link').removeClass('collapse');
		$('#news-show-hide-link').addClass('expand');
		top.location='/admin.php#tabs-4';
	});

	// delete category dialog handler
	$('#delete-cat-confirm').addClass("hide");
	
	$('a.delete-category').click(function() {
		var id = $(this).attr('id');

		$( "#delete-cat-confirm" ).dialog({
			resizable: false,
			height:225,
			width:350,
			modal: true,
			buttons: {
				"Delete": function() {
					$( this ).dialog( "close" );
					top.location='admin.php?item=category&action=delete&id=' + id;
				},
				Cancel: function() {
					$( this ).dialog( "close" );
					top.location='admin.php#tabs-1';
				}
			}
		});
	});

	// delete product dialog handler
	$('#prod-delete-confirm').addClass("hide");
	
	$('a.delete-product').click(function() {
		var id     = $(this).attr('id');	// get product id assigned to respective anchor tag's id attribute
		var cat_id = $(this).attr('name');	// get category id assigned to respective anchor tag's name attribute

		$( "#prod-delete-confirm" ).dialog({
			resizable: false,
			height:185,
			width:350,
			modal: true,
			buttons: {
				"Delete": function() {
					$( this ).dialog( "close" );
					top.location='admin.php?item=product&action=delete&cat_id=' + cat_id + '&id=' + id + '#tabs-2';
				},
				Cancel: function() {
					$( this ).dialog( "close" );
					top.location='admin.php#tabs-2';
				}
			}
		});
	});

	// delete bio dialog handler
	$('#bio-delete-confirm').addClass("hide");
	
	$('a.delete-bio').click(function() {
		var id     = $(this).attr('id');	// get product id assigned to respective anchor tag's id attribute
		var cat_id = $(this).attr('name');	// get category id assigned to respective anchor tag's name attribute

		$( "#bio-delete-confirm" ).dialog({
			resizable: false,
			height:185,
			width:350,
			modal: true,
			buttons: {
				"Delete": function() {
					$( this ).dialog( "close" );
					top.location='admin.php?item=bio&action=delete&id=' + id + '#tabs-3';
				},
				Cancel: function() {
					$( this ).dialog( "close" );
					top.location='admin.php#tabs-3';
				}
			}
		});
	});

	// delete news dialog handler
	$('#news-delete-confirm').addClass("hide");
	
	$('a.delete-news').click(function() {
		var id     = $(this).attr('id');	// get product id assigned to respective anchor tag's id attribute
		var cat_id = $(this).attr('name');	// get category id assigned to respective anchor tag's name attribute

		$( "#news-delete-confirm" ).dialog({
			resizable: false,
			height:205,
			width:350,
			modal: true,
			buttons: {
				"Delete": function() {
					$( this ).dialog( "close" );
					top.location='admin.php?item=news&action=delete&id=' + id + '#tabs-4';
				},
				Cancel: function() {
					$( this ).dialog( "close" );
					top.location='admin.php#tabs-4';
				}
			}
		});
	});

	// delete attachment dialog handler
	$('#attachment-delete-confirm').addClass("hide");
	
	$('a.delete-attachment').click(function() {
		var id = $(this).attr('id');	// get product id assigned to respective anchor tag's id attribute

		$("#attachment-delete-confirm").dialog({
			resizable: false,
			height:185,
			width:350,
			modal: true,
			buttons: {
				"Delete": function() {
					$(this).dialog("close");
					top.location='admin.php?item=attachment&action=delete&id=' + id + '#tabs-4';
				},
				Cancel: function() {
					$(this).dialog("close");
					top.location='admin.php#tabs-4';
				}
			}
		});
	});

	// handlers for show/hide of capabilities dropdown menus
	$('#nav-dd-cap-wrapper').addClass('hide');
	
	$('#li-cap').mouseover(function() {
		hide_all();
		$('#nav-dd-cap-wrapper').removeClass('hide');
		$('#nav-dd-cap-wrapper').addClass('show');
		$('#nav-dd-about-wrapper').removeClass('show');
		$('#nav-dd-about-wrapper').addClass('hide');
	});

	$('#nav-dd-cap-wrapper').mouseover(function() {
		$('#nav-dd-cap-wrapper').removeClass('hide');
		$('#nav-dd-cap-wrapper').addClass('show');
	});

	$('#nav-dd-cap-wrapper').mouseout(function() {
		$('#nav-dd-cap-wrapper').removeClass('show');
		$('#nav-dd-cap-wrapper').addClass('hide');
	});

	// handlers for show/hide of about us dropdown menus
	$('#nav-dd-about-wrapper').addClass('hide');
	
	$('#li-about').mouseover(function() {
		hide_all();
		$('#nav-dd-about-wrapper').removeClass('hide');
		$('#nav-dd-about-wrapper').addClass('show');
		$('#nav-dd-cap-wrapper').removeClass('show');
		$('#nav-dd-cap-wrapper').addClass('hide');
	});

	$('#nav-dd-about-wrapper').mouseover(function() {
		$('#nav-dd-about-wrapper').removeClass('hide');
		$('#nav-dd-about-wrapper').addClass('show');
	});

	$('#nav-dd-about-wrapper').mouseout(function() {
		$('#nav-dd-about-wrapper').removeClass('show');
		$('#nav-dd-about-wrapper').addClass('hide');
	});

	$('#li-exp').mouseover(function() {
		hide_all();
	});

	$('#li-cntct').mouseover(function() {
		hide_all();
	});

});

