// ineedaprayer.org javascripts

// ------- establish a global framework object -------

var INPFramework = {};

// ------- establish some basic namespace vars -------

// used by pages attaching the framework to determine if the framework is present
INPFramework.inFramework = true; 

INPFramework.clientWidth = '';
INPFramework.clientHeight = 3000;
INPFramework.browserPath = '';
INPFramework.browserType = '';
INPFramework.browser = '';
INPFramework.version = '';

INPFramework.currentUser = '';
INPFramework.currentSID = '';
INPFramework.currentIP = '';
INPFramework.currentPMessages = '';
INPFramework.readyState = '';
INPFramework.secure = false;
INPFramework.radioState = 'stopped';
INPFramework.radioWarnDisplayed = false;
INPFramework.playerLoaded = false;
INPFramework.playerUpdateTimer = false;
INPFramework.playerDispoTimer = '';
INPFramework.lessonVerses = new Array();

INPFramework.signInBlock = document.getElementById('signInBlock');

// some static html fragments for client side swaps
INPFramework.blockSpinnerAssembly = "<table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"12\" height=\"12\"><img src=\"http://www.ineedaprayer.org/images/fathead_outsidelft.gif\" width=\"12\" height=\"36\"></td><td valign=\"bottom\" background=\"http://www.ineedaprayer.org/images/fathead_topbg.gif\"><div align=\"left\"><table width=\"100%%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td align=\"left\" style=\"padding-top:3px\"><img src=\"http://www.ineedaprayer.org/images/update_lbl.gif\" width=\"143\" height=\"25\"></td></tr></table></div></td><td width=\"12\" height=\"12\"><img src=\"http://www.ineedaprayer.org/images/fathead_toprt.gif\" width=\"12\" height=\"36\"></td></tr><tr><td background=\"http://www.ineedaprayer.org/images/contentinset_midlft.gif\"><img src=\"http://www.ineedaprayer.org/images/contentinset_midlft.gif\" width=\"12\" height=\"7\"></td><td align=\"left\" valign=\"top\" class=\"bodyText\" style=\"padding-left:8px; padding-top:7px\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td height=\"102\" align=\"center\" valign=\"middle\"><table width=\"32\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td><img src=\"http://www.ineedaprayer.org/images/ajax-loader.gif\" alt=\"\" width=\"32\" height=\"32\" /></td></tr></table></td></tr></table></td><td background=\"http://www.ineedaprayer.org/images/contentinset_midrt.gif\"><img src=\"http://www.ineedaprayer.org/images/contentinset_midrt.gif\" width=\"12\" height=\"7\"></td></tr><tr><td><img src=\"http://www.ineedaprayer.org/images/contentinset_btmlft.gif\" width=\"12\" height=\"12\"></td><td background=\"http://www.ineedaprayer.org/images/contentinset_btmbg.gif\"><div align=\"center\"><img src=\"http://www.ineedaprayer.org/images/contentinset_btmbg.gif\" width=\"7\" height=\"12\"></div></td><td><img src=\"http://www.ineedaprayer.org/images/contentinset_btmrt.gif\" width=\"12\" height=\"12\"></td></tr></table>";

INPFramework.signedOutBlock = "<table width=\"100%%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"12\" height=\"12\"><img src=\"http://www.ineedaprayer.org/images/fathead_outsidelft.gif\" width=\"12\" height=\"36\" /></td><td valign=\"bottom\" background=\"http://www.ineedaprayer.org/images/fathead_topbg.gif\"><div align=\"left\"><table width=\"100%%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td align=\"left\" style=\"padding-top:3px\"><img src=\"http://www.ineedaprayer.org/images/signIn_lbl.gif\" width=\"145\" height=\"25\" /></td></tr></table></div></td><td width=\"12\" height=\"12\"><img src=\"http://www.ineedaprayer.org/images/fathead_toprt.gif\" width=\"12\" height=\"36\" /></td></tr><tr><td background=\"http://www.ineedaprayer.org/images/contentinset_midlft.gif\"><img src=\"http://www.ineedaprayer.org/images/contentinset_midlft.gif\" width=\"12\" height=\"7\" /></td><td align=\"left\" valign=\"top\" class=\"bodyText\" style=\"padding-left:8px; padding-top:7px\"><table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr> <td><form action=\"http://www.ineedaprayer.org/phpbb/login.php\" method=\"post\" name=\"loginform\" id=\"loginform\" style=\"margin-bottom:0;\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td align=\"left\" nowrap=\"nowrap\" class=\"bodyText\">User ID</td><td width=\"9\"><img src=\"http://www.ineedaprayer.org/images/spacer9.gif\" width=\"7\" height=\"7\" /></td><td width=\"120\"><input name=\"username\" type=\"text\" class=\"ineedaprayerFields\" id=\"username\" style=\"width:142px; height:16px\" /></td><td width=\"120\">&nbsp;</td></tr><tr><td align=\"left\" nowrap=\"nowrap\" class=\"bodyText\" style=\"padding-top:3px\">Password</td><td>&nbsp;</td><td style=\"padding-top:3px\"><input name=\"password\" type=\"password\" class=\"ineedaprayerFields\" id=\"password\" style=\"width:142px; height:16px\" /></td><td>&nbsp;</td></tr></table><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"100%\" align=\"right\" style=\"padding-top:7px\"><img src=\"http://www.ineedaprayer.org/images/signin_btn.jpg\" name=\"sibtn\" width=\"72\" height=\"25\" id=\"sibtn\" onmouseover=\"MM_swapImage('sibtn','','http://www.ineedaprayer.org/images/signin_btnmoused.jpg',1)\" onmouseout=\"MM_swapImgRestore()\" onclick=\"document.getElementById('login').click()\"; style=\"cursor:pointer\" /><input name=\"login\" id=\"login\" type=\"submit\" value=\"login\" style=\"visibility:visible; height:1px; position:absolute; top:-100px; left:-100px;\" /></td><td align=\"right\">&nbsp;</td></tr></table></form></td></tr></table></td><td background=\"http://www.ineedaprayer.org/images/contentinset_midrt.gif\"><img src=\"http://www.ineedaprayer.org/images/contentinset_midrt.gif\" width=\"12\" height=\"7\" /></td></tr><tr><td><img src=\"http://www.ineedaprayer.org/images/contentinset_btmlft.gif\" width=\"12\" height=\"12\" /></td><td background=\"http://www.ineedaprayer.org/images/contentinset_btmbg.gif\"><div align=\"center\"><img src=\"http://www.ineedaprayer.org/images/contentinset_btmbg.gif\" width=\"7\" height=\"12\" /></div></td><td><img src=\"http://www.ineedaprayer.org/images/contentinset_btmrt.gif\" width=\"12\" height=\"12\" /></td></tr></table>";

INPFramework.bigSpinnerPart1 = "<div style=\"position:relative; width:100%\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td id=\"INPSpinnerCell\" height=\"";
INPFramework.bigSpinnerPart2 = "\" align=\"center\" valign=\"middle\"><div class=\"inPlaceSpinner_bg\" style=\"height:53px; width:53px\"><table width=\"53\" height=\"53\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td align=\"center\" valign=\"middle\"><img src=\"../images/loading_anim.gif\" width=\"32\" height=\"32\" /></td></tr></table></div></td></tr></table></div>";

// ------- framework functions -------

INPFramework.setSID = function(theSID, theUser) {
	// set the current SID and the current user values when a login occurs
	
	try {
		// first, figure out the user name
		var theUnameComponents = theUser.split("[ ");
		var theUnameComponents2 = theUnameComponents[1];
		var theUnameComponents3 = theUnameComponents2.split(" ]");
		INPFramework.currentUser = theUnameComponents3[0];
	
		// now determine the SID
		var theSIDComponents = theSID.split("sid=");
		INPFramework.currentSID = theSIDComponents[1];
		
		INPFramework.secure = true;
		
		// get IP location data
		INPFramework.updateLocationData();
		
	} catch(err) {
		// if we wind up here, it means we could not parse the UID or SID, which
		// means we are NOT logged in
		
		INPFramework.secure = false;
		INPFramework.currentUser = '';
		INPFramework.currentSID = '';
		
	}
	
}

INPFramework.setHeaderLogElement = function(theMode) {
	// set the log element of the header based on security state
	// http://www.ineedaprayer.org/phpbb/login.php?logout=true&sid=29eb53c1dfad2c97ffb5677e58a9293d
	var theURL = "http://www.ineedaprayer.org/phpbb/login.php?logout=true&sid=" + INPFramework.currentSID;
	
	if (theMode == 'in') {
		document.getElementById('a1t').innerHTML = 'Log out';
		document.getElementById('a1tAction').onclick = function() { INPFramework.navigateToPage(theURL); };
	} else {
		document.getElementById('a1t').innerHTML = 'Sign in';
		document.getElementById('a1tAction').onclick = function() { INPFramework.navigateToPage('phpbb/login.php'); };
	}
}

INPFramework.randomNumber = function() {
	// creae a random number to be used in accessors so as to prevent IE
	// from caching them.

	var theNumber = Math.floor(Math.random()*700000000);
	return theNumber;

}

INPFramework.getAsynchContent = function(theContentSource, theTarget, showSpinner) {
	// ajax some content asynchronously, and return that content to a target
	// container after return

	// inject a loading indicator into the target object
	if (showSpinner != false) {
		INPFramework.injectSpinner(theTarget);
	}
	
	// set up a request object.  We have to do this so it degrades gracefully for IE6
	if (window.XMLHttpRequest) {
		// this is IE7, safari, etc.
		var xmlhttp =  new XMLHttpRequest();

	} else {
		// this is probably IE6, so see if we can instantiate an activeX obejct
		if (window.ActiveXObject) {
     		var xmlhttp = new ActiveXObject('MSXML2.XMLHTTP.3.0');

  		}
	}
	
	// wire up the callBack handler
	xmlhttp.onreadystatechange = function() {  
  		if(xmlhttp.readyState == 4)  
		var theReturn = xmlhttp.responseText;
		if(theReturn != null) {
			theTarget.innerHTML = theReturn;
		}
	};  

    // send the ajax request after the desired data
	xmlhttp.open('GET', theContentSource, true);
	xmlhttp.send(null);
}

INPFramework.getWinContentAsynch = function(theContentSource, theTarget, showSpinner) {
	// ajax some content asynchronously, and return that content to a target
	// container after return

	// inject a loading indicator into the target object
	if (showSpinner != false) {
		INPFramework.injectWinSpinner(theTarget);
	}
	
	// set up a request object.  We have to do this so it degrades gracefully for IE6
	if (window.XMLHttpRequest) {
		// this is IE7, safari, etc.
		var xmlhttp =  new XMLHttpRequest();

	} else {
		// this is probably IE6, so see if we can instantiate an activeX obejct
		if (window.ActiveXObject) {
     		var xmlhttp = new ActiveXObject('MSXML2.XMLHTTP.3.0');

  		}
	}
	
	// wire up the callBack handler
	xmlhttp.onreadystatechange = function() {  
  		if(xmlhttp.readyState == 4)  
		var theReturn = xmlhttp.responseText;
		if(theReturn != null) {
			document.getElementById(theTarget).innerHTML = theReturn;
		}
	};  

    // send the ajax request after the desired data
	xmlhttp.open('GET', theContentSource, true);
	xmlhttp.send(null);
}

INPFramework.blindGetData = function(theContentSource) {
	// ajax some data asynchronously, and return that data without eval
	
	// first, set up a request object.  We have to do this so it degrades gracefully for IE6
	if (window.XMLHttpRequest) {
		// this is IE7, safari, etc.
		var xmlhttp =  new XMLHttpRequest();

	} else {
		// this is probably IE6, so see if we can instantiate an activeX obejct
		if (window.ActiveXObject) {
     		try { var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.6.0") } catch(e) {}
  			try { var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.3.0") } catch(e) {}
  			try { var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP") } catch(e) {}
  			try { var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP") } catch(e) {}

  		}
	}
	
	// wire up the callBack handler
	xmlhttp.onreadystatechange = function() {  
  		if(xmlhttp.readyState == 4) {   
			var theReturn = xmlhttp.responseText;
			
		}
	};  

    // send the ajax request after the desired data
	xmlhttp.open('GET', theContentSource, true);
	xmlhttp.send(null);
}

INPFramework.getData = function(theContentSource) {
	// ajax some data asynchronously, and return that data for evaluation

	// first, set up a request object.  We have to do this so it degrades gracefully for IE6
	if (window.XMLHttpRequest) {
		// this is IE7, safari, etc.
		var xmlhttp =  new XMLHttpRequest();

	} else {
		// this is probably IE6, so see if we can instantiate an activeX obejct
		if (window.ActiveXObject) {
     		try { var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.6.0") } catch(e) {}
			try { var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.3.0") } catch(e) {}
			try { var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP") } catch(e) {}
			try { var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP") } catch(e) {}
		
			// var xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');

  		}
	}
	
	// wire up the callBack handler
	xmlhttp.onreadystatechange = function() {  
  		if(xmlhttp.readyState == 4) {   
			var theReturn = xmlhttp.responseText;
			// alert(theReturn);

			eval(theReturn);
			// eval(theReturn);	
		}
	}

    // send the ajax request after the desired data
	xmlhttp.open('GET', theContentSource, true);
	xmlhttp.send(null);
}

INPFramework.injectSpinner = function(theTarget) {
	// inject a spinner into an object that has been set to receive 
	// some content through an asynchronous ajax call.

	// first determine the height and width of the object being
	// replaced so as to determine what spinner to use
	var theHeight = theTarget.offsetHeight;
	var theWidth = theTarget.offsetWidth;

	// determine what spinner to use - small or large
	if (theHeight > 53 || theWidth > 53) {
		// inject the big spinner
		var theSpinner = INPFramework.blockSpinnerAssembly;
		theTarget.innerHTML = theSpinner;

	} else {
		// inject the small spinner
		var theSpinner = INPFramework.blockSpinnerAssembly;
		theTarget.innerHTML = theSpinner;
	}
	
}

INPFramework.injectWinSpinner = function(theTarget) {
	// inject a spinner into an object that has been set to receive 
	// some content through an asynchronous ajax call.
	
	if(theTarget) {
		// first determine the height and width of the object being
		// replaced so as to determine what spinner to use
		var theHeight = theTarget.offsetHeight;
		var theWidth = theTarget.offsetWidth;
	
		// determine what spinner to use - small or large
		if (theHeight > 53 || theWidth > 53) {
			// inject the big spinner
			var theSpinner = INPFramework.bigSpinnerPart1 + theHeight + INPFramework.bigSpinnerPart2;
			theTarget.innerHTML = theSpinner;
	
		} else {
			// inject the small spinner
			var theSpinner = INPFramework.bigSpinnerPart1 + theHeight + INPFramework.bigSpinnerPart2;
			theTarget.innerHTML = theSpinner;
		}
	}
	
}

INPFramework.setLogout = function() {
	// set the security and user tracking vars to logged out states
	INPFramework.secure = false;
	INPFramework.currentUser = '';
	INPFramework.currentSID = '';
		
}

INPFramework.getClientHeight = function() {
	// determine the height of the client window
	
	return document.documentElement.clientHeight;
}
	
INPFramework.getClientWidth = function() {
	// determine the width of the client window
	
	return document.documentElement.offsetWidth;
}

INPFramework.setBasicClientData = function() {
	// get and retain basic information about the client
	
	// if this is IE, we immediately set the height of the iframe.
	// first, get the height
	try {
		INPFramework.clientHeight = INPFramework.getClientHeight();
	} catch(err) {

	}

	// now get the width
	INPFramework.clientWidth = INPFramework.getClientWidth();

	// determine the browser variant for routing
	if (window.attachEvent) {
		// the browser is IE
		INPFramework.browserType = 'IE';
	
	} else {
		// the browser is not IE
		INPFramework.browserType = 'other';	
	}
	
	// activate the spinner
	// INPFramework.showSpinner();

}

INPFramework.setElementHeights = function() {
	// set the heights of certain page elements upon a precipitating event
	
	var theHeight = INPFramework.getClientHeight;

	// set the main content pane
	try {
		document.getElementById('INPFrameworkMainContent').style.height = INPFramework.clientHeight + 'px';
	} catch(err) {
	}
	
	// set the mask height
	document.getElementById('INPMask').style.display = "block";
	document.getElementById('INPMask').style.height = INPFramework.clientHeight + "px";
	
	// hide it, but not if the mask is visible
	if (document.getElementById('INPMask').style.visibility != 'visible') {
		document.getElementById('INPMask').style.display = "none";
	}
	
	// also adjust the toolbar width so that it does not interfere with the scrollbar
	document.getElementById('INPToolBar').style.width = (INPFramework.clientWidth - 20) +'px';
	
	// manually position the top bar
	document.getElementById('INPToolbarTable').style.width = (INPFramework.clientWidth - 20) +'px';
	
	// set the position of the site control
	var halfWidth = Math.floor(INPFramework.clientWidth / 2);
	document.getElementById('inpSiteMoreControl').style.left = halfWidth - 20 - 43 + 'px';
	
	// show the control
	document.getElementById('inpSiteMoreControl').style.visibility = 'visible';
	
	// manually position the sites panel
	var pWidth = INPFramework.clientWidth;
	var eOffsetWidth = document.getElementById('inpSiteSelectorPanel').offsetWidth;
	var eWidth = pWidth - eOffsetWidth;
	var hOffsetWidth = Math.floor(eWidth / 2);
	document.getElementById('inpSiteSelectorPanelLeft').style.width = hOffsetWidth - 16 + 'px';
	
	// manually position the player window
	INPFramework.setPlayerPosition();
	
}

INPFramework.setPlayerPosition = function() {
	// set the player left position
	var theReferenceLeft = document.getElementById('INPToolbarBody').offsetLeft;
	var theDesiredLeft = theReferenceLeft + 160;
	document.getElementById('INPPlayerWindow').style.left = theDesiredLeft + 'px';
	document.getElementById('INPPlayerWindowBody').style.left = theDesiredLeft + 'px';
}

INPFramework.showMask = function() {
	// show the mask by fading it in
	document.getElementById('INPMask').style.display = "block";
	INPFramework.setOpacity(0, 'INPMask');
	document.getElementById('INPMask').style.visibility = 'visible';
	
	// now fade the logo in
	// INPFramework.fadeIn('INPMask', 0, 61, 430);
	$('#INPMask').fadeTo('normal', 0.52);
	
}

INPFramework.hideMask = function() {
	// hide the mask
	
	document.getElementById('INPMask').style.visibility = 'hidden';
	document.getElementById('INPMask').style.display = "none";

}

INPFramework.showMainBody = function() {
	// show the main body after it has been sized.
	
	document.getElementById('INPFrameworkMainContent').style.visibility = 'visible';
}

INPFramework.sizeMain = function() {
	// size main content area to window size
	INPFramework.clientWidth = INPFramework.getClientWidth();
	INPFramework.clientHeight = INPFramework.getClientHeight();
	
	// alert("h=" + INPFramework.clientHeight + ", w=" + INPFramework.clientWidth);
	document.getElementById('INPFrameworkMainContent').style.height = INPFramework.clientHeight + 'px';
	
	// also adjust the toolbar width so that it does not interfere with the scrollbar
	document.getElementById('INPToolBar').style.width = (INPFramework.clientWidth - 20) +'px';
	
	// manually position the top bar
	document.getElementById('INPToolbarTable').style.width = (INPFramework.clientWidth - 20) +'px';
}

INPFramework.showPseudoWindow = function(theTop, theLeft, theHeight, theWidth, theContent, winTitle, iMode, buttonMode) {
	// show the inp pseudo window at a location and size desired, with content specified
	
	// first set all components displayed but not visible
	document.getElementById('INPContentWindow').style.display = 'block';
	document.getElementById('INPContentWindowOverlay').style.display = 'block';
	document.getElementById('INPContentWindowClose').style.display = 'block';
	document.getElementById('INPContentWindowBody').style.display = 'block';
	
	if (buttonMode != 'none') {
		document.getElementById('INPContentWindowButtonBar').style.display = 'block';
		
	} else {
		document.getElementById('INPContentWindowButtonBar').style.display = 'none';
		
	}
	
	document.getElementById('INPContentWindowTitle').style.display = 'block';
	
	// now set the width
	document.getElementById('INPContentWindow').style.width = theWidth + 'px';
	
	// now set the height
	document.getElementById('INPContentWindowHeight').style.height = (theHeight - 60) + 'px';
	
	// we now have a basis of figuring out the origin for the window.  If a top and left is specified, we know
	// immediately.  Otherwise, we determine the center of the display rectangle and make the origin
	// that minus 1/2 window height or width.
	
	var screenMidLeft = (Math.floor(INPFramework.clientWidth / 2));
	var screenMidTop = (Math.floor(INPFramework.clientHeight / 2));
	
	if (theTop == '') {
		// no height, so center it
		var temp = theHeight / 2;
		var halfWinHeight = Math.floor(temp);
		document.getElementById('INPContentWindow').style.top = (screenMidTop - halfWinHeight) + 'px';
		
	} else {
		document.getElementById('INPContentWindow').style.top = theTop + 'px';
		
	}
	
	if (theLeft == '') {
		// no width, so center it
		var temp = theWidth / 2;
		var halfWinWidth = Math.floor(temp);
		document.getElementById('INPContentWindow').style.left = (screenMidLeft - halfWinWidth) + 'px';
		
	} else {
		document.getElementById('INPContentWindow').style.left = theLeft + 'px';
		
	}
	
	var theTop = document.getElementById('INPContentWindow').offsetTop;
	var theLeft = document.getElementById('INPContentWindow').offsetLeft;
	var overlayHeight = Math.floor(theHeight / 2.5);
	
	// set the top and left positions of the remaining parts
	
	//firt the window overlay image
	document.getElementById('INPContentWindowOverlay').style.top = (theTop + 7) + 'px';
	document.getElementById('INPContentWindowOverlay').style.left = (theLeft + 7) + 'px';
	document.getElementById('INPContentWindowOverlay').style.width = (theWidth - 14) + 'px';
	document.getElementById('INPContentWindowOverlay').style.height = overlayHeight + 'px';
	document.getElementById('INPContentWindowOverlayObject').style.width = (theWidth - 14) + 'px';
	document.getElementById('INPContentWindowOverlayObject').style.height = overlayHeight + 'px';
	
	// now the title block
	document.getElementById('INPContentWindowTitle').style.left = (theLeft + 14) + 'px';
	document.getElementById('INPContentWindowTitle').style.top = (theTop + 14) + 'px';
	document.getElementById('INPContentWindowTitle').style.width = (theWidth - 43) + 'px';
	
	// now the close button
	document.getElementById('INPContentWindowClose').style.top = (theTop + 14) + 'px';
	document.getElementById('INPContentWindowClose').style.left = (theLeft + theWidth - 34) + 'px';
	
	
	// now the content body
	document.getElementById('INPContentWindowBody').style.top = (theTop + 41) + 'px';
	document.getElementById('INPContentWindowBody').style.left = (theLeft + 14) + 'px';
	document.getElementById('INPContentWindowBody').style.width = (theWidth - 14 - 16) + 'px';
	document.getElementById('INPContentWindowBody').style.height = (theHeight - 75) + 'px';
	
	
	// also the body table width
	document.getElementById('INPContentWindowTable').style.width = (theWidth - 14 - 16 - 20) +  'px';
	
	// now the button bar
	document.getElementById('INPContentWindowButtonBar').style.top = (theTop  + theHeight - 28) + 'px';
	document.getElementById('INPContentWindowButtonBar').style.left = (theLeft + 14) + 'px';
	document.getElementById('INPContentWindowButtonBar').style.width = (theWidth - 28) + 'px';
	
	
	// now show the mask
	INPFramework.showMask();
	
	// make everything visible
	document.getElementById('INPContentWindow').style.visibility = 'visible';
	document.getElementById('INPContentWindowOverlay').style.visibility = 'visible';
	document.getElementById('INPContentWindowClose').style.visibility = 'visible';
	document.getElementById('INPContentWindowBody').style.visibility = 'visible';
	document.getElementById('INPContentWindowButtonBar').style.visibility = 'visible';
	document.getElementById('INPContentWindowTitle').style.visibility = 'visible';
	
	// set the content
	document.getElementById('INPContentWindowTitleBody').innerHTML = winTitle;
	
	var theTarget = 'INPContentWindowBodyCell';
	
	if (iMode != 'yt') {
		INPFramework.getWinContentAsynch(theContent, theTarget, false);
		
	} else {
		document.getElementById(theTarget).innerHTML = theContent;
		
	}
	
}

INPFramework.showINPRadioNotice = function() {
	// provide a notification about INPRadio
	var theRan = INPFramework.randomNumber();
	var theContent = "components/INPRadioNotice.html?anticache=" + theRan;
	
	// call for the window
	INPFramework.showPseudoWindow( '', '', 300, 232, theContent, 'INPRadio...');
	
	// set the window scroll properties.
	document.getElementById('INPContentWindowBody').style.overflow = 'hidden';
	
	// set the close button function
	document.getElementById('winOkBtn').onclick = INPFramework.handleWindowClose;
	
}

INPFramework.doIE6Warning = function() {
	// provide a notification warning that IE6 is not really supported
	var theRan = INPFramework.randomNumber();
	var theContent = "components/INPIE6Notice.html?anticache=" + theRan;
	
	// call for the window
	INPFramework.showPseudoWindow( '', '', 300, 430, theContent, 'Unsupported browser...');
	
	// set the close button function
	document.getElementById('winOkBtn').onclick = INPFramework.handleWindowClose;
}

INPFramework.handleWindowMouse = function(theMode, theObject) {
	// handle mouse actions to an object

	if(theMode == 'in') {
		var theClass = theObject.id + 'Moused';
		theObject.className = theClass;
		
	} else {
		var theClass = theObject.id;
		var theClassParts = theClass.split('Moused');
		theClass = theClassParts[0];
		theObject.className = theClass;
		
	}
}

INPFramework.handleWindowClose = function() {
	// handle window close 
	
	// first set all components to hidden
	document.getElementById('INPContentWindow').style.visible = 'hidden';
	document.getElementById('INPContentWindowOverlay').style.visible = 'hidden';
	document.getElementById('INPContentWindowClose').style.visible = 'hidden';
	document.getElementById('INPContentWindowBody').style.visible = 'hidden';
	document.getElementById('INPContentWindowButtonBar').style.visible = 'hidden';
	document.getElementById('INPContentWindowTitle').style.visibility = 'hidden';
	
	// now empty the body container
	document.getElementById('INPContentWindowBodyCell').innerHTML = '';
	document.getElementById('INPContentWindowTitleBody').innerHTML = '';
	
	// now remove display
	document.getElementById('INPContentWindow').style.display = 'none';
	document.getElementById('INPContentWindowOverlay').style.display = 'none';
	document.getElementById('INPContentWindowClose').style.display = 'none';
	document.getElementById('INPContentWindowBody').style.display = 'none';
	document.getElementById('INPContentWindowButtonBar').style.display = 'none';
	document.getElementById('INPContentWindowTitle').style.display = 'none';
	
	// finally, hide the mask
	INPFramework.hideMask();
	
}

INPFramework.getContent = function(theContentSource, theTarget, storageVar) {
	// ajax some content for a specific container
	var xmlhttp =  new XMLHttpRequest();
	
	// wire up the callBack handler
	xmlhttp.onreadystatechange = function() {  
  		if(xmlhttp.readyState == 4)  
  		
		var theReturn = xmlhttp.responseText;
		
		theTarget.innerHTML = theReturn;
		
		if (storageVar != 'none') {
			storageVar.value = theReturn;
		}
		
	};  

    // send the ajax request after the desired data
	xmlhttp.open('GET', theContentSource, true);
	xmlhttp.send(null);
}

INPFramework.GetElementLeft = function(eElement) {
	// determine the actual left position of an object
	
    var nLeftPos = eElement.offsetLeft;          // initialize var to store calculations
    var eParElement = eElement.offsetParent;     // identify first offset parent element  
    while (eParElement != null)
    {                                            // move up through element hierarchy
        nLeftPos += eParElement.offsetLeft;      // appending left offset of each parent
        eParElement = eParElement.offsetParent;  // until no more offset parents exist
    }
    return nLeftPos;                             // return the number calculated
}


INPFramework.GetElementTop = function(eElement) {
	// determine the actual top position of an element
	
    var nTopPos = eElement.offsetTop;            // initialize var to store calculations
    var eParElement = eElement.offsetParent;     // identify first offset parent element  
    while (eParElement != null)
    {                                            // move up through element hierarchy
        nTopPos += eParElement.offsetTop;        // appending top offset of each parent
        eParElement = eParElement.offsetParent;  // until no more offset parents exist
    }
    return nTopPos;                              // return the number calculated
}


INPFramework.setNoPropogate = function(theEvent) {
	// cancel the bubble so this won't cause the popup to close
	var theEvent; // the event fired
	
	// first figure out if this is IE and set the cancelBubble property
	theEvent.cancelBubble = true;
	
	// if it isn't IE stopPropagation
	if (theEvent.stopPropagation) {
		//alert('this is firefox');
		theEvent.stopPropagation();
	}
}

INPFramework.fadeIn = function(theId, theStart, theEnd, theTime) {
	// fade an object in from one specified opacity to another
	// set the speed of fade
	var theSpeed = Math.round(theTime / 100);
	var theTimer = 0;

	for(i = theStart; i <= theEnd; i++) {
		setTimeout("INPFramework.setOpacity(" + i + ",'" + theId + "')",(theTimer * theSpeed));
		theTimer++;
	}
}

INPFramework.setOpacity = function(theOpacity, theId) {
	// this is a cross-browser capable method for setting the opacity of an object
	var theObject = document.getElementById(theId).style; 
	
	// safari
	theObject.opacity = (theOpacity / 100);

	// mozilla
	theObject.MozOpacity = (theOpacity / 100);

	// IE
	theObject.filter = "alpha(opacity=" + theOpacity + ")";
}

INPFramework.setReadyStateInterval = function() {
	// set up a ready state interval that will keep firing until the document has completely loaded
	// check every 100MS
	INPFramework.readyState = setInterval("INPFramework.readyMonitor()", 100);
}

INPFramework.readyMonitor = function() {
	// check to see if the page has fully loaded / rendered in IE
	// in mozilla, onload doesn't fire until the DOM is loaded.
	var theState = document.readyState;
	
	if (window.attachEvent) {
		if (theState == "complete") {
			// clear the readystate interval
			clearInterval(INPFramework.readyState);
	
			// do some other IE related thing here
			INPFramework.hideSpinner();
			
			// make sure a user came in on the proper URL
			var theURL = location.href;
			var theURLParts = theURL.split('.org/');
			
			// now force the proper root URL
			if(theURLParts[0] == 'http://ineedaprayer') {
				window.location.href = 'http://www.ineedaprayer.org';
			}
			
			// check for IE6 or less
			if (INPFramework.browser == 'IE' && INPFramework.version < 7) {
				INPFramework.doIE6Warning();
				
			}
			
			// get IP based location data
			INPFramework.getLocationData();
			
		}
	} else {
		clearInterval(INPFramework.readyState);
		INPFramework.hideSpinner();
		
		// make sure a user came in on the proper URL
		var theURL = location.href;
		var theURLParts = theURL.split('.org/');
		
		// now force the proper root URL
		if(theURLParts[0] == 'http://ineedaprayer') {
			window.location.href = 'http://www.ineedaprayer.org';
		}
		
		// get IP based location data
		INPFramework.getLocationData();
		
	}
}

INPFramework.showSpinner = function() {
	// show the pcts spinner
	var theTop = INPFramework.clientHeight / 2 - 35 + 'px';
	var theLeft = INPFramework.clientWidth / 2 - 35 + 'px';

	if(document.getElementById('INPSpinner')) {
		document.getElementById('INPSpinner').style.top = theTop;
		document.getElementById('INPSpinner').style.left = theLeft;
	}

}

INPFramework.hideSpinner = function() {
	// hide the pcts spinner
	document.getElementById('INPSpinner').style.top = '-100px';
	document.getElementById('INPSpinner').style.left = '-100px';

}


INPFramework.loadRadioPlayer = function() {
	// load the radio player into its frame
	document.getElementById('INPFrameworkRadio').src = "http://www.ineedaprayer.org/mp3/wimpy.swf?wimpyApp=wimpy.php&background_color=333333&infoDisplayTime=3&theVolume=100&defaultVisualName=coverart&defaultVisualExt=jpg&defaultPlayRandom=yes&startPlayingOnload=yes&popUpHelp=yes&bufferAudio=3&autoAdvance=yes&trackPlays=yes";
	INPFramework.radioState = 'playing';
	
	// show the mask
	// INPFramework.showMask();
}

INPFramework.stopPlayer = function() {

	// set the proper class and play state for the play btn
	document.getElementById('inpPlayerBBarBtn').setAttribute('playerMode', 'stopped');
	document.getElementById('inpPlayerBBarBtn').className = 'inpPlayer_bbPlay';
	document.getElementById('inpPlayerBBarBtn').style.visibility = 'hidden';
	
	// handle the pplayer badge
	document.getElementById('INPPlayerBadge').style.display = 'none';
	
	window.clearInterval(INPFramework.playerUpdateTimer);
	
	// stop the player
	INPFramework.tellWimpyStop();
	
}

INPFramework.pausePlayer = function() {
	
	// set the proper class and play state for the play btn
	document.getElementById('inpPlayerBBarBtn').setAttribute('playerMode', 'stopped');
	document.getElementById('inpPlayerBBarBtn').className = 'inpPlayer_bbPlay';
	
	window.clearInterval(INPFramework.playerUpdateTimer);
	
	// pause the player
	INPFramework.tellWimpyPause();
	
}

INPFramework.resumePlayer = function() {
	
	// set the proper class and play state for the play btn
	document.getElementById('inpPlayerBBarBtn').setAttribute('playerMode', 'playing');
	document.getElementById('inpPlayerBBarBtn').className = 'inpPlayer_bbPause';
	
	// pause the player
	INPFramework.tellWimpyPlay();
	
	// start the update interval
	INPFramework.startPlayerUpdateInterval();
	
}

INPFramework.navigateToPage = function(thePage) {
	// navigate the INP main content frame to a given page
	document.getElementById('INPFrameworkMainContent').src = thePage;
}

INPFramework.displayRadio = function() {
	// display INP radio if appropriate
	
	if (INPFramework.secure == true || INPFramework.requireAudioSecurity == 'false') {
		
		// enable inpradio because a secure session exists
		document.getElementById('inpradio').style.display = 'block';
		document.getElementById('inpradio').style.visibility = 'visible';
		
		// now see if the radio is playing
		if (INPFramework.radioState != 'stopped' && INPFramework.radioState != 'paused') {
			// the radio is playing, so set the image accordingly
			document.getElementById('inpradioImage').src = "http://www.ineedaprayer.org/images/inpRadioBadgeAnim.gif";
			
		}
		
	} else {
		// no secure session exists, so we execute a stop to the player
		
		INPFramework.goInsecure();
	}
}

INPFramework.handleRadioClick = function() {
	// handle clicks to the INP radio badge
	
	if (INPFramework.radioState == 'stopped') {
		// INP radio is stopped, so we direct the iframe to load the player
		// INPFramework.loadRadioPlayer();
		
		// change the badge state to playing
		// document.getElementById('inpradioImage').src = "http://www.ineedaprayer.org/images/inpRadioBadgeAnim.gif";
		
		// show a notice about the radio
		INPFramework.showINPRadioNotice();
		
	} else {
		// INPFramework.stopPlayer();
		
		// change the badge state to playing
		// document.getElementById('inpradioImage').src = "http://www.ineedaprayer.org/images/inpRadioBadge.gif";
	}
}

INPFramework.goInsecure = function() {
	// switch to an insecure state
	
	INPFramework.secure = false;
	if (INPFramework.requireAudioSecurity != 'false') {
		INPFramework.radioState = 'stopped';
		document.getElementById('inpradioImage').src = "http://www.ineedaprayer.org/images/inpRadioBadge.gif";
		document.getElementById('inpradio').style.visibility = "hidden";
		INPFramework.stopPlayer();
	}
}

INPFramework.showINPPlayerSecurityNotice = function() {
	// provide a notification about INPRadio
	var theRan = INPFramework.randomNumber();
	var theContent = "components/INPPlayerNotSecure.html?anticache=" + theRan;
	
	// call for the window
	INPFramework.showPseudoWindow( '', '', 201, 390, theContent, 'No secure state...');
	
	// set the window scroll properties.
	document.getElementById('INPContentWindowBody').style.overflow = 'hidden';
	
	// set the close button function
	document.getElementById('winOkBtn').onclick = INPFramework.handleWindowClose;
	
}

INPFramework.playAudioLesson = function(theObject, theSource) {
	// load and play the lesson of theId provided
	
	// update the data displayed in the player info pane.
	INPFramework.updatePlayerComponents(theObject);
	
	// determine what the lesson ID is
	var theId = theObject.id;
	var theIdParts = theId.split('_');
	INPFramework.lessonId = theIdParts[1];
	
	// check to see if we are secure
	if (INPFramework.secure || INPFramework.requireAudioSecurity == 'false') {

		// show the INPPlayer badge
		document.getElementById('INPPlayerBadge').style.display = 'block';
		
		// set the proper class and play state for the play btn
		document.getElementById('inpPlayerBBarBtn').setAttribute('playerMode', 'playing');
		document.getElementById('inpPlayerBBarBtn').className = 'inpPlayer_bbPause';
		document.getElementById('inpPlayerBBarBtn').style.visibility = 'visible';
		
		// show the mask and the player info popdown
		INPFramework.showPlayerInfoPane();
		
		// start the player
		INPFramework.addTrack(theSource);
		
		// record the click
		var theAccessor = "accessors/insertLessonPlay.php?lesson=" + theSource + "&ip=" + INPFramework.currentIP;
	
		// add a random number so as to prevent IE from using a chached accessor return
		var theRan = INPFramework.randomNumber();
		theAccessor = theAccessor + "&anticache=" + theRan;
		
	
		// instantiate save
		try {
			INPFramework.getData(theAccessor);
			
		} catch(er) {
			
		}
		
		INPFramework.startPlayerUpdateInterval();
		
		// start the player dispo timer
		INPFramework.startPlayerDispoTimer();
		
		// get the lesson verses
		INPFramework.getLessonVerses();

		
	} else {
		INPFramework.showINPPlayerSecurityNotice();
		
	}
	
	// touch the window size to try and get the screen to redraw, but only if this is IE6
	// defeats IE black box bug
	if(INPFramework.cssType == 'ie') {
		var h = document.documentElement.clientHeight;
		var w = document.body.offsetWidth;
		window.resizeBy(1,1);

	}
	
}

INPFramework.showPlayerInfoPane = function() {
	// show the player info pane
	
	// first marke the player body to indicate that it is shown
	document.getElementById('INPPlayerWindow').setAttribute('playerShown', 'true');
	
	INPFramework.showMask();
	
	// set the left of the player
	var thePlayerBadge = document.getElementById('INPPlayerBadge');
	var theLeft = INPFramework.GetElementLeft(thePlayerBadge);	
	document.getElementById('INPPlayerWindowBody').style.left = theLeft + 16 + 'px';
	document.getElementById('INPPlayerWindow').style.left = theLeft + 16 + 'px';
	
	// now show it
	$("#INPPlayerWindowBody").animate({ top: "30px"}, 700);
	$("#INPPlayerWindow").animate({ top: "-16px"}, 700);
	
}

INPFramework.hidePlayerInfoPane = function() {
	// show the player info pane
	
	// first marke the player body to indicate that it is not shown
	document.getElementById('INPPlayerWindow').setAttribute('playerShown', 'false');
	
	INPFramework.hideMask();
	$("#INPPlayerWindowBody").animate({ top: "-160px"}, 700);
	$("#INPPlayerWindow").animate({ top: "-199px"}, 700);
	
}

INPFramework.updatePlayerComponents = function(theObject) {
	// update the information displayed in the player popdown
	
	// get all of the track data from the DOM object
	var theSpeaker = theObject.getAttribute('segmentArtist');
	var theTitle = theObject.getAttribute('segmentTitle');
	var theBlurb = theObject.getAttribute('segmentBlurb');
	var theIcon = theObject.getAttribute('segmentIconSource');
	
	// set the data
	document.getElementById('inpPlayerArtwork').style.backgroundImage = "url(../images/av/" + theIcon + ")";
	document.getElementById('inpPlayerTitle').innerHTML = theTitle;
	document.getElementById('inpPlayerArtist').innerHTML = theSpeaker;
	document.getElementById('inpPlayerBlurb').innerHTML = theBlurb;
	
}

INPFramework.handlePlayerBadgeClick = function() {
	// handle or show the player info pane as appropriate
	var playerShown = document.getElementById('INPPlayerWindow').getAttribute('playerShown');
	
	if (playerShown == 'true') {
		INPFramework.hidePlayerInfoPane();
		
	} else {
		INPFramework.showPlayerInfoPane();
		
	}
	
}

INPFramework.loadAudioPlayer = function() {
	// load the audio player to get it ready to play lessons
	if (!INPFramework.playerLoaded) {
		document.getElementById('INPFrameworkRadio').src = "lessons/INPPlayer.html";
		INPFramework.playerLoaded = true;
		
	}
	
}

INPFramework.handlePPLayerBBarBtnMouse = function(theObject, theMode) {
	// handle mouse actions to the pplayer bar button
	
	var playerMode = document.getElementById('inpPlayerBBarBtn').getAttribute('playerMode');
	
	if (theMode == 'in') {
		if (playerMode == 'playing') {
			document.getElementById('inpPlayerBBarBtn').className = 'inpPlayer_bbPauseMoused';
			
		} else {
			document.getElementById('inpPlayerBBarBtn').className = 'inpPlayer_bbPlayMoused';
			
		}
		
	} else {
		if (playerMode == 'playing') {
			document.getElementById('inpPlayerBBarBtn').className = 'inpPlayer_bbPause';
			
		} else {
			document.getElementById('inpPlayerBBarBtn').className = 'inpPlayer_bbPlay';
			
		}
		
	}
	
}

INPFramework.handlePPLayerBBarBtnClick = function(theObject) {
	// handle clicks to the pplayer bar button
	
	var playerMode = document.getElementById('inpPlayerBBarBtn').getAttribute('playerMode');
	
		if (playerMode == 'playing') {
			INPFramework.pausePlayer();
			
		} else {
			INPFramework.resumePlayer();
			
		}
	
}

INPFramework.startPlayerUpdateInterval = function() {
	// start the INP player update interval
	INPFramework.playerUpdateTimer = window.setInterval("INPFramework.updatePlayerValues()", 1000);
	
}

INPFramework.startPlayerDispoTimer = function() {
	// start the INP player update interval
	INPFramework.playerDispoTimer = window.setTimeout("INPFramework.hidePlayerInfoPane()", 3000);
	
}

INPFramework.updatePlayerValues = function() {
	var theCurrentTrackTime = INPFramework.getCurrentPosition();
	if(theCurrentTrackTime != 'ND') {
		if (theCurrentTrackTime.timeCurrentNice != 'null') {
			document.getElementById('inpPlayerBBarTimer').innerHTML = theCurrentTrackTime.timeCurrentNice;
			
			// check to see if there are any verses
			var verseIdentifier = 'l' + INPFramework.lessonId + 'm' + theCurrentTrackTime.timeCurrentNice;
			var theFoundVerse = INPFramework.lessonVerses[verseIdentifier];
			
			//handle any found verses
			if(theFoundVerse != undefined) {
				// do something with the verse here
			}
		
		} else {
			document.getElementById('inpPlayerBBarTimer').innerHTML = 'loading';
			
		}
		
	}
	
}

INPFramework.embeddedPlayAudioLesson = function(theId) {
	// play an audio lesson from an embedded link
	
	// set up an accessor
	var theAccessor = "accessors/getLessonInfo.php?id=" + theId;
	
	// add a random number so as to prevent IE from using a chached accessor return
	var theRan = INPFramework.randomNumber();
	theAccessor = theAccessor + "&anticache=" + theRan;
	INPFramework.getData(theAccessor);
	
}

INPFramework.playEmbeddedLesson = function() {
	// respond to a successful embedded player event
	
	// set player values
	document.getElementById('inpPlayerArtwork').style.backgroundImage = "url(../images/av/" + INPFramework.lessonIcon + ")";
	document.getElementById('inpPlayerTitle').innerHTML = INPFramework.lessonTitle;
	document.getElementById('inpPlayerArtist').innerHTML = INPFramework.lessonArtist;
	document.getElementById('inpPlayerBlurb').innerHTML = INPFramework.lessonBlurb;
	
	// now play the lesson
	// show the INPPlayer badge
	document.getElementById('INPPlayerBadge').style.display = 'block';
	
	// set the proper class and play state for the play btn
	document.getElementById('inpPlayerBBarBtn').setAttribute('playerMode', 'playing');
	document.getElementById('inpPlayerBBarBtn').className = 'inpPlayer_bbPause';
	document.getElementById('inpPlayerBBarBtn').style.visibility = 'visible';
	
	// start the player
	INPFramework.addTrack(INPFramework.lessonMP3);
	
	// show the mask and the player info popdown
	INPFramework.showPlayerInfoPane();
	
	// start the player dispo timer
	INPFramework.startPlayerDispoTimer();
	
	// alert(INPFramework.lessonIcon + ', ' + INPFramework.lessonBlurb + ', ' + INPFramework.lessonTitle + ', ' + INPFramework.lessonArtist + ', ' + INPFramework.lessonMP3);
	
	INPFramework.startPlayerUpdateInterval();
	
	// get verses
	INPFramework.getLessonVerses();
}

INPFramework.getLessonVerses = function() {
	// play an audio lesson from an embedded link
	
	// set up an accessor
	var theAccessor = "accessors/getLessonVerses.php?id=" + INPFramework.lessonId;
	
	// add a random number so as to prevent IE from using a chached accessor return
	var theRan = INPFramework.randomNumber();
	theAccessor = theAccessor + "&anticache=" + theRan;
	INPFramework.getData(theAccessor);
	
}

INPFramework.lessonVersesRetrieved = function() {
	// handle the return of lesson verses
	// alert(INPFramework.lessonVerses['l15m4:19']);
}

INPFramework.getLocationData = function() {
	// parse location and IP information for security purposes
	// set up an accessor
	var theAccessor = "accessors/getIP2location.php?ip=" + INPFramework.currentIP + '&user=' + INPFramework.currentUser;
	
	// add a random number so as to prevent IE from using a chached accessor return
	var theRan = INPFramework.randomNumber();
	theAccessor = theAccessor + "&anticache=" + theRan;
	INPFramework.getData(theAccessor);
	
}

INPFramework.updateLocationData = function() {
	// update location table
	// set up an accessor
	var theAccessor = "accessors/updateLocationTable.php?ip=" + INPFramework.currentIP + '&user=' + INPFramework.currentUser;
	
	// add a random number so as to prevent IE from using a chached accessor return
	var theRan = INPFramework.randomNumber();
	theAccessor = theAccessor + "&anticache=" + theRan;
	INPFramework.getData(theAccessor);
	
}

INPFramework.processLocationData = function() {
	// do something with resturned IP location data
	// alert(INPFramework.city);
	// alert(INPFramework.sentIp);
	
}

INPFramework.showKnowGodSegment = function(theSegment, theTitle) {
	// provide a notification about INPRadio
	var theRan = INPFramework.randomNumber();
	//var theContent = "components/KG_" + theSegment + ".php?anticache=" + theRan;
	var theContent = "<iframe id=\"INPContentWindowFrame\" style=\"width:640px; height:405px; visibility:visible; display:block\" frameborder=\"0\" scrolling=\"no\" allowtransparency=\"yes\" style=\"overflow-x:hidden; overflow-y:hidden\" src=\"http://www.ineedaprayer.org/components/KG_" + theSegment + ".php\"></iframe>"
	
	// call for the window
	INPFramework.showPseudoWindow( '', '', 390, 670, theContent, 'Know God: <span style=\'font-weight:normal\'>' + theTitle + '</span>', 'yt', 'none');
	
	// set the window scroll properties.
	document.getElementById('INPContentWindowBody').style.overflow = 'hidden';
	
	// set the close button function
	document.getElementById('winOkBtn').onclick = INPFramework.handleWindowClose;
	
}

INPFramework.disposeYoutubePlayer = function() {
	// get rid of the you tube player
	INPFramework.handleWindowClose();
	
}

INPFramework.showYTFrame = function() {
	// shoe the youtube player frame
	document.getElementById('INPContentWindowFrame').style.visibility = 'visible';
	
}

INPFramework.handleSiteControlClick = function(theClassName) {
	// handle clicks to the site control
	if (theClassName == 'inpSiteMoreControlUp') {
		// closed, so open it
		
		// change the control class
		document.getElementById('inpSiteMoreControl').className = 'inpSiteMoreControlDown';
		
		// animate the desired components
		$('#inpSiteMoreControl').animate({top: '+=111'}, 'normal');
		$('#inpSiteSelector').animate({top: '+=111'}, 'normal');
		$('#INPToolBar').animate({top: '+=111'}, 'normal');
		$('#INPFrameworkMainContent').animate({top: '+=111'}, 'normal');
		$('#bgCircles').animate({top: '+=111'}, 'normal');
		
	} else {
		// open, so close it
		
		// change the control class
		document.getElementById('inpSiteMoreControl').className = 'inpSiteMoreControlUp';
		
		// animate the desired components
		$('#inpSiteMoreControl').animate({top: '-=111'}, 'normal');
		$('#inpSiteSelector').animate({top: '-=111'}, 'normal');
		$('#INPToolBar').animate({top: '-=111'}, 'normal');
		$('#INPFrameworkMainContent').animate({top: '-=111'}, 'normal');
		$('#bgCircles').animate({top: '-=111'}, 'normal');
		
	}
}

INPFramework.handleSiteSelection = function(theSite) {
	// go to a site selected from the site selector
	window.location.href = theSite;
	
}

INPFramework.playMobileVideo = function(theVideo) {
	// launch a youtube mobile video from an iDevice (iPad, etc.)
	window.location.href = theVideo;
	document.getElementById('INPVideoLauncher').src = theVideo;
	
}

// ------- attach events -------

if (window.attachEvent) {
	// the executing browser is IE
	window.attachEvent("onload", INPFramework.showSpinner);
	window.attachEvent("onload", INPFramework.setReadyStateInterval);
	window.attachEvent("onload", INPFramework.setBasicClientData);
	window.attachEvent("onload", INPFramework.setElementHeights);
	window.attachEvent("onload", INPFramework.loadAudioPlayer);
	window.attachEvent("onload", INPFramework.showMainBody);
	window.attachEvent("onunload", INPFramework.showSpinner);
	
	window.attachEvent("onresize", INPFramework.setBasicClientData);
	window.attachEvent("onresize", INPFramework.setElementHeights);
	
} else {
	//the executing browser is not IE
	window.addEventListener('load', INPFramework.showSpinner, false);
	window.addEventListener('load', INPFramework.setReadyStateInterval, false);
	window.addEventListener('load', INPFramework.setBasicClientData, false);
	window.addEventListener('load', INPFramework.setElementHeights, false);
	window.addEventListener('load', INPFramework.showMainBody, false);
	window.addEventListener('load', INPFramework.loadAudioPlayer, false);
	window.addEventListener('unload', INPFramework.showSpinner, false);
	window.addEventListener('resize', INPFramework.setBasicClientData, false);
	window.addEventListener('resize', INPFramework.setElementHeights, false);
	
}
