// JavaScript Document

function addTag(frmName, elmntNme, tagType)
{
	// This function is an almagamation of a bunch of previous functions which all did the same thing,
	// add a set of specific html tags to a text field.
	
	text = document.forms[frmName].elements[elmntNme].value ;
	
	switch(tagType){
		
	        case 'p': {text = text + '\r\n<p>Replace this text with the text you want.</p>';
					  break;}
	   case 'strong': {text = text + '\r\n<strong>Replace this text with the text you want.</strong>';
					  break;}
	     case 'list':{text = text + '\r\n<ul>\r\n\t<li>Item 1</li>\r\n\t<li>Item 2</li>\r\n</ul>';
	                  break; }
	    case 'break':{text = text + '\r\n<br />';
	                  break;}
	    
				
	}
	// Write out to the form field
    document.forms[frmName].elements[elmntNme].value=text ;
}

function checkPadding(){
    
    // Because the image bar is a float, it 'hangs' over the page and has
    // no impact on its size. So it's possibly for the image bar to be longer than the main page
    // content and consequently it will overhang the main page and look daft. This function checks
    // whether the image bar is longer than the content and if it is, adjusts the padding in the
	// appropriate element to compensate.
	
	//Don't seem to need to do this if it's IE. Don't ask me why.
	
	browser = navigator.userAgent;
	if(browser.indexOf("MSIE")== -1){
    
			if(getHeight("pagetext") < getHeight("imgbar")){
				
					theDiff = getHeight("imgbar") - getHeight("pagetext"); 
					elmnt = document.getElementById("pagetext");
					elmnt.style.paddingBottom = theDiff + "px";
		
			}
		}		
			
}

function getHeight(element){
    // Return the height of the specified element in pixels.
    
    elmnt = document.getElementById(element);
    h = elmnt.clientHeight;
    return h;

}
