/*
 * (c) brookes management b.v. - 2005/6 - C.Brookes - All Rights Reserved
 *
 * $Revision: 1.16 $
 * $Author: cb $
 * $Date: 2006/10/12 08:08:53 $
 *
 * PORTAL, DATES, HELPPOPUP
 */

// PORTAL
function hideBusyAnim()
{
	var obj = document.getElementById('busyanim');
	if(obj!=null) obj.style.display = 'none';
	
	return null;
}
	
function refreshCheck(url, useRefField)
{
	if(useRefField==null)	var _field = "incrementer";
	else					var _field = useRefField;

	var _url = url;

	try 
	{
		var _inc = findMother().frames["search"].document.getElementById(_field);
		if(_inc != null)
		{
			// we need to rewrite the URL to make sure we dont keep appending the paramter
			var parts = url.split('?');
			var args  = parts[1].split('&');
			_url = parts[0] + "?";
			for(var i=0; i<args.length; i++)
			{
				if(args[i].substring(4) == "uid=") continue;
				if(i==0)	_url += args[i];
				else		_url += "&" + args[i];
			}
			if(_inc.value != "") _url = url + "&uid=" + _inc.value;
		}
	} catch(e) 
	{ 
		// oops - probably a static loaded page and not a list view object
	}

	findMother().location.href = _url;
}

function getSelectValues(Parameter) {

    var array = new Array();

    for (var r = 0; r < Parameter.length; r++) {
        if (Parameter[r].selected == true) {
            array[array.length] = r;
        }
    }
    if (array.length == 0) {
        array[0] = -1;
    }
    return array;
}

function addSelectedItems(fromSelect, toSelect) {

    var arrIndexes = getSelectValues(fromSelect);

    if (arrIndexes == -1) return;
    var toSelectLength = toSelect.length;
    var arrIndexesLength = arrIndexes.length;

    arrSize = arrIndexesLength;

    for (var q = 0; q < arrSize; q++) {
        var txtItem = fromSelect.options[arrIndexes[q]].text;
        var inThere = false;

        for (i = 0; i < toSelect.length; i++) {
            if (toSelect.options[i].text == txtItem) {
                inThere = true;
                break;
            }
        }
        if (!inThere) {
            toSelect.length += 1;
            toSelect.options[toSelect.length-1].text = fromSelect.options[arrIndexes[q]].text;
            toSelect.options[toSelect.length-1].value = fromSelect.options[arrIndexes[q]].value;
            toSelect.options[toSelect.length-1].selected = true;
        }
    }
}


function deleteItemFromList(fromSelect)
{
   var _selected = getSelectValues(fromSelect);
   var _array    = new Array();

   for(var i=0; i<_selected.length; i++)
   {
       _array[i] = fromSelect.options[_selected[i]].value;
   }
   for(var x=0; x<_array.length; x++)
   {
       deleteFromSelect(fromSelect, _array[x]);
   }
}

function deleteFromSelect(sbObj, item)
{
   for(var l=0; l<sbObj.options.length; l++) {
       if(sbObj.options[l].value == item) {
           sbObj.options[l] = null;
       }
   }

}

function selectAll(fieldname)
{
   var _obj;

   _obj = findObj(fieldname);

   for(var i=0; i<_obj.options.length; i++)
   {
       _obj.options[i].selected = true;
   }
}

function copyItem(field_from, field_to, flagDelete)
{
   var _fromselect;
   var _toselect;

   _fromselect = findObj(field_from);
   _toselect   = findObj(field_to);

   addSelectedItems(_fromselect, _toselect);

   if(flagDelete == true)
   {
       deleteItemFromList(_fromselect);
   }
}

function helperUpdater(fieldName, newValue)
{
	var _obj = findObj(fieldName, window.opener.document);
	if(_obj==null) return;
	
	_obj.value = newValue;
	window.close();
}

function helperUpdaterDate(fieldName, newValue)
{
	var _obj  = findObj(fieldName, window.opener.document);
	var _mobj = findObj("v_moy_" + fieldName, window.opener.document);
	var _dobj = findObj("v_dom_" + fieldName, window.opener.document);
	var _yobj = findObj("v_yr_" + fieldName, window.opener.document);
	if(_obj==null || _mobj==null || _dobj==null || _yobj==null) return;
	
	_obj.value = newValue;
	
	_list = newValue.split('-');
	_yobj.value = _list[0];
	_mobj.value = parseInt(_list[1]) -1;
	_dobj.value = parseInt(_list[2]) -1;
	
	window.close();
}

function submitForm(formName)
{
	var formObj = findObj(formName);
	formObj.submit();
}

function sendParentTo(url)
{
	var mother = findMother();
	if(mother == null)	window.opener.parent.location.href = url;
	else				mother.location.href = url;
}

function findFocusField(doc)
{
	if(doc==null) return;
	if(doc.forms==null) return;
	if(doc.forms.length == 0) return;
	
	for(var i=0; i<doc.forms[0].elements.length; i++)
	{
		if(doc.forms[0].elements[i].type == "hidden") continue;
		
		doc.forms[0].elements[i].focus();
		break;
	}
	
	return;
}

function findMother()
{
	if(window.opener == null)
	{
		if(window.parent!=null)
		{
			var wind = window.parent;
			var yyy = 0;
			while(wind != null)
			{
				yyy++;
				if(yyy > 10) return null;
				if(wind.frames!=null && wind.frames.mother!=null) return wind.frames.mother;
				wind = wind.parent;
			}
		} 
		if(window.frames == null) return null;
		if(window.frames.mother == null) return null;
		return window.frames.mother;
	}
	
	var xxx = 0;
	var wind = window.opener;
	while(wind != null)
	{
		xxx++;
		if(xxx > 10) return null;
		if(wind.opener == null)
		{
			xxx = 0;
			while(wind != null)
			{
				xxx++;
				if(xxx > 10) return null;
				if(wind.frames!=null && wind.frames.mother!=null) return wind.frames.mother;
				wind = wind.parent;
			}
			return null;
		}
		wind = wind.opener;
	}
	return null;
}


function openPopupComments(classtype, id)
{
	var attributes	= "height=580,width=300,resizeable=no,toolbar=no,status=no,location=no,menubar=no,scrollbars=no";
	var url			= "popup-comments.phtml?id=" + id + "&classtype=" + classtype;
	
	window.open(url, classtype+"_"+id, attributes);
}

function openGalleryPopup(xid, xpage)
{
	var attributes	= "height=640,width=640,resizeable=no,toolbar=no,status=no,location=no,menubar=no,scrollbars=no";
	var url			= "popup-gallery.phtml?id=" + xid + "&_t=" + xpage;
	
	window.open(url, xid, attributes);
}

function openLayoutPanel(id)
{
	var attributes	= "height=600,width=800,resizeable,toolbar=no,status=no,location=no,menubar=no,scrollbars=auto";
	var url			= "pages/cms/editor/dad_edit.phtml?id=" + id;
	
	window.open(url, id, attributes);
}

function openInfoPanel(xtype, xid)
{
	var attributes	= "height=660,width=300,resizeable=no,toolbar=no,status=no,location=no,menubar=no,scrollbars=no";
	var url			= "popup-i.phtml?type=" + xtype + "&id=" + xid + "";
	
	window.open(url, xtype, attributes);
}

function openMessageInfoPanel(xid)
{
	var attributes	= "height=660,width=450,resizeable=yes,toolbar=no,status=no,location=no,menubar=no,scrollbars=no";
	var url			= "popup-m.phtml?id=" + xid;
	
	window.open(url, "message", attributes);
}

function openDeletePanel(xtype, xid, pflag)
{
	var width=300;
	var height=300;
	var new_left = (screen.width/2) - (width/2);
	var new_top = (screen.height/2) - (height/2) - 100;
	window.open("popup.phtml?a=core&c=admin&p=show_delete&type=" + xtype + "&id=" + xid + "&pflag=" + pflag, xtype + "_" + xid, "height=" + height + ",width=" + width + ",screenX=" + new_left + ",screenY=" + new_top + ",top=" + new_top + ",left=" + new_left);
}

function openDeletePanelDeep3(xtype, xid, pflag)
{
	var width=300;
	var height=300;
	var new_left = (screen.width/2) - (width/2);
	var new_top = (screen.height/2) - (height/2) - 100;
	window.open("../../../popup.phtml?a=core&c=admin&p=show_delete&type=" + xtype + "&id=" + xid + "&pflag=" + pflag, xtype + "_" + xid, "height=" + height + ",width=" + width + ",screenX=" + new_left + ",screenY=" + new_top + ",top=" + new_top + ",left=" + new_left);
}

function openHelpPanel(_topic, width, height)
{
	var new_left = (screen.width/2) - (width/2);
	var new_top = (screen.height/2) - (height/2) - 100;
	window.open("popup-h.phtml?topic=" + _topic, "help", "height=" + height + ",width=" + width + ",screenX=" + new_left + ",screenY=" + new_top + ",top=" + new_top + ",left=" + new_left);
}

function openHelpPanelLeft(_topic, width, height)
{
	window.open("popup-h2.phtml?topic=" + _topic, "help", "height=" + height + ",width=" + width);
}

function openHelpPanelLeftDeep3(_topic, width, height)
{
	window.open("../../../popup-h2.phtml?topic=" + _topic, "help", "height=" + height + ",width=" + width);
}

function openPopupNote(pageextra)
{
	var attributes = "height=300,width=300,resizeable=no,toolbar=no,status=no,location=no,menubar=no,scrollbars=no";
	var url = "popup-n.phtml" + pageextra;
	window.open(url, 'note' , attributes);
}

function openSelectorPopup(formName, app, component, page, pageextra)
{
	var formObj			= findObj(formName, parent.frames.board.document);
	var fieldTarget		= findObj("submit_select_target", parent.frames.board.document);
	var fieldAttribs	= findObj("submit_select_attributes", parent.frames.board.document);
	var fieldTitle		= findObj("submit_select_title", parent.frames.board.document);
	
	var attributes = "height=50,width=50,resizeable=no,toolbar=no,status=no,location=no,menubar=no,scrollbars=no";
	var url = "popup.phtml?a="+app+"&c="+component+"&p="+page+"&"+pageextra;

	fieldTarget.value		= url;
	fieldAttribs.value		= attributes;
	fieldTitle.value		= page;

	formObj.submit();
	
	// we now need to wait until the form has finished reloading and then call the popup ourselves.
	// waiting, waiting, waiting ...
	
	// now open the window ...
	window.open(url, page, attributes);
}

function openPopupView(app, component, page, pageextra)
{
	var attributes = "height=50,width=50,resizeable=no,toolbar=no,status=no,location=no,menubar=no,scrollbars=no";
	window.open("popup-p.phtml?a="+app+"&c=" + component + "&p=" + page + "&" + pageextra, page, attributes);
}

function openPopupForm(app, component, page, pageextra)
{
	var attributes = "height=50,width=50,resizeable=no,toolbar=no,status=no,location=no,menubar=no,scrollbars=no";
	window.open("popup.phtml?a="+app+"&c=" + component + "&p=" + page + "&" + pageextra, app+"_"+component+"_"+page, attributes);
}

function openPopupEmpty(app, component, page, pageextra)
{
	var attributes = "height=50,width=50,resizeable=no,toolbar=no,status=no,location=no,menubar=no,scrollbars=no";
	window.open("popup-e.phtml?a="+app+"&c=" + component + "&p=" + page + "&" + pageextra, app+"_"+component+"_"+page, attributes);
}

function openPopupFirstRun(app, component, page, pageextra, width, height, attributes)
{
	var new_left = (screen.width/2) - (width/2);
	var new_top = (screen.height/2) - (height/2) - 50;
	window.open("../../../popup.phtml?a="+app+"&c=" + component + "&p=" + page + "&" + pageextra, app+"_"+component+"_"+page, attributes + "height=" + height + ",width=" + width + ",screenX=" + new_left + ",screenY=" + new_top + ",top=" + new_top + ",left=" + new_left);
}

function openPopupExt(app, component, page, pageextra, width, height, attributes)
{
	window.open("popup.phtml?a="+app+"&c=" + component + "&p=" + page + "&" + pageextra, app+"_"+component+"_"+page, attributes + "height=" + height + ",width=" + width);
}

function openPopupExtDeep2(app, component, page, pageextra, width, height, attributes)
{
	window.open("../../popup.phtml?a="+app+"&c=" + component + "&p=" + page + "&" + pageextra, app+"_"+component+"_"+page, attributes + "height=" + height + ",width=" + width);
}

function openPopupExtDeep3(app, component, page, pageextra, width, height, attributes)
{
	window.open("../../../popup.phtml?a="+app+"&c=" + component + "&p=" + page + "&" + pageextra, app+"_"+component+"_"+page, attributes + "height=" + height + ",width=" + width);
}

function openPopupUrl(url, width, height, attributes)
{
	var new_left = (screen.width/2) - (width/2);
	var new_top = (screen.height/2) - (height/2) - 50;
	window.open(url, 'url', attributes + "height=" + height + ",width=" + width + ",screenX=" + new_left + ",screenY=" + new_top + ",top=" + new_top + ",left=" + new_left);
}

function openPopup(component, page, pageextra, width, height, attributes)
{
	var new_left = (screen.width/2) - (width/2);
	var new_top = (screen.height/2) - (height/2) - 50;
	window.open("popup.phtml?c=" + component + "&p=" + page + "&" + pageextra, component+"_"+component+"_"+page, attributes + "height=" + height + ",width=" + width + ",screenX=" + new_left + ",screenY=" + new_top + ",top=" + new_top + ",left=" + new_left);
}

function submitFormWithValues(formname, fieldname, values)
{
	var formObj		= findObj(formname);
	var fieldObj	= findObj(fieldname);
	
	fieldObj.value	= values;
	
	formObj.submit();
}

function findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document); return x;
}


// DATES
function sisDate(pattern, tomatch)
{
	var _year;
	var _month;
	var _day;

	var _pattern	= pattern;
	var _tomatch	= tomatch;

	var _processed	= false;
	
	this.getYear	= FgetYear;
	this.getMonth	= FgetMonth;
	this.getDay		= FgetDay;
	this._process	= F_processDate;

	function FgetYear()
	{
		this._process();
		return _year;
	}

	function FgetMonth()
	{
		this._process();
		return _month;
	}

	function FgetDay()
	{
		this._process();
		return _day;
	}

	// this is the real heart of the system. it uses the javascript
	// regular expression engine to perform the extraction of the
	// three date parts (year,month,day) and stuff them into the
	// object variables.
	function F_processDate()
	{
		_month = 0;
		_day = 0;
		_year = 0;
		
		try
		{
			var reg 	= /([Ymd])([-\/])([Ymd])([-\/])([Ymd])/
			var result 	= reg.exec(_pattern);

			var regdate 	= /(\d+)([-\/])(\d+)([-\/])(\d+)/
			var resdate 	= regdate.exec(_tomatch);

			if(result[1] == 'm') _month = resdate[1];
			if(result[3] == 'm') _month = resdate[3];
			if(result[5] == 'm') _month = resdate[5];

			if(result[1] == 'd') _day = resdate[1];
			if(result[3] == 'd') _day = resdate[3];
			if(result[5] == 'd') _day = resdate[5];

			if(result[1] == 'Y') _year = resdate[1];
			if(result[3] == 'Y') _year = resdate[3];
			if(result[5] == 'Y') _year = resdate[5];
		} catch(e)
		{
			this._processed = false;
			return;
		}
		this._processed = true;
	}
}

/**
 * DHTML date validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */
var dtCh= "/";

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr)
{
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		return false
	}
	if (strYear.length != 4 || year==0){
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		return false
	}
return true
}
/**
 * END - DHTML date validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

// this is the entry method that should be linked to the onChange
// event of the visible form field. Then when the form field changes
// the hidden database safe field will be updated. The hidden field
// is the one that actually gets written to the database.
function fixDate(obj, copyToName, asPattern)
{
	var _form 		= obj.form;
	var _copyTo		= document.getElementById(copyToName);

	if(obj!=null && obj.value!="" && obj.value!=null)
	{
		var sisdate 	= new sisDate(asPattern, obj.value);
		var testdate	= sisdate.getMonth() + "/" + sisdate.getDay() + "/" + sisdate.getYear();
		if(!isDate(testdate))
		{
			obj.value = "";
			if(_copyTo!=null) _copyTo.value = "";
			return;
		}

		var newdate		= sisdate.getYear() + "-" + sisdate.getMonth() + "-" + sisdate.getDay();
		if(_copyTo!=null) _copyTo.value = newdate;
	}

}

// for the new SISInputDate object we have an extended fixDate method.
// the date format doesnt need to be transformed from one format to another
// but needs to be assembled from different fields including selects and
// a text field for the year.
function fixDateEx(f, dName, mName, yName, myDate, yearLowerLimit, yearUpperLimit)
{
	var dt = new Date();
	var d  = document.getElementById(dName);
	var m  = document.getElementById(mName);
	var y  = document.getElementById(yName);
	var dayCount = 0;

	// find out what the last day of the month is for the selected month
	for(var i=32; i>26; i--)
	{
		dt.setFullYear(y.value);
		dt.setMonth(m.value);

		var r = dt.setDate(i);
		var tm = dt.getMonth();
		if(tm == m.value)
		{
			dayCount = i;
			break;
		}
	}
	
	originalLength = d.options.length;
	if(dayCount > originalLength)
	{
		for(o=originalLength; o<dayCount; o++)
		{
			d.options[o] = new Option(o+1, o);
		}
	} else
	{
		d.options.length = dayCount;
	}

	// lets update the actual date field for the form.
	md = document.getElementById(myDate);
	if(y.value!="" && parseInt(y.value) >= yearLowerLimit && parseInt(y.value) <= yearUpperLimit)
	{
		md.value = y.value + "-" + (parseInt(m.value)+1) + "-" + (parseInt(d.value)+1);
	} else 
	{
		md.value = "";
	}
}

/**
 * fixTime24
 * This gets the values from the two pulldowns and puts the correct value in the real (but hidden) time field.
 * This variation if fixTime is for 24-hour clock fields. See fixTime12 for a 12-hour clock version.
 */
function fixTime24(f, hName, mName, tName)
{
	var h = document.getElementById(hName);
	var m = document.getElementById(mName);
	var x = document.getElementById(tName);
	
	x.value = h.value + ":" + m.value + ":00";
}

/**
 * fixTime12
 * This gets the values from the two pulldowns and puts the correct value in the real (but hidden) time field.
 * This variation if fixTime is for 12-hour clock fields. See fixTime24 for a 24-hour clock version.
 */
function fixTime12(f, hName, mName, tName, aName)
{
	var h = document.getElementById(hName);
	var m = document.getElementById(mName);
	var t = document.getElementByid(tName);
	var a = document.getElementByid(aName);
	
	var _h = h.value;
	if(_h==12) _h = 0;
	if(a.value=="pm") _h += 12;
	
	t.value = _h + ":" + m.value + ":00";
}

function fixCheckbox(name)
{
	var f		= document.getElementById(name);
	var _form	= f.form;
	var _str	= "v_" + name + "_";
	var _itms	= new Array();
	
	for(var i=0; i < _form.elements.length; i++)
	{
		var _elem = _form.elements[i];
		if(_elem.name.substr(0, _str.length) == _str)
		{
			if(_elem.checked != true) continue;
			
			_ar = _elem.name.split('_');
			_itms[_itms.length] = _ar[_ar.length - 1];
		}
	}

	var _final = "";
	for(var j=0; j<_itms.length; j++)
	{
		if(j>0)	_final += "^";
		_final += _itms[j];
	}
	
	f.value = _final;
	return;
}

// HELPPOPUP
var popupHelpArray  = new Array();
var popupDIVName    = "expldiv";

// ----------------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------------
function PopupItem(ID, title, text) {
	this.ID    = ID;
	this.title = title;
	this.text  = text;
}

// ----------------------------------------------------------------------------------------------
// addPopupHelp()
// ----------------------------------------------------------------------------------------------
function addPopupHelp(ID, title, text) {

	popupHelpArray[popupHelpArray.length] = new PopupItem(ID, title, text);
}

// ----------------------------------------------------------------------------------------------
// getPopupText()
// ----------------------------------------------------------------------------------------------
function getPopupText(ID) {

	for(i=0; i<popupHelpArray.length; i++) {
		if(popupHelpArray[i].ID == ID) {
			return(popupHelpArray[i].text);
		}
	}
}

// ----------------------------------------------------------------------------------------------
// getPopupTitle()
// ----------------------------------------------------------------------------------------------
function getPopupTitle(ID) {

	for(i=0; i<popupHelpArray.length; i++) {
		if(popupHelpArray[i].ID == ID) {
			return(popupHelpArray[i].title);
		}
	}
}

function _findPosY(obj)
{
	if(obj==null) return 0;
	
	var curtop = 0;
	if (obj.offsetParent)
	{
			while (obj.offsetParent)
			{
					curtop += obj.offsetTop
					obj = obj.offsetParent;
			}
	}
	else if (obj.y)
			curtop += obj.y;
	return curtop;
}

// ----------------------------------------------------------------------------------------------
// showPopupHelp()
// ----------------------------------------------------------------------------------------------
function showPopupHelp(ID, _obj) {

	if(!document.all) // Safari - Netscape
	{
		var obj			= _obj;
		var pos_top		= _findPosY(obj) - 4;
	} else
	{
		if(window.event.y==null) // dealing with Opera
		{
			pos_top = _findPosY(_obj) - 4;
		} else
		{
			var e			= window.event;
			var obj 		= e.srcElement;
			
			if(navigator.platform=="Win32")
			{
				var pos_top = e.y - e.offsetY - 7;	// IE Win
			} else
			{
				var pos_top = e.y - e.offsetY - 4;	// IE Mac
			}
		}
	}
	var theDiv				= document.getElementById(popupDIVName);
	theDiv.style.top		= pos_top;

	if(popupTheme==null || popupTheme=="") popupTheme = "/skip/";
	
	// build a little HTML for the popup
	str = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td class=\"explain1\"> ";
	str += "<img src=images/theme" + popupTheme + "explpijl.gif>"
	str += "</td><td class=\"explain2\"> ";
	str += getPopupText(ID);
	str += "</td></tr></table>";

	// write the popup to the DIV!
	theDiv.innerHTML        = str;
	theDiv.style.visibility = "visible";

}

// ----------------------------------------------------------------------------------------------
// cancelPopupHelp()
// ----------------------------------------------------------------------------------------------
function cancelPopupHelp() {

	var theDiv				= document.getElementById(popupDIVName);
	theDiv.style.visibility = "hidden";

}

