/*
    ---------------------------
	SHARED JAVASCRIPT FUNCTIONS
	---------------------------
	Kanzo 2009
	---------------------------
*/
window.addEvent('domready', function() {
    /* SWFobject */
	if (swfobject.hasFlashPlayerVersion("8.0.0")) {
    // hide content until Flash ended
        //$('divContent').addClass('hidden');
    }else{
	// Switch backup on if Flash is not installed
		$('divLogo').setProperty('style','visibility:visible!important');
	    $('divNav').setProperty('style','visibility:visible!important');
	}
	var flashvars = {};
	var params = {};
	params.wmode = "transparent";
	var attributes = {};
	swfobject.embedSWF ("/_swf/geoffsenior-header.swf", "divHeaderWrapper", "945", "600", "8.0.0", false, flashvars, params, attributes);
    /* /SWFobject */
	
	$$('img.goodDog','input.goodDog').each(function(img) {
		var src = img.getProperty('src');
		var extension = src.substring(src.lastIndexOf('.'),src.length);
		var preloadImg = new Image(100,25); 
		preloadImg.src = src.replace('off' + extension,'on' + extension);
		img.addEvent('mouseenter', function() { img.setProperty('src',preloadImg.src); });
		img.addEvent('mouseleave', function() { img.setProperty('src',src); });
	});
/*
    Open external links (beginning with 'http://') in a new window
*/
	if ($(document.body).getProperty('class') != 'sectionSearch') {
		$(document.body).getElements('a[href^=http://]').addEvent('click', function(event){
				event.stop();
				window.open (this.href);
		});
	}
/*
    Open specific links in a new window
*/
	$$('.newWindow').each(function(el) {
		el.addEvent('click', function(e) {
			e.stop();
			window.open (el.href);
		});
	});
});

function showContent () {
	// show content
	//$('divContent').removeClass('hidden');
	//$('divContent').setProperty('style','visibility:visible!important');
	$('divContent').style.visibility = 'visible';
}
