function ScrollToElement(elementID){

	var theElement = document.getElementById(elementID);

	var selectedPosX = 0;
	var selectedPosY = 0;
              
	while(theElement != null){
		selectedPosX += theElement.offsetLeft;
		selectedPosY += theElement.offsetTop;
		theElement = theElement.offsetParent;
	}
                        		      
	window.scrollTo(selectedPosX,selectedPosY);

}

/*
 * BEGIN SCRIPTLETS CODE EXCERPT FROM http://www.bytemycode.com/snippets/snippet/595/ 20081215
 */
 
//  Scriptlets code written by Jeremy Edmiston
//  The functions have been adapted from various sources
//  and re-written to provide maximum flexibility
//  and compatability with various browsers.

//Global Declarations
var ie = (document.all) ? true : false;

function hideClass(objClass,anchorClass){
//  This function will hide Elements by object Class
//  Works with IE and Mozilla based browsers

	var elements = (ie) ? document.all : document.getElementsByTagName('*');
	for (i=0; i<elements.length; i++){
		if (elements[i].className==objClass){
			elements[i].style.display="none";
		}
	}
	var linkText = "show";
	changeFoldingAnchorsLinkText(anchorClass,linkText);
}

function showClass(objClass,anchorClass){
//  This function will show Elements by object Class
//  Works with IE and Mozilla based browsers
	var elements = (ie) ? document.all : document.getElementsByTagName('*');
	for (i=0; i<elements.length; i++){
		if (elements[i].className==objClass){
			elements[i].style.display="block";
		}
	}
	var linkText = "hide";
	changeFoldingAnchorsLinkText(anchorClass,linkText);
}

function getElementByClass(objClass){
//  This function is similar to 'getElementByID' since there
//  is no inherent function to get an element by its class
//  Works with IE and Mozilla based browsers
	var elements = (ie) ? document.all : document.getElementsByTagName('*');
	for (i=0; i<elements.length; i++){
	//alert(elements[i].className)
	//alert(objClass)
		if (elements[i].className==objClass){
			return elements[i];
		}
	}
}

/*
 * END SCRIPTLETS CODE EXCERPT FROM http://www.bytemycode.com/snippets/snippet/595/ 20081215
 */

function toggleClass(objClass,anchorClass){
//  This function is a modification of code taken from the
//	Scriplets Code by Jeremy Edmiston available at
//	http://www.bytemycode.com/snippets/snippet/595/ as of 20081215

//	Modified by Johnnie Wilcox aka mistersquid
//	http://blog.mistersquid.com 

	var elements = (ie) ? document.all : document.getElementsByTagName('*');
	for (i=0; i<elements.length; i++){
		if (elements[i].className==objClass){
			if (elements[i].style.display == "none") {
				elements[i].style.display = "block";
			} else {
				elements[i].style.display = "none";
			}
		}
	}
	toggleFoldingAnchorsLinkText(anchorClass);
}

function toggleFoldingAnchorsLinkText(objClass){
//  This function is a modification of code taken from the
//	Scriplets Code by Jeremy Edmiston available at
//	http://www.bytemycode.com/snippets/snippet/595/ as of 20081215

//	Modified by Johnnie Wilcox aka mistersquid
//	http://blog.mistersquid.com 

var elements = (ie) ? document.all : document.getElementsByTagName('a');
	for (i=0; i<elements.length; i++){
		if (elements[i].className==objClass){
			if (elements[i].innerHTML == "show") {
				elements[i].innerHTML = "hide";
			} else
		/*		a.href = 'http://mistersquid.com/'; */
				elements[i].innerHTML = "show";
		}
	}
}

function changeFoldingAnchorsLinkText(objClass,linkText){
var elements = (ie) ? document.all : document.getElementsByTagName('a');
	for (i=0; i<elements.length; i++){
		if (elements[i].className==objClass){
			elements[i].innerHTML = linkText;
		}
	}
}

function dynamicLoader(iframeID,URL,anchorID,divID,direction,customInnerHTML){
	var newURL ="javascript:foldSection('" + anchorID + "','" + divID + "','" + direction + "','" + customInnerHTML + "');"; 

/*	var newURL ="http://metonym.net.dev/"; */
/*	var linkText="";
	var newTarget=""; */

	var targetDiv = document.getElementById(divID);
	targetDiv.className= "folding"; 
	document.getElementById(anchorID).className="foldingAnchor";

	var el = document.getElementById(divID);
	if(el.style.display == 'none') {
		el.style.display = 'block';
	} else {
		el.style.display = 'none';
	}
	
	toggleAnchor(anchorID,divID,direction);

	loadintoIframe(iframeID,URL,anchorID,divID);
/*	document.getElementById(anchorID).href="http://blog.mistersquid.com"; */
	document.getElementById(anchorID).href=newURL;

}

function foldSection(anchor,objname,direction,customInnerHTML) {
	toggleAnchor(anchor,objname,direction,customInnerHTML); 
	toggleVisibility(objname,direction);
}

function toggleAnchor(anchor,objname,direction,customInnerHTML) {
	if(moving[objname])
			return;

	var a = document.getElementById(anchor);

	if (direction=='vertical') {
		if ((a.innerHTML == "show")||(a.innerHTML == "load")) {
			a.innerHTML = "hide";
		} else {
			// a.href = 'http://mistersquid.com/';
			a.innerHTML = "show";
		}
	} else {
	
		if (spanToggled[objname]) {
			a.innerHTML = customInnerHTML+"&#187;";
			spanToggled[objname]=false;
		} else {
			a.innerHTML = customInnerHTML+"&#171;";
			spanToggled[objname]=true;
		}	
	}
}


/*
 * START FLOATING DIVS
 * <div id="floatdiv"> will scroll with page
 * Script by: www.jtricks.com
 * Version: 20071017
 * Latest version:
 * www.jtricks.com/javascript/navigation/floating.html
 */
var floatingMenuId = 'floatdiv';
var floatingMenu =
{
    targetX: -250,
    targetY: 10,

    hasInner: typeof(window.innerWidth) == 'number',
    hasElement: typeof(document.documentElement) == 'object'
        && typeof(document.documentElement.clientWidth) == 'number',

    menu:
        document.getElementById
        ? document.getElementById(floatingMenuId)
        : document.all
          ? document.all[floatingMenuId]
          : document.layers[floatingMenuId]
};

floatingMenu.move = function ()
{
    floatingMenu.menu.style.left = floatingMenu.nextX + 'px';
    floatingMenu.menu.style.top = floatingMenu.nextY + 'px';
}

floatingMenu.computeShifts = function ()
{
    var de = document.documentElement;

    floatingMenu.shiftX =  
        floatingMenu.hasInner  
        ? pageXOffset  
        : floatingMenu.hasElement  
          ? de.scrollLeft  
          : document.body.scrollLeft;  
    if (floatingMenu.targetX < 0)
    {
        floatingMenu.shiftX +=
            floatingMenu.hasElement
            ? de.clientWidth
            : document.body.clientWidth;
    }

    floatingMenu.shiftY = 
        floatingMenu.hasInner
        ? pageYOffset
        : floatingMenu.hasElement
          ? de.scrollTop
          : document.body.scrollTop;
    if (floatingMenu.targetY < 0)
    {
        if (floatingMenu.hasElement && floatingMenu.hasInner)
        {
            // Handle Opera 8 problems
            floatingMenu.shiftY +=
                de.clientHeight > window.innerHeight
                ? window.innerHeight
                : de.clientHeight
        }
        else
        {
            floatingMenu.shiftY +=
                floatingMenu.hasElement
                ? de.clientHeight
                : document.body.clientHeight;
        }
    }
}

floatingMenu.calculateCornerX = function()
{
    if (floatingMenu.targetX != 'center')
        return floatingMenu.shiftX + floatingMenu.targetX;

    var width = parseInt(floatingMenu.menu.offsetWidth);

    var cornerX =
        floatingMenu.hasElement
        ? (floatingMenu.hasInner
           ? pageXOffset
           : document.documentElement.scrollLeft) + 
          (document.documentElement.clientWidth - width)/2
        : document.body.scrollLeft + 
          (document.body.clientWidth - width)/2;
    return cornerX;
};

floatingMenu.calculateCornerY = function()
{
    if (floatingMenu.targetY != 'center')
        return floatingMenu.shiftY + floatingMenu.targetY;

    var height = parseInt(floatingMenu.menu.offsetHeight);

    // Handle Opera 8 problems
    var clientHeight = 
        floatingMenu.hasElement && floatingMenu.hasInner
        && document.documentElement.clientHeight 
            > window.innerHeight
        ? window.innerHeight
        : document.documentElement.clientHeight

    var cornerY =
        floatingMenu.hasElement
        ? (floatingMenu.hasInner  
           ? pageYOffset
           : document.documentElement.scrollTop) + 
          (clientHeight - height)/2
        : document.body.scrollTop + 
          (document.body.clientHeight - height)/2;
    return cornerY;
};

floatingMenu.doFloat = function()
{
    var stepX, stepY;

    floatingMenu.computeShifts();

    var cornerX = floatingMenu.calculateCornerX();

    var stepX = (cornerX - floatingMenu.nextX) * .07;
    if (Math.abs(stepX) < .5)
    {
        stepX = cornerX - floatingMenu.nextX;
    }

    var cornerY = floatingMenu.calculateCornerY();

    var stepY = (cornerY - floatingMenu.nextY) * .07;
    if (Math.abs(stepY) < .5)
    {
        stepY = cornerY - floatingMenu.nextY;
    }

    if (Math.abs(stepX) > 0 ||
        Math.abs(stepY) > 0)
    {
        floatingMenu.nextX += stepX;
        floatingMenu.nextY += stepY;
        floatingMenu.move();
    }

    setTimeout('floatingMenu.doFloat()', 20);
};

// addEvent designed by Aaron Moore
floatingMenu.addEvent = function(element, listener, handler)
{
    if(typeof element[listener] != 'function' || 
       typeof element[listener + '_num'] == 'undefined')
    {
        element[listener + '_num'] = 0;
        if (typeof element[listener] == 'function')
        {
            element[listener + 0] = element[listener];
            element[listener + '_num']++;
        }
        element[listener] = function(e)
        {
            var r = true;
            e = (e) ? e : window.event;
            for(var i = element[listener + '_num'] -1; i >= 0; i--)
            {
                if(element[listener + i](e) == false)
                    r = false;
            }
            return r;
        }
    }

    //if handler is not already stored, assign it
    for(var i = 0; i < element[listener + '_num']; i++)
        if(element[listener + i] == handler)
            return;
    element[listener + element[listener + '_num']] = handler;
    element[listener + '_num']++;
};

floatingMenu.init = function()
{
    floatingMenu.initSecondary();
    floatingMenu.doFloat();
};

// Some browsers init scrollbars only after
// full document load.
floatingMenu.initSecondary = function()
{
    floatingMenu.computeShifts();
    floatingMenu.nextX = floatingMenu.calculateCornerX();
    floatingMenu.nextY = floatingMenu.calculateCornerY();
    floatingMenu.move();
}

if (document.layers)
    floatingMenu.addEvent(window, 'onload', floatingMenu.init);
else
{
    floatingMenu.init();
    floatingMenu.addEvent(window, 'onload',
        floatingMenu.initSecondary);
}

/*
 * END FLOATING DIVS
 */

/***********************************************
* IFrame SSI script II-  Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/


function resizeCaller() {
	
	var iframeids = new Array();
	var iframes = document.getElementsByTagName('iframe');
	for (i=0; i<iframes.length; i++){
		iframeids[i]=iframes[i].id; 
	}


	for (i=0; i<iframeids.length; i++){
		if (document.getElementById);
		resizeIframe(iframeids[i]);
	//reveal iframe for lower end browsers? (see var above):
		if ((document.all || document.getElementById) && iframehide=="no"){
			var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i]);
			tempobj.style.display="block";
		}
	}
}

function resizeIframe(frameid){
	var currentfr=document.getElementById(frameid);
	if (currentfr && !window.opera){
		currentfr.style.display="block";
		if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) {//ns6 syntax
/*/
			currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight;
/*/
			currentfr.height = currentfr.contentDocument.body.offsetHeight+extraHeight;
		} else {
			if (currentfr.Document && currentfr.Document.body.scrollHeight) { //ie5+ syntax
				currentfr.height = currentfr.Document.body.scrollHeight;
			}
			if (currentfr.addEventListener) {
				currentfr.addEventListener("load", readjustIframe, false);
			} else {
				if (currentfr.attachEvent){
					currentfr.detachEvent("onload", readjustIframe); // Bug fix line
					currentfr.attachEvent("onload", readjustIframe);
				}
			}
		}
	}
}

function readjustIframe(loadevt) {
	var crossevt=(window.event)? event : loadevt;
	var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement;
	if (iframeroot) {
		resizeIframe(iframeroot.id);
	}
}

function loadintoIframe(iframeid,url,anchor,objname){
	if (document.getElementById) {
		document.getElementById(iframeid).src=url;
	}
}