//on page load call TBTVP_init$$(document).ready(TBTVP_init);//add ediTBTVPox to href elements that have a class of .ediTBTVPoxfunction TBTVP_init(){	$$("a.tvpbox").click(function(){	var t = this.title || this.name || null;	TBTVP_show(this.href,t);	this.blur();	return false;	});}var currentitemid;var currenthtmltext;function TBTVP_show(url, title) {//function called when the user clicks on an ediTBTVPox linktry{	if (document.getElementById("TBTVP_HideSelect") == null) {		$$("body").append("<iframe id='TBTVP_HideSelect'></iframe><div id='TBTVP_overlay' style='display:block'></div><div id='TBTVP_window'></div>");		$$("#TBTVP_overlay").click(TBTVP_remove);	}		$$(window).scroll(TBTVP_position);		TBTVP_overlaySize();	$$("body").append("<div id='TBTVP_load'><img src='images/loadingAnimation.gif' /></div>");	TBTVP_load_position();	//code to show html pages			var queryString = url.replace(/^[^\?]+\??/,'');	var params = TBTVP_parseQuery( queryString );		TBTVP_WIDTH = (params['width']*1) + 30;	TBTVP_HEIGHT = (params['height']*1) + 40;	TBTVP_TVPBOX = params['tvpbox'];	ajaxContentW = TBTVP_WIDTH - 30;	ajaxContentH = TBTVP_HEIGHT - 45;	$$("#TBTVP_window").append("<div id='TBTVP_title'><div id='TBTVP_ajaxWindowTitle'>"+title+"</div><div id='TBTVP_closeAjaxWindow'><a href='#' id='TBTVP_closeWindowButton'>close</a></div></div><div id='TBTVP_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");	document.getElementById('TBTVP_window').style.display = 'block';	$$("#TBTVP_closeWindowButton").click(TBTVP_remove);		currentitemid = TBTVP_TVPBOX;	currenthtmltext = document.getElementById(TBTVP_TVPBOX).innerHTML;	document.getElementById('TBTVP_ajaxContent').innerHTML = currenthtmltext;	document.getElementById(TBTVP_TVPBOX).innerHTML = '';		$$("#TBTVP_ajaxContent").html($$('#' + params['inlineId']).html());	TBTVP_position();	$$("#TBTVP_load").remove();	$$("#TBTVP_window").css({display:"block"});		$$(window).resize(TBTVP_position);	document.onkeyup = function(e){		if (e == null) { // ie			keycode = event.keyCode;		} else { // mozilla			keycode = e.which;		}		if(keycode == 27){ // close			TBTVP_remove();		}	}}catch(e){alert(e);}}//helper functions belowfunction TBTVP_showIframe(){	$$("#TBTVP_load").remove();	$$("#TBTVP_window").css({display:"block"});}function TBTVP_update() {	//update the viewelement of the editted object	new Ajax.Request(TBTVP_URL, {method:'post', postbody:'update='+TBTVP_EDITENTITY+'&viewtemplate='+TBTVP_VIEWTEMPLATE, onSuccess:processUpdate});}function processUpdate(xmlhttprequest) {	viewfield = document.getElementById('viewelement'+TBTVP_EDITENTITY);	viewfield.innerHTML = xmlhttprequest.responseText;}function TBTVP_remove() {	document.getElementById(currentitemid).innerHTML = currenthtmltext;	$$("#TBTVP_overlay").unbind('click');	$$("#TBTVP_closeWindowButton").unbind('click');	$$("#TBTVP_window").fadeOut("fast",function(){$$('#TBTVP_window,#TBTVP_overlay,#TBTVP_HideSelect').remove();});	$$("#TBTVP_load").remove();	return false;}function TBTVP_position() {	var pagesize = TBTVP_getPageSize();		var arrayPageScroll = TBTVP_getPageScrollTop();		$$("#TBTVP_window").css({width:TBTVP_WIDTH+"px",left: (arrayPageScroll[0] + (pagesize[0] - TBTVP_WIDTH)/2)+"px", top: (arrayPageScroll[1] + (pagesize[1]-TBTVP_HEIGHT)/2)+"px" });}function TBTVP_overlaySize(){	if (window.innerHeight && window.scrollMaxY || window.innerWidth && window.scrollMaxX) {			yScroll = window.innerHeight + window.scrollMaxY;		xScroll = window.innerWidth + window.scrollMaxX;		var deff = document.documentElement;		var wff = (deff&&deff.clientWidth) || document.body.clientWidth || window.innerWidth || self.innerWidth;		var hff = (deff&&deff.clientHeight) || document.body.clientHeight || window.innerHeight || self.innerHeight;		xScroll -= (window.innerWidth - wff);		yScroll -= (window.innerHeight - hff);	} else if (document.body.scrollHeight > document.body.offsetHeight || document.body.scrollWidth > document.body.offsetWidth){ // all but Explorer Mac		yScroll = document.body.scrollHeight;		xScroll = document.body.scrollWidth;	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari		yScroll = document.body.offsetHeight;		xScroll = document.body.offsetWidth;  	}	$$("#TBTVP_overlay").css({"height":yScroll +"px", "width":xScroll +"px"});	$$("#TBTVP_HideSelect").css({"height":yScroll +"px","width":xScroll +"px"});}function TBTVP_load_position() {	var pagesize = TBTVP_getPageSize();	var arrayPageScroll = TBTVP_getPageScrollTop();	$$("#TBTVP_load")	.css({left: (arrayPageScroll[0] + (pagesize[0] - 100)/2)+"px", top: (arrayPageScroll[1] + ((pagesize[1]-100)/2))+"px" })	.css({display:"block"});}function TBTVP_parseQuery ( query ) {   var Params = new Object ();   if ( ! query ) return Params; // return empty object   var Pairs = query.split(/[;&]/);   for ( var i = 0; i < Pairs.length; i++ ) {      var KeyVal = Pairs[i].split('=');      if ( ! KeyVal || KeyVal.length != 2 ) continue;      var key = unescape( KeyVal[0] );      var val = unescape( KeyVal[1] );      val = val.replace(/\+/g, ' ');      Params[key] = val;   }   return Params;}function TBTVP_getPageScrollTop(){	var yScrolltop;	var xScrollleft;	if (self.pageYOffset || self.pageXOffset) {		yScrolltop = self.pageYOffset;		xScrollleft = self.pageXOffset;	} else if (document.documentElement && document.documentElement.scrollTop || document.documentElement.scrollLeft ){	 // Explorer 6 Strict		yScrolltop = document.documentElement.scrollTop;		xScrollleft = document.documentElement.scrollLeft;	} else if (document.body) {// all other Explorers		yScrolltop = document.body.scrollTop;		xScrollleft = document.body.scrollLeft;	}	arrayPageScroll = new Array(xScrollleft,yScrolltop) 	return arrayPageScroll;}function TBTVP_getPageSize(){	var de = document.documentElement;	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight	arrayPageSize = new Array(w,h) 	return arrayPageSize;}