/* - - - - - - - - - - - - - - - - - - - - -
	Title : Default Javascript File
	Author : Paul Rooney (paul@sugarshaker.com)
	Created : October, 2007
	Modified : October, 2007
- - - - - - - - - - - - - - - - - - - - - */

/* site wide stuff */

Event.observe(window, 'load', function() {
									   
	// iterate every classname									   
	//document.getElementsByClassName('xxxxx').each( function(el){} ); 								   
									   
									   
} ); //end onload function


//Sound Stuff

soundManager.url = 'soundmanager2.swf'; // override default SWF url
soundManager.debugMode = false;
soundManager.consoleOnly = false;

soundManager.onload = function() {
  // soundManager is initialised, ready to use. Create a sound for this demo page.
  soundManager.createSound('fart','fart.mp3');
  soundManager.createSound('chime','chime.mp3');
}


function displayAnswer(index){ 
	switch (index) {
		case 1: {
			name = "Hugh Arse";correct = "TRUE"; win = false;
			copy = "Hugh Arse was born in 1701 at Saint Mary Steps, Exeter, Devon. Arse was rare but not unknown as a surname in the 18th century, when a whole family of Arses lived in Milton Bryan, Bedfordshire.";
		} break;	
		case 2: {
			name = "Golden Balls";correct = "TRUE"; win = false;
			copy = "Golden Balls was born in Aylsham, Norfolk, in 1813. He gave his son, born in 1836, the same name.";	
		} break;	
		case 3: {
			name = "Bridget Dogging";correct = "TRUE"; win = false;
			copy = "Bridget Dogging was born in Ireland in about 1869 and appears in the 1891 census of Barony, Lanarkshire. The origin of the British slang term ‘dogging’ – engaging in sex in public places – has not been established, but one school of thought claims it derives from the response of men caught in search of such activities, “I was just walking the dog…”";	
		} break;
		case 4: {
			name = "Donald Duck";correct = "TRUE"; win = false;
			copy = "Donald Duck, the brother of Rhoda Duck, was born in Edmonton, Middlesex, in 1899.";	
		} break;
		case 5: {
			name = "Shepherdess Jane Backhoffner";correct = "TRUE"; win = false;
			copy = "Shepherdess Jane Backhoffner, the daughter of George H. Backhoffner, Professor of Chemistry and Natural Philosophy and Registrar of Births & Deaths, was born in St Marylebone, London, in 1845.";	
		} break;
		case 6: {
			name = "Jane Trafalgar Grapes";correct = "TRUE"; win = false;
			copy = "Jane Trafalgar Grapes, born in Newport, Isle of Wight, in 1805, was one of the children of John and Hannah Grapes, all of whom were all given middle names that related to the Napoleonic Wars, including William Nile Grapes (1815), Charlotte Waterloo Grapes (1815) and Charles Wellington Grapes (1811).";	
		} break;
		case 7: {
			name = "Dick Head";correct = "TRUE"; win = false;
			copy = "A Dick Head – one of many with this unfortunate name – was born in Wandsworth, London, in 1890.";	
		} break;	
		case 8: {
			name = "Jemima Badgersucker";correct = "FALSE</h2><h2>Well done, you have correctly identified the fake name!"; win = true;
			copy = "It is common in reference books to insert fictitious entries, either as a joke or to track copyright infringement. They are sometimes known as Mountweazels, after an invented entry that appeared in the 1975 edition of the New Columbia Encyclopedia that claimed that Lillian Virginia Mountweazel (1942–73) was a US fountain designer and photographer, best known for her collection of photos of rural American mailboxes, <em>Flags Up!</em> She was said to have been born in Bangs, Ohio, and died in an explosion while on an assignment for <em>Combustibles</em> magazine.";	
		} break;	
		case 9: {
			name = "Emma Hooters";correct = "TRUE"; win = false;
			copy = "Emma Hooters was born in London in about 1839 and appears in the 1851 census working as a twelve-year-old nurse in the Baker Street home of bookseller and printer John G. Griffin. ";	
		} break;	
		case 10: {
			name = "Euphemia Twat";correct = "TRUE"; win = false;
			copy = "Euphemia Twat was baptized at Walls, Shetland, in 1800. There were forty-eight Twats in Orkney and Shetland recorded in the 1841 census. In the same year, in his poem <em>Pippa Passes</em>, Robert Browning included the line 'Cowls and twats', later explaining to the editor of the <em>Oxford English Dictionary</em> that he thought a ‘twat’ was a kind of hood worn by nuns – but he was mistaken…";	
		} break;
	}
	$('olCont').update('<h1>'+name+'</h1><h2>'+correct+'</h2><p>'+copy+'</p>');
	showBox();
	if(win){soundManager.play('chime');}else{soundManager.play('fart');}
}


function showBox(){
    $('overlay').show();
    center('box');
    return false;
}

function hideBox(){
    $('box').hide();
    $('overlay').hide();
    return false;
}

function center(element){
    try{
        element = $(element);
    }catch(e){
        return;
    }

    var my_width  = 0;
    var my_height = 0;

    if ( typeof( window.innerWidth ) == 'number' ){
        my_width  = window.innerWidth;
        my_height = window.innerHeight;
    }else if ( document.documentElement && 
             ( document.documentElement.clientWidth ||
               document.documentElement.clientHeight ) ){
        my_width  = document.documentElement.clientWidth;
        my_height = document.documentElement.clientHeight;
    }
    else if ( document.body && 
            ( document.body.clientWidth || document.body.clientHeight ) ){
        my_width  = document.body.clientWidth;
        my_height = document.body.clientHeight;
    }

    element.style.position = 'absolute';
    element.style.zIndex   = 99;

    var scrollY = 0;

    if ( document.documentElement && document.documentElement.scrollTop ){
        scrollY = document.documentElement.scrollTop;
    }else if ( document.body && document.body.scrollTop ){
        scrollY = document.body.scrollTop;
    }else if ( window.pageYOffset ){
        scrollY = window.pageYOffset;
    }else if ( window.scrollY ){
        scrollY = window.scrollY;
    }

    var elementDimensions = Element.getDimensions(element);

    var setX = ( my_width  - elementDimensions.width  ) / 2;
    var setY = ( my_height - elementDimensions.height ) / 2 + scrollY;

    setX = ( setX < 0 ) ? 0 : setX;
    setY = ( setY < 0 ) ? 0 : setY;

    element.style.left = setX + "px";
    element.style.top  = setY + "px";

    element.style.display  = 'block';
}


