﻿function setIFrameSource(frameId, url)
{
	var el = document.getElementById(frameId);
	el.src = url;
}

function hideIFrame(frameId)
{
	var el = document.getElementById(frameId);
	el.style.display = "none";
}

function showIFrame(srcDoc, frameId)
{
	var el = document.getElementById(frameId);
	el.src = srcDoc;
}

function resizeIframe(iframeID) { 
	if (document.getElementById)
	{
		if(self==parent) return false; /* Checks that page is in iframe. */ 

	  var theFrameEl = parent.document.getElementById(iframeID);
		if (theFrameEl.contentDocument && theFrameEl.contentDocument.body.offsetHeight)
		{ //ns6, FireFox syntax
			parent.document.getElementById(iframeID).height = document.body.offsetHeight+30; 
		}
		else if (theFrameEl.Document && theFrameEl.Document.body.scrollHeight) //ie5+ syntax
			parent.document.getElementById(iframeID).style.height = document.body.scrollHeight+30;
	}
} 

function checkForParent() {
	if (document.getElementById)
	{
	
		if(parent == self) { /* Checks that page is in iframe. */ 
			//get the src
			var 	host = window.location.host;	
			var 	pathname = window.location.pathname;	
			pathname = 	pathname.substr(pathname.indexOf("/",1)+1);
			var here = window.location.href;
			here = here.substr(0,here.indexOf(pathname))+"index.htm#"+pathname;
			window.location.href = here;
			return false;
		}
		else		{
			return true;
		}
	}
}

function checkUrl() 
{
	var hash = window.location.hash;	
	if (hash.length > 1)
	{
		hash = hash.substr(1);
		showIFrame(hash,"contentFull");
	}
}

function nav(where)
{
	var here = window.location.href;
	var 	pathname = window.location.pathname;	
	pathname = 	pathname.substr(pathname.indexOf("/",1)+1);
	here = here.substr(0,here.indexOf(pathname))+"index.htm#"+where;
	window.location.href = here;
	showIFrame(where,"contentFull");
}

function startUp()
{
}


function swapClass(obj, new_style)
{
  obj.cName =  obj.className
  obj.className = new_style;
}

function revertClass(obj)
{
	if (obj.cName)
	  obj.className = obj.cName;
}

