//even though loading the style sheet is an option in the function, you also need to include a <link> tag
//with the external style sheet in the template for standards broswers

function loadTemplate(url,styleURL,callback)
{
	$('#page').css('display','none');
	var cont = $('#pgcontent').html();
	callback = callback || function() {};
	
	try
	{
		document.createStyleSheet(styleURL);
	}
	catch(e)
	{
		$('head').append('<link id="pagestyle" href="'+styleURL+'" type="text/css" rel="stylesheet"/>');
	}
	
	$('#page').load("layout.html", "", function()
	{
		document.title = $('#title').text();
		fSrc = $('#fhead').text();
		
		$('#pgcontent').css('display','none');
		$('#content').html(cont);
		$('#page').css('display','block');
		callback();
		writeFlashHead(fSrc);

	});
}

function writeFlashHead(fSrc)
{
	$('#fhead').html('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '+
						 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.'+
						 'cab#version=6,0,29,0" width="753" height="224">'+
            			'<param name="movie" value="'+fSrc+'">'+
            			'<param name="quality" value="high">'+
           				'<embed src="'+fSrc+'" quality="high" pluginspage="http://www.macromedia.com/go'+
						'/getflashplayer" type="application/x-shockwave-flash" width="753" height="224"></embed>'+
	     				'</object>');
}