//----------------------------------------------------------------
//   File: ./js/layout.js
//
// Author: Terry Cox
//
// Copyright (c) 2011.  All Rights Reserved.
//----------------------------------------------------------------
//////////////////////////////////////////////////////////////////
// Global Variables
//////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////
// function: display_box_dimensions()
//
//////////////////////////////////////////////////////////////////
function display_box_dimensions(sElement) {
	var sMsg;
	
	sMsg  = "Element: "        + sElement                                  + "\n";
	
	sMsg += "         Width: " + (get_width(sElement)).toString()          + "\n";
	
	sMsg += "        Height: " + (get_height(sElement)).toString()         + "\n";
	
	sMsg += " Padding Width: " + (get_padding_width(sElement)).toString()  + "\n";
	
	sMsg += "Padding Height: " + (get_padding_height(sElement)).toString() + "\n";
	
	sMsg += "  Border Width: " + (get_border_width(sElement)).toString()   + "\n";
	
	sMsg += " Border Height: " + (get_border_height(sElement)).toString()  + "\n";
	
	sMsg += "  Margin Width: " + (get_margin_width(sElement)).toString()   + "\n";
	
	sMsg += " Margin Height: " + (get_margin_height(sElement)).toString()  + "\n";
	
	alert(sMsg);
	
	return;

} //// end of display_box_dimensions() ///////////////////////////


//////////////////////////////////////////////////////////////////
// function: get_width()
//
//  purpose: get the border height for the specified element
//////////////////////////////////////////////////////////////////
function get_width(sElement) {
	
	return ($(sElement).width());
	
} //// end of get_width() ////////////////////////////////////////


//////////////////////////////////////////////////////////////////
// function: get_height()
//
//  purpose: get the border height for the specified element
//////////////////////////////////////////////////////////////////
function get_height(sElement) {
	
	return ($(sElement).height());
	
} //// end of get_height() ///////////////////////////////////////

//////////////////////////////////////////////////////////////////
// function: get_border_width()
//
//  purpose: get the border width for the specified element
//////////////////////////////////////////////////////////////////
function get_border_width(sElement) {
	var iLeftWidth, 
		iRightWidth, 
		iTotalWidth;
	
	iLeftWidth   = parseInt($(sElement).css("borderLeftWidth"));
	
	iRightWidth  = parseInt($(sElement).css("borderRightWidth"));
	
	iTotalWidth = iLeftWidth + iRightWidth;
	
	return (iTotalWidth);
	
} //// end of get_border_width() /////////////////////////////////


//////////////////////////////////////////////////////////////////
// function: get_border_height()
//
//  purpose: get the border height for the specified element
//
//     NOTE: I am logically using 'Height', when the actual
//           function in this context uses'Width', illogically.
//////////////////////////////////////////////////////////////////
function get_border_height(sElement) {
	var iTopHeight, 
		iBottomHeight, 
		iTotalHeight;
	
	iTopHeight    = parseInt($(sElement).css("borderTopWidth"));
	
	iBottomHeight = parseInt($(sElement).css("borderBottomWidth"));
	
	iTotalHeight  = iTopHeight + iBottomHeight;
	
	return (iTotalHeight);
	
} //// end of get_border_height() ////////////////////////////////


//////////////////////////////////////////////////////////////////
// function: get_padding_height()
//
//  purpose: get the padding height for the specified element
//////////////////////////////////////////////////////////////////
function get_padding_height(sElement) {
	
	return ($(sElement).innerHeight() - $(sElement).height());
	
} //// end of get_padding_height() ///////////////////////////////


//////////////////////////////////////////////////////////////////
// function: get_margin_height()
//
//  purpose: get the margin height for the specified element
//////////////////////////////////////////////////////////////////
function get_margin_height(sElement) {
	
	return ($(sElement).outerHeight(true) - $(sElement).outerHeight(false));
	
} //// end of get_margin_height() ////////////////////////////////



//////////////////////////////////////////////////////////////////
// function: get_padding_width()
//
//  purpose: get the padding width for the specified element
//////////////////////////////////////////////////////////////////
function get_padding_width(sElement) {
	
	return ($(sElement).innerWidth() - $(sElement).width());
	
} //// end of get_padding_width() ////////////////////////////////


//////////////////////////////////////////////////////////////////
// function: get_margin_width()
//
//  purpose: get the margin width for the specified element
//////////////////////////////////////////////////////////////////
function get_margin_width(sElement) {
	
	return ($(sElement).outerWidth(true) - $(sElement).outerWidth(false));
	
} //// end of get_margin_width() ////////////////////////////////



