

function customThumb(photoName,self,pageID) {
	document.getElementById('imgEditModule_'+photoName).innerHTML='</form><h6 style="color: #000000;">Update thumb for this group</h6><p>Thumbnail images should be 72x72 pixels</p><form action="'+self+'" method="post" enctype="multipart/form-data"><input type="file" name="updated_thumb" /><input type="hidden" name="pageID" value="'+pageID+'" /><input type="hidden" name="updated_thumb_name" value="'+photoName+'" /><div style="margin: 6px 0;"><input type="submit" value="Submit new thumb" style="width: 200px;" class="submitBtn" /></div></form><div style="height: 50px;"></div><form>';
}

var siblingLayerCount=1;
var childrenLayerCount=1;
function showPagLyr(n,version) {
	var lyrCount=1;
	var lyrName="siblings_layer_";
	var listType="siblings_list";
	if(version==0) {
		lyrCount=siblingLayerCount;
	} else {
		lyrCount=childrenLayerCount;
		lyrName="children_layer_";
		listType="children_list";
	}
	lyrName=lyrName+n;
	var layerContent=document.getElementById(lyrName).innerHTML;
	document.getElementById(listType).innerHTML=layerContent;
}

function setLayerCount(n,version) {
	if(version==0) {
		siblingLayerCount=n;
	} else {
		childrenLayerCount=n;
	}
}

function setRightColumnHeight(rightColHeight) {
	var rightColDiv=document.getElementById("rightColText");
	var sidebarDiv=document.getElementById("sidebar1");
	var tst2 = getXYpos(rightColDiv);
	var rightTextY=tst2.y;
	tst2 = getXYpos(sidebarDiv);
	sidebarOffset=tst2.y;
	var revisedRightTextY=rightTextY=parseInt(rightTextY)-parseInt(sidebarOffset);
	var newRightTextHeight=parseInt(rightColHeight)-parseInt(revisedRightTextY);
	rightColDiv.style.height=newRightTextHeight+"px";
	/* document.getElementById("testOutput").innerHTML="rightColHeight: "+rightColHeight+"; oldTextRightY: "+rightTextY+"px; revisedTextRightY: "+revisedRightTextY+"px; NewRightTextHeight: "+newRightTextHeight+"; sidebarOffset: "+sidebarOffset; */
}





//  Global JS variable to hold obj of ElementID for item we are fading
var DIVElementById = "";
var ReducingFinished = false;
var ElementOpacityLevel = 0;
var OpacityLevelIncrement = 10;    //  Percentage value: 1-100
var FadeDelayMS = 60;             //  Milliseconds

//  Function determines whether we show or hide the item referenced by ElementID
function fader(ElementID, ActionToTake)
{
  DIVElementById = document.getElementById(ElementID);
  if (ActionToTake == "hide")
  {
    ElementOpacityLevel = 100;
    reduceOpacity();
  }
  else if (ActionToTake == "show")
  {  increaseOpacity();  }
}
//  Makes element more visible
function increaseOpacity()
{
  //  Check to make sure the DIVElementById is already set as visibility=visible
  if (DIVElementById.style.visibility != "visible")
  {  DIVElementById.style.visibility = "visible";  }
  
  //  If opacity level is less than 100, we can still increase the opacity
  if ((ElementOpacityLevel < 100) && (ReducingFinished == true))
  {
    ReducingFinished = true;
    ElementOpacityLevel += OpacityLevelIncrement;
    DIVElementById.style.MozOpacity = ""+(ElementOpacityLevel/100);
    DIVElementById.style.opacity = ""+(ElementOpacityLevel/100);
    DIVElementById.style.filter = 'alpha(opacity='+ElementOpacityLevel+')';
	if (document.all) {
		DIVElementById.style.filters.alpha.opacity=ElementOpacityLevel;
	}
    setTimeout("increaseOpacity()", FadeDelayMS);
  }
  else
  {
    ReducingFinished = false;
  }
}
//  Makes element less visible 
function reduceOpacity()
{
  //  If opacity level is greater than 0, we can still reduce the opacity
  if ((ElementOpacityLevel > 0) && (ReducingFinished == false))
  {
    ReducingFinished = false;
    ElementOpacityLevel -= OpacityLevelIncrement;
    DIVElementById.style.MozOpacity = ""+(ElementOpacityLevel/100);
    DIVElementById.style.opacity = ""+(ElementOpacityLevel/100);
	// DIVElementById.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity='+ElementOpacityLevel+')';
	if (document.all) {
		DIVElementById.filters[0].opacity=ElementOpacityLevel;
	} else {
		DIVElementById.style.filter = 'alpha(opacity='+ElementOpacityLevel+')';
	}
    setTimeout("reduceOpacity()", FadeDelayMS);
  }
  else
  {
    ReducingFinished = true;

    //  When finished, make sure the DIVElementById is set to visibility=hidden
    if (DIVElementById.style.visibility != "hidden")
    {  DIVElementById.style.visibility = "hidden";  }
  }
}


function SetOpacity(elem, opacityAsInt)
{
	var opacityAsDecimal = opacityAsInt;
	
	if (opacityAsInt > 100)
		opacityAsInt = opacityAsDecimal = 100; 
	else if (opacityAsInt < 0)
		opacityAsInt = opacityAsDecimal = 0; 
	
	opacityAsDecimal /= 100;
	if (opacityAsInt < 1)
		opacityAsInt = 1; // IE7 bug, text smoothing cuts out if 0
	
	elem.style.opacity = opacityAsDecimal;
	elem.style.filter  = "alpha(opacity=" + opacityAsInt + ")";
}

function FadeOpacity(elemId, fromOpacity, toOpacity, time, fps)
{
	var steps = Math.ceil(fps * (time / 1000));
	var delta = (toOpacity - fromOpacity) / steps;
	
	FadeOpacityStep(elemId, 0, steps, fromOpacity, delta, (time / steps));
}

function FadeOpacityStep(elemId, stepNum, steps, fromOpacity, delta, timePerStep)
{
    SetOpacity(document.getElementById(elemId), Math.round(parseInt(fromOpacity) + (delta * stepNum)));

    if (stepNum < steps)
        setTimeout("FadeOpacityStep('" + elemId + "', " + (stepNum+1) + ", " + steps + ", " + fromOpacity + ", " + delta + ", " + timePerStep + ");", timePerStep);
}

