var onLoadFunctions = new Array();
var iloadFunction = 0;


// Pass each function that needs to load
function addOnLoad(func) {
    onLoadFunctions[iloadFunction] = func;
    iloadFunction++;
}
// Loops through all of the functions that were added
function loadAllFunctions() {
    for(i=0; i < onLoadFunctions.length; i++) {
        eval(onLoadFunctions[i]+"()");
    }
}

/* ====================================================================================================== LOAD FLASH FILES */
function loadFlash() {
	if (document.getElementById('flash-home') != null) {

        var flashvars = { };
        var params = { wmode: "transparent" };
        var attributes = {};

		swfobject.embedSWF("lib/swf/RobinOrvis.swf", "flash-home", "960", "570", "9.0.0", "lib/swf/expressInstall.swf", flashvars, params, attributes);
		if (document.getElementById('flash-home-alt') != null) {
			//document.getElementById('flash-home-alt').style.visibility = "visible";
			window.location = "noflash.php";
			
		}
	}
}

function shareSite(pSocialSite) {
	var result = null;
	var urlToAdd = "http://www.robinorvis.com";
	var urlPageTitle = "Robin Orvis Photography";
	switch(pSocialSite) {
		case "mc_facebookThumb": result = 'http://www.facebook.com/sharer.php?u=' + encodeURIComponent(urlToAdd) + '&t=' + encodeURIComponent(urlPageTitle); break;
		case "mc_myspaceThumb": result = 'http://www.myspace.com/Modules/PostTo/Pages/?u=' + encodeURIComponent(urlToAdd) + 't=' + encodeURIComponent(urlPageTitle); break;
		case "mc_twitterThumb": result = 'http://twitter.com/home?status=' + encodeURIComponent(urlPageTitle) + ' ' +  encodeURIComponent(urlToAdd); break;
		default:
			break;
	}
	if (result) {
		window.open (result,"socialWindow","location=0,status=0,scrollbars=0,width=650,height=550"); 	
	}
	
	
}

function swapImage(pImage) {
	document.getElementById("mainphoto").src = "/seniors/lib/img/galleries/" + pImage + ".jpg";	
}

// Load all of the functions that you've set
window.onload = loadAllFunctions;

/* CALL EACH FUNCTION TO LOAD */
addOnLoad("loadFlash");
