$(document).ready(function() {
	
	/* TIDY FOOTER COLUMNS */

	var footerColumnHeight = 0;

	$('#structure-footer .column').each(function() {
		if($(this).height() > footerColumnHeight) {
			footerColumnHeight = $(this).height();
		}
	});

	$('#structure-footer .column').css('height', footerColumnHeight);

    /* TIDY CONTENT COLUMNS

    var contentColumnHeight = 0;

    $('#structure-content .brickcourse').each(function() {
        if($(this).height() > contentColumnHeight) {
            contentColumnHeight = $(this).height();
        }
    });

    $('#structure-content .brickcourse').css('height', contentColumnHeight);*/


	/* ADD DECOR DIVS TO STRUCTURE */

	var DOM_structureLinks = $('#structure-links');
	DOM_structureLinks.wrap(document.createElement('div'));
	DOM_structureLinks.parent('div').attr('class', 'decor-outer decor-links');

	var DOM_structureHeader = $('#structure-header');
	DOM_structureHeader.wrap(document.createElement('div'));
	DOM_structureHeader.parent('div').attr('class', 'decor-outer decor-header');

	var DOM_structureFooter = $('#structure-footer');
	DOM_structureFooter.wrap(document.createElement('div'));
	DOM_structureFooter.parent('div').attr('class', 'decor-outer decor-footer');

	var DOM_structureCopyright = $('#structure-copyright');
	DOM_structureCopyright.wrap(document.createElement('div'));
	DOM_structureCopyright.parent('div').attr('class', 'decor-outer decor-copyright');

	/* TABLE HIGHLIGHTS & FUNCTIONALITY */

	if ($('table.table').length > 0) {

		$('table.table tbody tr').each( function() {
			$(this).hover(
				function() {
					$(this).addClass('over');
				},
				function() {
					$(this).removeClass('over');
				}
			);
			var rowURL = $(this).find('a:first').attr('href');
			$(this).click( function() {
				location.href = rowURL;
			});
		});

	}

	$('.brick').each( function() {
        $(this).click( function() {
                var url = $(this).find("a").attr('href');
                window.location = url;
        });
    });

});

function testScript()
{
alert('hi');
}

function showHideElement(id)
{
	var elem = document.getElementById(id);

	if (elem.style.display == 'none')
	{
		elem.style.display = '';
	}
	else
	{
		elem.style.display = 'none';
	}
	return false;
}

function answersDisplay(itemname)
{

   tmp = document.getElementsByTagName('div');
	for (i=0;i<tmp.length;i++)
	{
 		if (tmp[i].className == itemname) tmp[i].style.display = (tmp[i].style.display == 'none' || tmp[i].style.display == '') ? 'block' : 'none';
	}

}

// This writes the date in format: 8th October 2001
function getTodaysDate()
{
	dtmToday = new Date();
	intDay = dtmToday.getDate();
	intMonth = dtmToday.getMonth() + 1;
	intYear = dtmToday.getYear();

	strS = "th";
	if (intDay == 1 || intDay == 21 || intDay == 31) {strS = "st";}
	if (intDay == 2 || intDay == 22) {strS = "nd";}
	if (intDay == 3 || intDay == 23) {strS = "rd";}

	strM = "";
	if (intMonth == 1) {strM = "January"};
	if (intMonth == 2) {strM = "February"};
	if (intMonth == 3) {strM = "March"};
	if (intMonth == 4) {strM = "April"};
	if (intMonth == 5) {strM = "May"};
	if (intMonth == 6) {strM = "June"};
	if (intMonth == 7) {strM = "July"};
	if (intMonth == 8) {strM = "August"};
	if (intMonth == 9) {strM = "September"};
	if (intMonth == 10) {strM = "October"};
	if (intMonth == 11) {strM = "November"};
	if (intMonth == 12) {strM = "December"};

	if (intYear <= 1900) {intYear += 1900;}

	document.write(intDay + strS + ' ' + strM + ' ' + intYear);
}

 function doClear(theText)
{
     if (theText.value == theText.defaultValue)
 {
         theText.value = ""
     }
 }

function genericWindowOpener(url, name, width, height, scrollbars, toolbar) {
	genericWindow = window.open(url,name,'width=' + width + ',height=' + height + ',toolbar=' + toolbar + ',scrollbars=' + scrollbars + ',resizable=yes');
	genericWindow.focus();
}

function submitForm(formName,action) {
	if (navigator.appName == "Netscape") {
		document.write('<a href="javascript:document.forms.' + formName + '.submit()" class="submitButton">' + action + '</a>')
	} else {
		document.write('<a href="javascript:' + formName + '.submit()" class="submitButton">' + action + '</a>')
	}
}


function makeLink()
{
if(document.all)
window.external.AddFavorite('http://www.experiencelanguage.co.uk','Experience Language')
}





