//*****Replace align attribute with class**************************************************//
function replaceAlign() {
  if (!document.getElementsByTagName('img')) return false;
  $('img[align="left"]').addClass('left').removeAttr('align');
	$('img[align="right"]').addClass('right').removeAttr('align');
	$('img[align="middle"]').addClass('middle').removeAttr('align');
}
//*****Replace target attribute with class**************************************************//
function replaceTarget() {
  if (!document.getElementsByTagName('a')) return false;
  $('a[target]').addClass('newwindow').removeAttr('target');
}
//*****The following function make it possible to have web standard popups**************************************************//
function strictNewWindow() {
  if (!document.getElementsByTagName('a')) return false;
  $('a.newwindow').click(function() {
		window.open($(this).attr('href'));
    return false;
	});
}
//*****Add swfobject flash call**************************************************//
function initializeFlash() {
	if (!document.getElementById('flash-home')) return false;
	var flashvars = {};
	var params = {wmode: 'transparent'};
	var attributes = {};
	attributes.id = "flash";
	swfobject.embedSWF("swf/flash-home.swf", "flash-home", "1004", "238", "8.0.0", "swf/expressInstall.swf", flashvars, params, attributes);
}
//*****Initialize Pretty Photo http://www.no-margin-for-errors.com/projects/prettyPhoto-jquery-lightbox-clone/**************************************************//
function initializePrettyPhoto() {
  $('a[rel^="prettyPhoto"]').prettyPhoto({
	  animationSpeed: 'normal', /* fast/slow/normal */
		padding: 40, /* padding for each side of the picture */
		opacity: 0.35, /* Value betwee 0 and 1 */
		showTitle: true, /* true/false */
		allowresize: true, /* true/false */
		counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
		theme: 'light_rounded', /* light_rounded / dark_rounded / light_square / dark_square */
		callback: function(){}
	});
}
//*****Load all functions**************************************************//
$(document).ready(function(){
  replaceAlign();
  replaceTarget();
  strictNewWindow();
  initializeFlash();
  initializePrettyPhoto();
});
//$(window).resize(function(){
//  extendFooter();
//});
