// Prepares all the general stuff on the page, javascript and html
// Make the YUI more accessible
var YDom = YAHOO.util.Dom;

function PreparePage() {
	// Prepare the boxes
	PrepareBoxes();
}

function PrepareBoxes() {
	// Boxes have a bunch of DIV elements that make up they're
	// body, to make my life simpler when I read the code, 
	// This function draws all the "aesthetic divs".
	
	var boxTypes = new Array('box_a', 'box_b');
	for(var key in boxTypes) { 
		var boxes = YDom.getElementsByClassName(boxTypes[key], 'div');
		for(var key in boxes) { 
			// Put the content in the content div :
			boxes[key].innerHTML = 
				'<div class="content">'+boxes[key].innerHTML+'</div>';
				
			// Add the basic aesthetics :
			boxes[key].innerHTML = 
				'<div class="tl blok_sprt"></div>'+
				'<div class="tm"></div>'+
				'<div class="tr blok_sprt"></div>'+
				'<div class="l"></div>'+
				'<div class="r"></div>'+
				'<div class="bl blok_sprt"></div>'+
				'<div class="br blok_sprt"></div>'+
				boxes[key].innerHTML;
	
			// Check if this box has shadows and add the divs 
			// if that is the case :
			if ( !YDom.hasClass(boxes[key], 'no_shadow') ) {
				boxes[key].innerHTML = 
					'<div class="tr_shdw blok_sprt"></div>'+
					'<div class="r_shdw yrep_sprt"></div>'+
					'<div class="br_shdw blok_sprt"></div>'+
					'<div class="b_shdw xrep_sprt"></div>'+
					'<div class="bl_shdw blok_sprt"></div>'+
					boxes[key].innerHTML
			}
			
			boxes[key].innerHTML += '<div class="bm"></div>';
			boxes[key].style.display = 'block';
		}
	}
	
	if (postOnLoadCode) {
		postOnLoadCode();
	}
}