/* Author: Ronningen Design.
** Copyright 2009
**/

function returnObjById( id )
{
    if (document.getElementById)
        var returnVar = document.getElementById(id);
    else if (document.all)
        var returnVar = document.all[id];
    else if (document.layers)
        var returnVar = document.layers[id];
    return returnVar;
}

function insertInsetSlideshow(postID) {
	

	if ( jQuery("#smallInsetSSP").length ) {
		
		/*
		if ( jQuery("#smallInsetSSP").parent().get(0).tagName ) {
			var firstParent = jQuery("#smallInsetSSP").parent();
			var secondParent = firstParent.parent();
			alert (secondParent.parent().get(0).tagName); 
			
			// Remove the parent: 
			var cnt = $(".remove-just-this").contents()
			$(".remove-just-this").replaceWith(cnt); 
		} */
		
		var albumOrSingle = jQuery("#smallInsetSSP").attr("class").split(' '); // Grab the album ID from a class applied to the div. 
		
		var albumID = albumOrSingle[0];
		var isSingle = albumOrSingle[1]; 
		
		if (isSingle == "true")
			var slideshowType = "smallSingleInsetSSP.swf"; 
		else
			var slideshowType = "smallInsetSSP.swf"; 

		var flashvars = {
			xmlfile: "http://www.deerkilldaycamp.com/ssp_director/images.php?album=" + albumID
		};
		var params = {
			menu: "false",
			salign: "LEFT",
			wmode: "transparent"
		};

		swfobject.embedSWF("/swf/" + slideshowType, "smallInsetSSP", "260", "140", "9","/swf/expressInstall.swf", flashvars, params);
	}
	
	if ( jQuery("#largeInsetSSP").length ) {
		var albumOrSingle = jQuery("#largeInsetSSP").attr("class").split(' '); // Grab the album ID from a class applied to the div. 
		
		var albumID = albumOrSingle[0];
		var isSingle = albumOrSingle[1]; 
		
		if (isSingle == "true")
			var slideshowType = "largeSingleInsetSSP.swf"; 
		else
			var slideshowType = "largeInsetSSP.swf"; 
		
		var flashvarsL = {
			xmlfile: "http://www.deerkilldaycamp.com/ssp_director/images.php?album=" + albumID
		};
		var paramsL = {
			menu: "false",
			salign: "LEFT",
			wmode: "transparent"
		};

		swfobject.embedSWF("/swf/" + slideshowType, "largeInsetSSP", "260", "260", "9","/swf/expressInstall.swf", flashvarsL, paramsL);
	}

}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}


/* Examples of how to use this function: In the markup insert the following style markup: 

<div class="small neg100InsetRight"><div id="smallInsetSSP">This is a small slideshow. </div></div>

Then call insertInsetSlideshow with the post ID and ensure that the post ID is associated in the array with a large or a small album. 

*/

