
document.getElementsByClassName = function (needle) 
{ 
    if (typeof(needle)!='string') return new Array();    
    var s = [document.documentElement || document.body], i = 0, r = [], l = 0, e; 
    var re = new RegExp('(^|\\s)' + needle + '(\\s|$)'); 
    do 
    { 
        e = s[i]; 
        while (e) 
        { 
            if (e.nodeType == 1) 
            { 
                if (e.className && re.test(e.className)) r[l++] = e; 
                s[i++] = e.firstChild; 
            } 
            e = e.nextSibling; 
        } 
    } 
    while (i--); 
		r.reverse();
    return r; 
}
function getParentNodeByTagName(elem, tagName)
{
	while (elem.tagName != tagName) {
		elem = elem.parentNode;
	}
	return elem;
}
function getFirstLevelElementsByTagName(obj, tag) {
	var els = new Array();
	if (!obj) return els;
	var subTags = obj.childNodes;
	for (var i=0;i<subTags.length;i++) {
		if (subTags[i].tagName == tag) {
				els[els.length] = subTags[i]; 
		}
	}
	return els;
}
function cloneObject(what) {
    for (i in what) {
        this[i] = what[i];
    }
}
function GetCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
	var j = i + alen;
	if (document.cookie.substring(i, j) == arg)
		return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
	return null;
}
function SetCookie (name, value) {
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) +
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
	((path == null) ? "" : ("; path=" + path)) +
	((domain == null) ? "" : ("; domain=" + domain)) +
	((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {
	var exp = new Date();
	exp.setTime (exp.setTime(exp.getTime() - (expDays*24*60*60*1000)));
	// This cookie is history
	var cval = GetCookie (name);
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var expDays = 30;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function amt(){
	var count = GetCookie('count')
	if(count == null) {
		SetCookie('count','1')
		return 1
	}
	else {
		var newcount = parseInt(count) + 1;
		DeleteCookie('count')
		SetCookie('count',newcount,exp)
		return count
	}
}
function getCookieVal(offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}
if (/msie/i.test (navigator.userAgent)) //only override IE
{
	document.nativeGetElementById = document.getElementById;
	document.getElementById = function(id)
	{
		var elem = document.nativeGetElementById(id);
		if(elem)
		{
			//make sure that it is a valid match on id
			if(elem.attributes['id'].value == id)
			{
				return elem;
			}
			else
			{
				//otherwise find the correct element
				for(var i=1;i<document.all[id].length;i++)
				{
					if(document.all[id][i].attributes['id'].value == id)
					{
						return document.all[id][i];
					}
				}
			}
		}
		return null;
	};
}
// Copyright (c) the partners of MetaClass, 2003, 2004, 2005
// Licensed under the Academic Free License version 2.0
function popUp( url, width, height, left, top ) {
	return popUpIdent( url, width, height, left, top );  
}
function popUpVoid(url, width, height, left, top ) {
	popUp( url, width, height, left, top );
}
function popUpIdent( url, width, height, left, top ) {
      var rnum = Math.random()*200; rnum = Math.round(rnum);
      win = this['win'+rnum] =  window.open(url,
        "pup"+rnum,
        "width="+width+",height="+height+",left="+left+",top="+top+",resizable=yes,menubar=no,directories=no,toolbar=no,scrollbars=yes"
      );
       return win;
}
function popUpWindow(url, width, height, left, top ) {
      var newWindow;
      newWindow = window.open(url,
        "poppedUpWindow",
        "width="+width+",height="+height+",left="+left+",top="+top+",resizable=yes,menubar=yes,directories=no,toolbar=no,scrollbars=yes"
      );
}
function popUpWindowAutoSizePos( anUrl) {
      var newWindow;
      newWindow = window.open(anUrl,
        "poppedUpWindow",
        "resizable=yes,menubar=yes,directories=no,toolbar=no,scrollbars=yes"
      );
}
function popUpNoScroll( url, width, height, left, top ) {
      var newWindow;
      newWindow = window.open(url,
        "newGebruikersnaamWin",
        "width="+width+",height="+height+",left="+left+",top="+top+",resizable=yes,menubar=no,directories=no,toolbar=no,scrollbars=no"
      );
}
function popUpFullScreen(url) {
	window.open(url, '', 'fullscreen=yes, scrollbars=no');
}
function popUpYesNo(aQuestion) {
//	if (document.all)
//		return showModalDialog('index.php?pntHandler=YesNoDialog&question=','','dialogWidth:400px;dialogHeight:200px;resizable:yes;');
//	else 
		return confirm(aQuestion + "\n\n(OK = Yes, Cancel = No)");
}
function pntPopUp(strUrl)
{
	var dimensions = pntGetWindowInnerDimensions();
	var iHeight = dimensions.height + 60;
	return popUp(strUrl,940,iHeight,100,75);
}var pntDialogHeightOffset = 120;
var pntUsernamePropname;
var pntUsernamePropnameTryCnt = 0;
var pntActiveMtoNIdFieldName = '';
var pntSetDialogResultPostMethods = new Array();
pntSetDialogResultPostMethods[pntSetDialogResultPostMethods.length] = pntPostProcessMtoNDialogResult;
function pntFlip(obj) {
	if (obj.className.match('active')) {
		pntRemoveFromClassName(obj, 'active');
	} else {
		pntAddToClassName(obj,'active');
	}
}
function pntFlipOut()
{
	if (typeof(pntFlip)=='undefined') return;
	if (this.mouzed) pntFlip(this);
}
function pntFlipOver()
{
		if (typeof(pntFlip)=='undefined') return;
		this.mouzed = true;
		pntFlip(this);	
}
function pntAddSlashes(str) {
	str=str.replace(/\'/g,'\\\'');
	str=str.replace(/\"/g,'\\"');
	return str;
}
function pntStripSlashes(str) {
	str=str.replace(/\\'/g,'\'');
	str=str.replace(/\\"/g,'"');
	return str;
}
function pntExtraInitFunctions() {
	// attach additional functions by using: pntAppendToInit(funcName); in your scripts.
}
function pntInitItemTableOverflow()
{
	pntAddMaxWidthsToTableCellsOfOverflownPntItemTables();
	pntIncreaseOverflownTableHeight();
}
function pntAddMaxWidthsToTableCellsOfOverflownPntItemTables()
{
	var maxTdWidth = 250;
	var itemTables = pntGetOverFlownItemTables();
	for (var i in itemTables)
	{
		var itemTable = itemTables[i].table;
		if (pntIsDefined(itemTable))
		{
			var tds = itemTable.tBodies[0].getElementsByTagName('td');
			for (var tdi in tds)
			{
				var td = tds[tdi];
				if (td.offsetWidth>maxTdWidth) 
				{
					td.innerHTML = '<div class="overflow" style="width: '+maxTdWidth+'px;">'+td.innerHTML+'</div>';
				}
			}
		}
	}	
}
/* adds 14px to pntItemTables who received an horizontal scrollbar
** in order to avoid a vertical scrollbar
** Firefox doesn't add an vertical scrollbar, hence the return
*/
function pntIncreaseOverflownTableHeight()
{	
	if (navigator.userAgent.indexOf('Firefox')>0) return; 	
	var itemTables = pntGetOverFlownItemTables();
	for (var i in itemTables)
	{
		var itemTable = itemTables[i].table;
		var itemTableWrapper = itemTables[i].wrapper;
		if ((pntIsDefined(itemTableWrapper)) && (pntIsDefined(itemTableWrapper.style))) itemTableWrapper.style.height = itemTableWrapper.offsetHeight+14+'px';								
	}	
}
function pntGetOverFlownItemTables()
{
	var itemTables = document.getElementsByClassName('pntItemTable');
	var itemTableWrappers = document.getElementsByClassName('pntItemTableWrapper');	
	var returnArray = new Array();
	for (var i in itemTables)
	{
		var itemTableWrapper = itemTableWrappers[i];
		var itemTable = itemTables[i];
		if (itemTable)
		{
			if (itemTable.offsetWidth > itemTableWrapper.offsetWidth)
			{	
				var pair = new Object();
				pair.table = itemTable;
				pair.wrapper = itemTableWrapper;
				returnArray[returnArray.length] = pair;
			}
		}
	}
	return returnArray;
}
function pntInitSortCol()
{
	var sortCol;
	sortCol = pntGetSortCol();
	var sortDir = sortCol[1];
	sortCol = sortCol[0];
	if (!sortCol) return;
	var pntTh;
	pntTh = 'pntTh-'+sortCol;
	var searchTd = 'pntSearchTd-'+sortCol;
	sortCol = 'pntCol-'+sortCol;	
	var col = document.getElementById(sortCol); 			
	if (!col) return;
	col.className = 'pntActiveCol';
	pntTh = document.getElementById(pntTh);
	if (pntTh);
	pntTh.className+= ' pnt'+sortDir;
	searchTd = document.getElementById(searchTd);
	if (searchTd) searchTd.className = 'pntActiveCol';
}
function pntGetSortCol()
{
	var forms = document.getElementsByTagName('form');
	for (var i in forms)
	{
		var form = forms[i];
		if (form)
		{
			if (form.pntS1)
			{
				var pntS1value = form.pntS1.value;
				var pntS1direction = form.pntS1d.value;
				return Array(pntS1value,pntS1direction);
			}
		}
	}
	return false;
}
function pntInitFlips()
{	
	if (!pntIsIE6()) return;
	pntFlips = document.getElementsByClassName("pntFlip"); 
	for(var i=0;i<pntFlips.length;i++) {
		pntFlips[i].onmouseover = pntFlipOver;
		pntFlips[i].onmouseout = pntFlipOut;
	}		
}
function pntSubmitDetailsForm(boolClearId)
{
	var objForm = document.getElementById('pntDetailsForm');
	if (!objForm) return;
	if (boolClearId) objForm.id.value = 0;
	this.disabled=true;
	objForm.submit();
}
function pntSubmitDetailsFormReturn(boolClearId)
{
	var objForm = document.getElementById('pntDetailsForm');	
	if (!objForm) return;
	objForm.pntBackToOrigin.value = 1;
	pntAppendCurrentPntTabId(objForm);
	pntSubmitDetailsForm(boolClearId);
}
function pntSubmitDetailsFormRedirectToHandler(handler)
{
	var objForm = document.getElementById('pntDetailsForm');	
	if (!objForm) return;
	objForm.pntForwardToHandler.value = handler;
	pntAppendCurrentPntTabId(objForm);
	pntSubmitDetailsForm(false);
}
function pntAppendCurrentPntTabId(detailsForm)
{
	if (typeof(pntCurrentTabId)=="undefined") return;
	if (!pntIsDefined(detailsForm['pntTabId'])) {
		var input = document.createElement('input');
		input.type = "hidden";
		input.name = "pntTabId";
		input.value = pntCurrentTabId;
		detailsForm.appendChild(input);
	}
	detailsForm['pntTabId'].value = pntCurrentTabId;
}
function pntSubmitDetailsFormChangeContext(context)
{
	var objForm = document.getElementById('pntDetailsForm');
	if (!objForm) return;
	objForm.pntContext.value = context;
	this.disabled=true;
	objForm.submit();
}
function pntSubmitDelete() {
	this.disabled=true;
	document.itemTableForm.submit();
}
function pntVerifyAndDelete(itemTableId, shouldVerify, noItemsMarkedMessage) {
	var selectedParams = '';
	var table = document.getElementById(itemTableId);	
	if (!table) return false;
	var elements = table.getElementsByTagName('input');
	for (i=0; i<elements.length; i++) {
		if (elements[i].type=='checkbox' && elements[i].checked) {
			selectedParams = selectedParams+'&'+elements[i].name+'=1';
		}
	}
	if (selectedParams=='')	return alert(noItemsMarkedMessage);
	var form = document.getElementById('pntItemTableForm');
	form.pntHandler.value = 'VerifyDeleteMarkedPage';		
	form.submit();		
}
function pntMerge(itemTableId, noItemsMarkedMessage) {
	var selectedParams = '';
	var table = document.getElementById(itemTableId);	
	if (!table) return false;
	var elements = table.getElementsByTagName('input');
	for (i=0; i<elements.length; i++) {
		if (elements[i].type=='checkbox' && elements[i].checked) {
			selectedParams = selectedParams+'&'+elements[i].name+'=1';
		}
	}
	if (selectedParams=='')	return alert(noItemsMarkedMessage);
	var form = document.getElementById('pntItemTableForm');
	form.pntHandler.value = 'MergeSelectAction';		
	form.submit();		
}
function pntVerifyAndDeleteSingleObject(strUrl)
{
		document.location.href=strUrl;
}
function pntReport() {
	var form = document.getElementById('pntItemTableForm');
	form.pntHandler.value = 'SelectionReportPage';		
	form.submit();
}
// table data link, follows link from table item to its editpage
function tdl(obj, itemId, pntType, pntHandler) {	
	var strUrl = tdlGetHref(obj, itemId, pntType, pntHandler);
	document.location.href = strUrl;
}
function tdlGetHref(obj, itemId, pntType, pntHandler) {
	var tableId = obj.parentNode.parentNode.parentNode.id;	
	dir = tableVars[tableId]['dir'];
  if (pntType.length == 0) {
    pntType = tableVars[tableId]['pntType'];
  }
	if ((!pntIsDefined(pntHandler)) || (pntHandler.length == 0)) pntHandler = 'EditDetailsPage';
	context = tableVars[tableId]['context'];
	link = '../'+dir+'index.php?pntType='+pntType+'&pntHandler='+pntHandler+'&id='+itemId;
	if (pntFootprintId != null)
		link = link + '&pntRef=' + pntFootprintId; //important because IE does not pass HTTP_REFERER from javascript
	if (context != '')
	{
		//	link = link + '&pntContext='+context;	
		//link = link + '&pntScd=d';
	}
	return link;
}
function pntOpenPageFor(formKey, urlNoId, errMsg) {
	var pntDetailsForm = document.getElementById('pntDetailsForm');
	var objectId = pntDetailsForm[formKey].value;
	if (typeof(objectId) == "undefined")
	{
		objectId = pntGetRadioValue(pntDetailsForm[formKey]);
	}
	if (objectId == '') return alert(errMsg.replace(/\+/g,' '));
	str = urlNoId+objectId;	
	document.location.href=str;
}
function pntGetRadioValue(nodeList)
{
	for (var i=0;i<nodeList.length;i++ )
	{
		var radio = nodeList[i];				
		if (radio.checked) return radio.value;
	}
	return '';
}
function pntTabSelected(tab)
{
	 var tabContent = document.getElementById(tab.id+'Content'); 
	 var tabPart    = tab.parentNode.parentNode;
	 var allTabs    = tabPart.getElementsByTagName("DIV");
	 var div        = null;
	 for (var i=0; i<allTabs.length; i++) {
	 	div = allTabs[i];
	 	if (div.className == "pntTabContent")	{
	 		div.style.display='none';
	 	} else if (div.className.search("pntTab") > -1 &&  div.className.search("active")> -1) {
	 		div.className = "pntTab pntFlip";
	 		div.onmouseover = pntFlip;
			div.onmouseout = pntFlip;
	 	}
	}
	tabContent.style.display = 'block';
	tab.className = "pntTab active";
	tab.onmouseover = null;
	tab.onmouseout = null;
}
function pntVerticalTabSelected(tab) {
	var tabContent = document.getElementById(tab.id+'Content'); 
	if (tabContent.style.display == "block") {
		tabContent.style.display  = "none";
		tab.className = "pntVerticalTab active";
	} else {
		tabContent.style.display  = "block";
		tab.className = "pntVerticalTab pntFlip";
	}
}
function pntOpenAddOptionDialogFor(appDir, pntType, formkey)
{
	var detailsForm;
	var objectId;
	var strUrl;	
	strUrl = '../'+appDir+'index.php?pntHandler=EditDetailsDialog&pntType='+pntType+'&pntProperty='+formkey+'&pntScd=n&pntRef='+pntFootprintId;
	var dimensions = pntGetWindowInnerDimensions();
	var iHeight = dimensions.height + 60;
	popUp(strUrl,940,iHeight,100,75);
}
function pntAddOptionFor(formKey, idVal, label) {
	// Adds & selects a new option for the obj-selectbox.
	// Called from 'McObjectAddOptionAndCloseDialog'.
	/*
	// gaat tegenwoordig in een apart script pntObjectDialog.js
	if (pntIsSearchDialog()) 
	{
		window.opener.pntAddOptionFor(formKey, idVal, label);
		window.close();
		return;
	}
	*/
	var pntDetailsForm = document.getElementById('pntDetailsForm');
	var formElem = pntDetailsForm[formKey];
	if (!formElem) return alert ('ERROR: cannot select new option.');
	if (formElem.type == "hidden") 
	{	
		formElem.value = idVal;
		//textField is de div waarin het label komt					
		var textFieldId = formKey.substring(0,formKey.length-2);
		var textField = document.getElementById(textFieldId);
		if (!textField)
		{
			// nog een keer, vanwege grit
			var textFieldId = formKey.replace('Id', '');
			var textField = document.getElementById(textFieldId);
		}
		if (textField) {
			textField.value =label;
		} else 
		{
			alert ('ERROR: textfield not found: ' + textFieldId);
		}
	} else { // Selectbox of radiobuttons
		if (typeof(formElem.tagName) == "undefined") {
			pntAddRadioButton(formKey, idVal, label);
		} else
		{
			pntAddListOption(formElem, idVal, label);			
		}
  }		
}
function pntIsSearchDialog()
{
		if (typeof(pntSearchHandler)=="undefined") return false;
		if (pntSearchHandler.indexOf('Dialog')==-1) return false;
		return true;
}
function pntAddRadioButton(formKey, value, label)
{	
	var radioWidgetWrapperDiv = document.getElementById(formKey);	
	var newRadioWrapper = document.createElement('div');
	newRadioWrapper.className = 'pntRadioWidgetOptionWrapper';
	var newId = formKey + '-' + radioWidgetWrapperDiv.getElementsByTagName('input').length + 1;	
	newRadioWrapper.innerHTML =  '<input type="radio" class="pntRadioWidget" value="'+value+'" id="'+newId+'" name="'+formKey+'" checked="checked">';
	newRadioWrapper.innerHTML += '<label for="'+newId+'">'+label+'</label>';
	radioWidgetWrapperDiv.appendChild(newRadioWrapper);	
}
function pntAddListOption(formElem, idVal, label)
{
	var newOpt = document.createElement('option');
		newOpt.text = label;
    newOpt.value = idVal;
		newOpt.selected = true;  	
    try {
      formElem.add(newOpt, null); // standards compliant; doesn't work in IE
    }
    catch(ex) {
      formElem.add(newOpt); // IE only
    }
}
function pntClrDialogWidget(formKey, formTextField)
{
	var detailsForm = document.getElementById('pntDetailsForm');
	if (!detailsForm) return alert('ERROR: detailsform not found');
	var valueField = detailsForm[formKey];
	if (!valueField)  return alert('ERROR: formkey not found: '+formKey);
	valueField.value = '';
	var textField = detailsForm[formTextField];
	if (!textField)  return alert('ERROR: textField not found: '+formTextField);
	textField.value = '';
	pntPostProcessMtoNDialogResult();
}
function pntOpenDialogFor(appDir, pntType, formkey, pntRefId)
{
	var detailsForm;
	var objectId;
	var strUrl;	
	detailsForm = document.getElementById('pntDetailsForm');	
	if (!detailsForm) return;
	objectId = detailsForm[formkey].value;
	strUrl = '../'+appDir+'index.php?pntHandler=Dialog&pntType='+pntType+'&pntProperty='+formkey+'&pntScd=n&pntRef='+pntRefId+'&id='+objectId;
	popUp(strUrl,640,450,100,75);
}
function pntOpenDialogForMtoN(appDir, pntType, formkey, mToNFormKey)
{
	pntActiveMtoNIdFieldName = mToNFormKey;
	pntOpenDialogFor(appDir, pntType, formkey, '');
}
//pntOpenDialogForMtoN
function pntSetDialogResult(formkey, id, label)
{
	var detailsForm;
	var labelfield;
	labelField = formkey+'Label';	
	detailsForm = document.getElementById('pntDetailsForm');	
	if (!detailsForm) return;
	detailsForm[formkey].value = id;
	detailsForm[formkey].title = label; //for easy label retrieval (css3 kaswoenk, kaswoenk, kaswoenk)
	detailsForm[labelField].value = label;
	detailsForm[formkey].extraInfo = arguments[3];	
	for (var i in pntSetDialogResultPostMethods)
	{
			var m = pntSetDialogResultPostMethods[i];
			m.call(this, formkey, id, label);
	}
	if (pntIsDefined(detailsForm[formkey].onchange)) detailsForm[formkey].onchange.call(detailsForm[formkey]);
}
function pntGetActiveHiddenMtoNFields()
{
	var retArray = new Array();
	if (pntActiveMtoNIdFieldName.length==0) return retArray;
	var hiddenFields = document.getElementsByClassName('pntDialogWidgetHiddenField');
	var idField = pntActiveMtoNIdFieldName + 'Id';
	for (var i=0; i<hiddenFields.length; i++)
	{
			if (hiddenFields[i].id.substr(0,idField.length+1)==idField+'-') retArray[retArray.length] = hiddenFields[i];
	}
	return retArray;
}
function pntGetUniqueMtoNIdsAndLabels()
{
	var retArray = new Array();
	if (pntActiveMtoNIdFieldName.length==0) return retArray;
	var hiddenFields = pntGetActiveHiddenMtoNFields();
	var had = new Array();
	for (var i=0; i<hiddenFields.length; i++)
	{
			var idValue = hiddenFields[i].value;
			var label =  hiddenFields[i].title;
			if ((idValue>0) && (!pntInArray(had,idValue)))
			{				
				var pair = new Object();				
				pair.id = idValue;
				pair.label =label;
				retArray[retArray.length] = pair;				
				had[had.length] = idValue;
			}			
	}	
	return retArray;
}
function pntRebuildMtoNFields()
{
		var had = new Array();
		var idLabelArray;
		idLabelArray = pntGetUniqueMtoNIdsAndLabels();		
		idLabelArray = sortIdLabelArray(idLabelArray);
		var containerDivName = 'pntMtoNWidgetContainer-' + pntActiveMtoNIdFieldName;
		var containerDiv = document.getElementById(containerDivName);
		var str = '';
		for (var i=0; i<=idLabelArray.length; i++)
		{
			str += pntGetMtoNEmptyRow(i);	
		}		
		containerDiv.innerHTML = str;
		for (var i=0; i<idLabelArray.length; i++)
		{
			var idFieldName = pntActiveMtoNIdFieldName+'Id-'+i;
			var labelFieldName = idFieldName+'Label';
			var idField = document.getElementById(idFieldName);
			var labelField = document.getElementById(labelFieldName);
			idField.value = idLabelArray[i].id;
			idField.title = idLabelArray[i].label;
			labelField.value = idLabelArray[i].label;
			if (pntIsDefined(idField.onchange)) idField.onchange.call(idField);
		}	
}
function pntRemoveMtoNFieldsFrom(start)
{
	var hiddenFields = pntGetActiveHiddenMtoNFields();
	if (start>hiddenFields.length) return;
	var containerDivName = 'pntMtoNWidgetContainer-' + pntActiveMtoNIdFieldName.replace('Id', '');
	var containerDiv = document.getElementById(containerDivName);
	for (var i=start; i<hiddenFields.length; i++)
	{
		var divName = 'pntDialogContainer-'+pntActiveMtoNIdFieldName+'-'+i;		
		var div = document.getElementById(divName);
		try {
			containerDiv.removeChild(div);
		} catch (strE)
		{
			containerDiv.removeChild(div.parentNode);
			document.getElementById('aantekeningen').innerHTML = containerDiv.innerHTML;
		}
	}
}
// SORTERING
function SortSpect(id, dir)
{
		this.id = id;
		this.dir = dir;
}
var sortSpec = new SortSpect(0,0);
function sort(sortDiv, dir, toSetPntActiveMtoNIdFieldName)
{	
	var id = retrieveIdFromSortDiv(sortDiv);	
	pntActiveMtoNIdFieldName = toSetPntActiveMtoNIdFieldName;
	sortSpec = new SortSpect(id,dir);
	pntRebuildMtoNFields();
	pntActiveMtoNIdFieldName = '';
}
function retrieveIdFromSortDiv(sortDiv)
{
	var container = sortDiv.parentNode.parentNode.parentNode;	
	var inputs = container.getElementsByTagName('input');	
	for (var i in inputs) {
		var input = inputs[i];
		if (input.className=='pntDialogWidgetHiddenField') return input.value;
	}
	return 0;
}
function sortFunc(a,b)
{
	if (a.sort<b.sort)  return -1;
	if (a.sort==b.sort) return 0;
	if (a.sort>b.sort) return 1;
}
function sortIdLabelArray(idArray)
{
	var ret = new Array();
	if (!pntIsDefined(sortSpec)) return idArray;
	var dir = sortSpec.dir;
	dir*= 3;
	var sortObjId = sortSpec.id;
	var sort = 0;	
	for (var i in idArray)
	{
		sort += 2;
		var rec = idArray[i];
		var siblingId = rec.id;				
		var newSortPos = (siblingId==sortObjId) ? (sort + dir) : sort;
		rec.sort = newSortPos;
		if (typeof(rec)=='object') {			
			ret[ret.length] = rec;
		}
	}
	ret.sort(sortFunc);	
	return ret;
}
function pntGetUniqueMtoNIds()
{
	var retArray = new Array();
	var idsAndLabels = pntGetUniqueMtoNIdsAndLabels();
	for (var i=0; i<idsAndLabels.length; i++)
	{
		retArray[retArray.length] = idsAndLabels[i].id;
	}
	return retArray;
}
function pntPostProcessMtoNDialogResult()
{
	if (pntActiveMtoNIdFieldName.length==0) return;
	var idArray = pntGetUniqueMtoNIds();
	var elemWithIds = document.getElementById(pntActiveMtoNIdFieldName);
	if (!pntIsDefined(elemWithIds)) return;
	elemWithIds.value = idArray.join(';');
	pntRebuildMtoNFields();
	//if (fillCount==dialogCount) pntAddMtoNEmptyRow(dialogCount+1);
	pntActiveMtoNIdFieldName = '';		
}
function pntGetMtoNEmptyRow(nr)
{
	var emptyRowStr = this['pntMtoNWidgetContainerEmptyRows_'+pntActiveMtoNIdFieldName];
	emptyRowStr = unescape(emptyRowStr);
	emptyRowStr = emptyRowStr.replace(/__NR__/g, nr);
	emptyRowStr = emptyRowStr.replace(/\+/g, ' ');
	return emptyRowStr;
}
function pntChangePageItemCount(value) {	
	document.cookie = "pntPageItemCount="+value+"; path=/";
	window.location.reload();
}
function pntInvertTableCheckboxes(aButton)
{
	var aTableSection = getParentNodeByTagName(aButton, 'TABLE');
	var elements = aTableSection.getElementsByTagName("input");
	for (i=0; i<elements.length; i++) {
		if (elements[i].type=="checkbox") {
			if (elements[i].checked) {
				elements[i].checked=false;
			} else {
				elements[i].checked=true;
			}
		}
	}
}
function pntFfpColSort( paths ) {
	var form = document.getElementById(pntFormName);		
	same = true;
	for (i=0; i<paths.length; i++) {
		element = form.elements['pntS' + (i+1)];
		if (element.value != paths[i]) same = false;
		element.value=paths[i];
	}
	if (same && form.elements['pntS1d'].value == 'ASC')
		direction = 'DESC';
	else
		direction = 'ASC';
	for (i=0; i<paths.length; i++) 
		form.elements['pntS' + (i+1) + 'd'].value = direction;
	form.pntSiS.value = '1';	
	performSearch();
}
function pntAddStyleSheetToHead(strUrl)
{
	if(document.createStyleSheet) document.createStyleSheet(strUrl);
	else {		
		var pntCssLink;
		pntCssLink = document.createElement('link');
		pntCssLink.type = "text/css";
		pntCssLink.rel = "stylesheet";		
		pntCssLink.href=strUrl;
		pntCssLink.media = "screen";		
		document.getElementsByTagName("head")[0].appendChild(pntCssLink);
	}
}
function pntAddScriptToHead(strUrl)
{
	var pntScriptSrc;
	pntScriptSrc = document.createElement('script');
	pntScriptSrc.type = "text/javascript";
	pntScriptSrc.src= strUrl;
	document.getElementsByTagName("head")[0].appendChild(pntScriptSrc);
}
function pntInitListboxesFocus()
{
		var elems = new Array();
		var classes = new Array('pntTextWidget', 'pntDateWidget', 'pntTextAreaWidget');
		for (var i in classes)
		{
			var className = classes[i];
			elems = elems.concat(document.getElementsByClassName(className));			
		}
		for (var i in elems)
		{
			pntAppendElementEventHandler(elems[i], 'onfocus', pntFormElemFocus);		
			pntAppendElementEventHandler(elems[i], 'onblur', pntFormElemBlur);					
		}
}
function pntFormElemFocus()
{		
	pntAddToClassName(this, 'focus');
}
function pntFormElemBlur()
{		
	pntRemoveFromClassName(this, 'focus');
}
function pntAddToClassName(elem, strClassName)
{
	if (!elem) return;
	var classNames = elem.className.split(' ');
	classNames[classNames.length] = strClassName;
	elem.className = classNames.join(' ');	
}
function pntRemoveFromClassName(elem, strClassName)
{
	if (!elem) return;
	var classNames = elem.className.split(' ');
	var newClassNames = new Array();
	for (var i in classNames)
	{
		var className = classNames[i];
		if (className!=strClassName) newClassNames[newClassNames.length] = className;
	}	
	elem.className = newClassNames.join(' ');	
}
function pntAppendElementEventHandler(elem,eventName,eventHandler)
{	
	var thisScope = arguments[3];
	var currentEventHandler = elem[eventName];
	if (!currentEventHandler) {
		elem[eventName] = eventHandler;
		return;
	}
	var anomFunction = function()
	{		
		currentEventHandler.apply(elem, arguments);
		if (!pntIsDefined(thisScope)) thisScope = elem;
		eventHandler.apply(thisScope, arguments);
	}
	elem[eventName] = anomFunction;
}
function pntAppendToInit(appendFunc)
{
	var orgFunc;
	orgFunc = pntExtraInitFunctions;
	var anomFunction = function()
	{		
		orgFunc.call();
		appendFunc.call();		
	}
	pntExtraInitFunctions = anomFunction;
}
function pntDialogResize()
{		
	var position = pntGetElementPosition(document.getElementById('pntButtonsPanelPart'));
	var buttonTop = position.y;	
	if (buttonTop == 0 ) return;
	if (!pntIsDefined(window.opener)) return;
	var dimensions = window.opener.pntGetWindowInnerDimensions();
	var maxHeight = dimensions.height;
	var newY = buttonTop + pntDialogHeightOffset+30;
	if (newY>maxHeight) newY = maxHeight;	
	window.resizeTo(940, newY);	
}
function pntGetWindowInnerDimensions()
{
	var point = new Object();
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  point.width = myWidth;
  point.height = myHeight;
  return point;
}
function pntGetWindowPosition()
{
	var point = new Object();
  if (document.all) {
    var x = window.screenLeft;
    var y = window.screenTop;
  }
  else {
    var x = window.screenX;
    var y = window.screenY;
  }
	point.left= x;
  point.top = y;
  return point;
}
function pntGetElementPosition(obj)
{
	var point = new Object();
	var curleft = curtop = 0;
	if (obj) {
		if (obj.offsetParent) {
			curleft = obj.offsetLeft
			curtop = obj.offsetTop
			while (obj = obj.offsetParent) {
				curleft += obj.offsetLeft
				curtop += obj.offsetTop
			}
		}
	}
	point.x = curleft;
  point.y = curtop;
  return point;
}
function pntInspect(what) {
    var output = '';
    for (var i in what)
        output += i+ ' = ' + what[i] + '\r\n';
    return(output);
}
function pntUrlEncode( str ) {                                     
    var histogram = {}, histogram_r = {}, code = 0, tmp_arr = [];
    var ret = str.toString();
    var replacer = function(search, replace, str) {
        var tmp_arr = [];
        tmp_arr = str.split(search);
        return tmp_arr.join(replace);
    };
    // The histogram is identical to the one in urldecode.
    histogram['!']   = '%21';
    histogram['%20'] = '+';
    // Begin with encodeURIComponent, which most resembles PHP's encoding functions
    ret = encodeURIComponent(ret);
    for (search in histogram) {
        replace = histogram[search];
        ret = replacer(search, replace, ret) // Custom replace. No regexing
    }
    // Uppercase for full PHP compatibility
    return ret.replace(/(\%([a-z0-9]{2}))/g, function(full, m1, m2) {
        return "%"+m2.toUpperCase();
    });
    return ret;
}
function pntGetRequestParam(key)
{
	requestData = pntGetRequestData();
	try 
	{
		var value = requestData[key];
	}
	catch (E)
	{
		return '';
	}
	if (value) return value;
	return '';
}
function pntRequestDataToQueryString(req)
{	
	var output = '';
  for (var i in req)
  {
   	if (req[i]) output += i+ '=' + req[i] + '&';
  }
  if (output.length>0) output = output.substr(0,output.length-1);
  return output;
}
function pntGetRequestData()
{	
  FORM_DATA = new Object();
    // The Object ("Array") where our data will be stored.
  separator = ',';
    // The token used to separate data from multi-select inputs
  query = '' + this.location;
  qu = query
    // Get the current URL so we can parse out the data.
    // Adding a null-string '' forces an implicit type cast
    // from property to string, for NS2 compatibility.
  query = query.substring((query.indexOf('?')) + 1);
    // Keep everything after the question mark '?'.
  if (query.length < 1) { return false; }  // Perhaps we got some bad data?
  keypairs = new Object();
  numKP = 1;
    // Local vars used to store and keep track of name/value pairs
    // as we parse them back into a usable form.
  while (query.indexOf('&') > -1) {
    keypairs[numKP] = query.substring(0,query.indexOf('&'));
    query = query.substring((query.indexOf('&')) + 1);
    numKP++;
      // Split the query string at each '&', storing the left-hand side
      // of the split in a new keypairs[] holder, and chopping the query
      // so that it gets the value of the right-hand string.
  }
  keypairs[numKP] = query;
    // Store what's left in the query string as the final keypairs[] data.<
  for (i in keypairs) {
    keyName = keypairs[i].substring(0,keypairs[i].indexOf('='));
      // Left of '=' is name.
    keyValue = keypairs[i].substring((keypairs[i].indexOf('=')) + 1);
      // Right of '=' is value.
    while (keyValue.indexOf('+') > -1) {
      keyValue = keyValue.substring(0,keyValue.indexOf('+')) + ' ' + keyValue.substring(keyValue.indexOf('+') + 1);
        // Replace each '+' in data string with a space.
    }
    keyValue = unescape(keyValue);
      // Unescape non-alphanumerics
    if (FORM_DATA[keyName]) {
      FORM_DATA[keyName] = FORM_DATA[keyName] + separator + keyValue;
        // Object already exists, it is probably a multi-select input,
        // and we need to generate a separator-delimited string
        // by appending to what we already have stored.
    } else {
      FORM_DATA[keyName] = keyValue;
        // Normal case: name gets value.
    }
  }
  return FORM_DATA;
}
function pntShowProfilingInfoDiv()
{
	document.getElementById('pntProfilingInfoDiv').style.visibility = 'visible';
}
function pntUsernameFocus()
{
	if (!pntUsernamePropname) return;
	var elem = document.getElementById(pntUsernamePropname);
	if (!elem) return;
	try
	{
		elem.focus();	
	}
	catch(err)
	{		
		//focus can't be set if element is not (yet) visible 
		//which is the case for instance if the PntDgTabs haven't been fully initialized
		pntUsernamePropnameTryCnt++;
		if (pntUsernamePropnameTryCnt<5) {			
			var t = setTimeout("pntUsernameFocus()", 200);
		}
	} 	
}
function pntToggleTableOptions() {
	var elem = document.getElementById('pntTableMoreOptionsDiv');
	if (!elem) return;
	elem.style.display = (elem.style.display =='block') ? "none" : "block";
	var img = document.getElementById('pntTableInfoImage');
	if (!img) return;
	img.src = (img.src.search(/pntASC.gif/)>-1) ? "../pnt/images/pntDESC.gif" : "../pnt/images/pntASC.gif";
}
function pntExport() {
	var aForm = document.getElementById('pntItemTableForm');
	var oldTarget = aForm.target;
	var oldHandler = aForm.pntHandler.value;
	var oldMethod = aForm.method;
	aForm.method='post';
	aForm.target='_blank';
	aForm.pntHandler.value='ExportPage';
	var input = document.createElement('input');
	input.name = 'pntOrigRequest';
	input.value = this.location.search;
	input.type = 'hidden';
	aForm.appendChild(input);
	aForm.submit();
	aForm.removeChild(input);
	aForm.method=oldMethod;
	aForm.target=oldTarget;
	aForm.pntHandler.value=oldHandler;
}
function pntIsDefined()
{
	if ((!arguments[0]) || (typeof(arguments[0])=="undefined")) return false;
	return true;
}
function pntAlphanumOnly(str) {
	var allowedChars = ' -_';
	if (pntIsDefined(arguments[1])) allowedChars =arguments[1];
	ret="";
	chars = new Array();
	chars[chars.length] = String.fromCharCode(' ');
	chars[chars.length] = String.fromCharCode('-');
	chars[chars.length] = String.fromCharCode('_');
	for (var i=0; i<str.length; i++) {
		var char = str.substr(i,1);		
		charCode = char.charCodeAt(0);
		if (
			   ((charCode>=48) && (charCode<=57)) ||
			   ((charCode>=65) && (charCode<=122)) ||
			   ((charCode>=97) && (charCode<=90)) ||			   
			   (allowedChars.indexOf(char)>=0)
		   ) {
			ret+= char;
		}
	}	
	return ret;
}
function pntInArray(haystack, needle)
{
	if (!pntIsDefined(haystack)) return false;
	if (!pntIsDefined(needle)) return false;
	for (var i in haystack)
	{
			var elem = haystack[i];
			if (elem == needle) return true;			
	}
	return false;
}
function pntGetFormElementValuesFrom(elem)
{
	var ret = new Array();
	if (!pntIsDefined(elem)) return ret;
	var elems = elem.getElementsByTagName('input');
	for (var i=0; i<elems.length; i++)
	{
		var formElem = elems[i];		
		if ((typeof(formElem.name) != 'undefined') && (formElem.name.length>0)){
			var name = formElem.name;
			if (((formElem.type == 'checkbox') || (formElem.type == 'radio')) && (formElem.checked))
			{
				ret[name] = formElem.value;
			} else if ((formElem.type == 'text') || (formElem.type == 'hidden'))
			{
				ret[name] = formElem.value;
			}
		}
	}
	var elems = elem.getElementsByTagName('textarea');
	for (var i=0; i<elems.length; i++)
	{
		var formElem = elems[i];
		if ((typeof(formElem.name) != 'undefined') && (formElem.name.length>0)){
			var name = formElem.name;		
			ret[name] = formElem.value;
		}
	}
	var elems = elem.getElementsByTagName('select');
	for (var i=0; i<elems.length; i++)
	{
		var formElem = elems[i];
		if ((typeof(formElem.name) != 'undefined') && (formElem.name.length>0))
		{
			var name = formElem.name;		
			ret[name] = formElem.options[formElem.options.selectedIndex].value;
		}
	}
	return ret;
}
String.prototype.ucfirst = function()
{   
    var f = this.charAt(0).toUpperCase();
    return f + this.substr(1);
}
String.prototype.ucwords = function()
{   
	return (this+'').replace(/^(.)|\s(.)/g, function ( $1 ) { return $1.toUpperCase ( ); } );
}
String.prototype.trim = function()
{
	var l=0; var r=this.length -1;
	while(l < this.length && this[l] == ' ')
	{	l++; }
	while(r > l && this[r] == ' ')
	{	r-=1;	}
	return this.substring(l, r+1);
}
function pntCRC32 (str) {
	function Utf8Encode(string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";
		for (var n = 0; n < string.length; n++) {
			var c = string.charCodeAt(n);
			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}
		}
		return utftext;
	};
	str = Utf8Encode(str);
	var table = "00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D";
	if (typeof(crc) == "undefined") { crc = 0; }
	var x = 0;
	var y = 0;
	crc = crc ^ (-1);
	for( var i = 0, iTop = str.length; i < iTop; i++ ) {
		y = ( crc ^ str.charCodeAt( i ) ) & 0xFF;
		x = "0x" + table.substr( y * 9, 8 );
		crc = ( crc >>> 8 ) ^ x;
	}
	return crc ^ (-1);
};
function pntSetCookie (name, value, path)
{
	var strCookie = name+'='+value+'; path='+path;	
	document.cookie = strCookie;
}
function pntGetCookie (name) {
	var cookies = pntGetCookies();
	if (!pntIsDefined(cookies)) return;
	if (!pntIsDefined(cookies[name])) return;
	return cookies[name];	
}
function pntGetCookies()
{
	var returnArray = new Array();
	var strCookies = document.cookie;
	if (!pntIsDefined(strCookies)) strCookies = '';	
	var arrayCookies = strCookies.split('; ');
	for (var i=0; i<arrayCookies.length; i++)
	{
		var strCookieParts = arrayCookies[i];
		var cookieParts = strCookieParts.split('=');
		var cookieName = cookieParts[0];
		var cookieValue = unescape(cookieParts[1]);
		returnArray[cookieName] = cookieValue;
	}
	return returnArray;
}
//parameter updateMap is optional, array with ids of elements to update by 
//ids of updateElements expected from the server. If the id of an updateElement 
//is not in the updateMap, it will be used directly as the id of the element to be updated.
//for GET make postQuery null, for POST otherwise pass the queryString
function pntAjaxRequest(theUrl, postQuery, updateMap) {
    var httpReq;
    if (window.XMLHttpRequest) { 
        httpReq = new XMLHttpRequest();
        if (httpReq.overrideMimeType) {
            httpReq.overrideMimeType('text/xml');
        }
    } 
    if (!httpReq && window.ActiveXObject) {
        try {	httpReq = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
        	try {	httpReq = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }
    if (!httpReq) {
        alert('AJAX error: Can not create XMLHTTP object');
        return false;
    }
    //alert(theUrl);
    httpReq.onreadystatechange = function() { pntAjaxReadyStateChanged(httpReq, updateMap); };
    if (postQuery) {
    	httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    	httpReq.open('POST', theUrl, true);
    } else {
        httpReq.open('GET', theUrl, true);
    }
    httpReq.send(postQuery);
//alert('request sent: ' + theUrl);
}
function pntAjaxReadyStateChanged(httpReq, updateMap) {
	var xmldoc;
    try {
        if (httpReq.readyState != 4) {
        	return;
        }
        if (httpReq.status == 200) {
	    	xmldoc = httpReq.responseXML;
	    	if (xmldoc.childNodes.length == 0 || xmldoc.firstChild.nodeName == 'parsererror') {
				alert("AJAX response XML parse error\n\n" + httpReq.responseText);
				return;
			}
        } else {
            alert('AJAX Request Error, Statuscode: ' + httpReq.status);
        }
    } catch( e ) {
        alert('AJAX response error: ' + e.description);
    }
    pntAjaxProcessXml(xmldoc, updateMap);
}
function pntAjaxProcessXml(xmldoc, updateMap) {
	var updates = xmldoc.getElementsByTagName('updateElement');
	for (var i=0; i<updates.length; i++) {
		var update = updates.item(i);
		var idToUpdate = update.getAttribute('id');
		if (updateMap && updateMap[idToUpdate]) 
			idToUpdate = updateMap[idToUpdate];
		pntAjaxUpdateElement(update, idToUpdate);
	}
}
function pntAjaxUpdateElement(update, idToUpdate) {
	var el = document.getElementById(idToUpdate);
	if (el) {
		var dataFound = pntAjaxCopyAttributes(update.attributes, el, 'id');
		//process content CDATA
		var updChilds = update.childNodes;
		for (var j=0; j<updChilds.length; j++) {
			if (updChilds[j].nodeType==4) { //CDATA
				dataFound = true;
				el.innerHTML = updChilds[j].data;
			}
		}
		if (!dataFound) {
			alert("AJAX Error: updateElement without data: '"+ update.getAttribute('id') + "'");
		}
	} else {
		alert("AJAX Error: Element to be updated not found: '" + update.getAttribute('id') + "'");
	}
}
function pntAjaxCopyAttributes(atts, htmlEl, ignore) {
	var dataFound = false;
	for (var j=0; j<atts.length; j++) {
		if (atts[j].nodeName != ignore) {
			dataFound = true;
			if (atts[j].nodeName.substring(0, 6) == 'style.') {
				var statt = atts[j].nodeName.substring(6);
				htmlEl.style[statt] = atts[j].nodeValue;
			} else {
				htmlEl.setAttribute(atts[j].nodeName, atts[j].nodeValue);
			}
		}
	}
	return dataFound;
}
// disable button for a couple of seconds
function pntButtonPostpone(input) {
	input.disabled=true;
	pntAddToClassName(input,'Ghost');
	if (input.id.length==0) {
		input.id = 'but'+Math.floor(Math.random()*12);
	}
	window.setTimeout('pntButtonEnable("'+ input.id+'")', 2000);
}
function pntButtonEnable(inputId) {
	var elem = document.getElementById(inputId);
	if (!elem) return;
	elem.disabled=false;
	pntRemoveFromClassName(elem, 'Ghost');
}
function pntIsIE6() {
	if (!(navigator.appVersion.indexOf('MSIE'))) return false;
	var version = parseFloat(navigator.appVersion.split('MSIE')[1]);
	return (version==6);
}
function pntUpdateInformationPart(pntInfoMessage) {
		if (!pntIsDefined(pntInfoMessage)) return;
		if (!typeof(pntInfoMessage)=='object') return;
		var wrapper = document.getElementById('pntInformationPartWrapper');
		if (!pntIsDefined(wrapper)) return;
		wrapper.className = 'pnt'+pntInfoMessage.infoType;
		$('#pntInformationPartWrapper').hide();
		$('#pntInformationPartWrapper').slideDown('fast');
		var labeldiv = document.getElementById('pntInfoLabel');
		if (!pntIsDefined(labeldiv)) return;
		labeldiv.innerHTML = pntInfoMessage.infoLabel;
		var informationdiv = document.getElementById('pntInformation');
		if (!pntIsDefined(informationdiv)) return;
		var informationArray = pntInfoMessage.infoArray;
		if (informationArray.length == 0) return;
		var strLis = '';
		for (var formKey in informationArray) {
			var message = informationArray[formKey];
			if (message.length>0) strLis += '<li>'+message+'</li>';
		}
		if (strLis.length>0) informationdiv.innerHTML = '<ul>'+strLis+'</ul>';
}
function pntClearInformationPart() {
		$('#pntInformationPartWrapper').slideUp('fast',function(){
		var wrapper = document.getElementById('pntInformationPartWrapper');
		if (pntIsDefined(wrapper)) wrapper.className = 'pntNONE';
		var labeldiv = document.getElementById('pntInfoLabel');
		if (pntIsDefined(labeldiv)) labeldiv.innerHTML = '';
		var informationdiv = document.getElementById('pntInformation');
		if (pntIsDefined(informationdiv)) informationdiv.innerHTML = '';
			});
}
function pntGetFirstIdForClassName(strClassName) {
	var elems = document.getElementsByClassName(strClassName);
	for (var i=0; i<elems.length; i++) {
		var elem = elems[i];		
		if ((pntIsDefined(elem.id)) && (elem.id.length>0)) return elem.id;
	}
	return '';
}/* --- BoxOver ---
/* --- v 2.1 17th June 2006
By Oliver Bryant with help of Matthew Tagg
http://boxover.swazz.org */
if (typeof document.attachEvent!='undefined') {
   //window.attachEvent('onload',init);
   document.attachEvent('onmousemove',moveMouse);
   document.attachEvent('onclick',checkMove); }
else {
   //window.addEventListener('load',init,false);
   document.addEventListener('mousemove',moveMouse,false);
   document.addEventListener('click',checkMove,false);
}
var oDv=document.createElement("div");
var dvHdr=document.createElement("div");
var dvBdy=document.createElement("div");
var windowlock,boxMove,fixposx,fixposy,lockX,lockY,fixx,fixy,ox,oy,boxLeft,boxRight,boxTop,boxBottom,evt,mouseX,mouseY,boxOpen,totalScrollTop,totalScrollLeft;
boxOpen=false;
ox=10;
oy=10;
lockX=0;
lockY=0;
function initBoxOver() {
	oDv.appendChild(dvHdr);
	oDv.appendChild(dvBdy);
	oDv.style.position="absolute";
	oDv.style.visibility='hidden';
	oDv.style.zIndex=999;
	document.body.appendChild(oDv);	
}
function defHdrStyle() {	
	dvHdr.style.fontWeight='bold';
	dvHdr.style.width='150px';
	dvHdr.style.fontFamily='arial';
	dvHdr.style.border='1px solid #2F5282';
	dvHdr.style.padding='3px';
	dvHdr.style.fontSize='11px';
	dvHdr.style.color='#ffffff';
	dvHdr.style.textAlign='left';
	dvHdr.style.background='#2F5282';	
}
function defBdyStyle() {
	dvBdy.style.borderBottom='1px solid #2F5282';
	dvBdy.style.borderLeft='1px solid #2F5282';
	dvBdy.style.borderRight='1px solid #2F5282';
	dvBdy.style.textAlign='left';
	dvBdy.style.width='150px';	
	dvBdy.style.fontFamily='arial';
	dvBdy.style.fontSize='11px';
	dvBdy.style.padding='3px';
	dvBdy.style.color='#1B4966';
	dvBdy.style.background='#FFFFFF';	
}
function checkElemBO(txt) {
if (!txt || typeof(txt) != 'string') return false;
if ((txt.indexOf('header')>-1)&&(txt.indexOf('body')>-1)&&(txt.indexOf('[')>-1)&&(txt.indexOf('[')>-1)) 
   return true;
else
   return false;
}
function scanBO(curNode) {
	  if (checkElemBO(curNode.title)) {
         curNode.boHDR=getParam('header',curNode.title);
         curNode.boBDY=getParam('body',curNode.title);
			curNode.boCSSBDY=getParam('cssbody',curNode.title);			
			curNode.boCSSHDR=getParam('cssheader',curNode.title);			
			curNode.IEbugfix=(getParam('hideselects',curNode.title)=='on')?true:false;			
			curNode.fixX=parseInt(getParam('fixedrelx',curNode.title));
			curNode.fixY=parseInt(getParam('fixedrely',curNode.title));
			curNode.absX=parseInt(getParam('fixedabsx',curNode.title));
			curNode.absY=parseInt(getParam('fixedabsy',curNode.title));
			curNode.offY=(getParam('offsety',curNode.title)!='')?parseInt(getParam('offsety',curNode.title)):10;
			curNode.offX=(getParam('offsetx',curNode.title)!='')?parseInt(getParam('offsetx',curNode.title)):10;
			curNode.fade=(getParam('fade',curNode.title)=='on')?true:false;
			curNode.fadespeed=(getParam('fadespeed',curNode.title)!='')?getParam('fadespeed',curNode.title):0.04;
			curNode.delay=(getParam('delay',curNode.title)!='')?parseInt(getParam('delay',curNode.title)):0;
			if (getParam('requireclick',curNode.title)=='on') {
				curNode.requireclick=true;
				document.all?curNode.attachEvent('onclick',showHideBox):curNode.addEventListener('click',showHideBox,false);
				document.all?curNode.attachEvent('onmouseover',hideBox):curNode.addEventListener('mouseover',hideBox,false);
			}
			else {// Note : if requireclick is on the stop clicks are ignored   			
   			if (getParam('doubleclickstop',curNode.title)!='off') {
   				document.all?curNode.attachEvent('ondblclick',pauseBox):curNode.addEventListener('dblclick',pauseBox,false);
   			}	
   			if (getParam('singleclickstop',curNode.title)=='on') {
   				document.all?curNode.attachEvent('onclick',pauseBox):curNode.addEventListener('click',pauseBox,false);
   			}
   		}
			curNode.windowLock=getParam('windowlock',curNode.title).toLowerCase()=='off'?false:true;
			curNode.title='';
			curNode.hasbox=1;
	   }
	   else
	      curNode.hasbox=2;   
}
function getParam(param,list) {
	var reg = new RegExp('([^a-zA-Z]' + param + '|^' + param + ')\\s*=\\s*\\[\\s*(((\\[\\[)|(\\]\\])|([^\\]\\[]))*)\\s*\\]');
	var res = reg.exec(list);
	var returnvar;
	if(res)
		return res[2].replace('[[','[').replace(']]',']');
	else
		return '';
}
function Left(elem){	
	var x=0;
	if (elem.calcLeft)
		return elem.calcLeft;
	var oElem=elem;
	while(elem){
		 if ((elem.currentStyle)&& (!isNaN(parseInt(elem.currentStyle.borderLeftWidth)))&&(x!=0))
		 	x+=parseInt(elem.currentStyle.borderLeftWidth);
		 x+=elem.offsetLeft;
		 elem=elem.offsetParent;
	  } 
	oElem.calcLeft=x;
	return x;
	}
function Top(elem){
	 var x=0;
	 if (elem.calcTop)
	 	return elem.calcTop;
	 var oElem=elem;
	 while(elem){		
	 	 if ((elem.currentStyle)&& (!isNaN(parseInt(elem.currentStyle.borderTopWidth)))&&(x!=0))
		 	x+=parseInt(elem.currentStyle.borderTopWidth); 
		 x+=elem.offsetTop;
	         elem=elem.offsetParent;
 	 } 
 	 oElem.calcTop=x;
 	 return x;
}
var ah,ab;
function applyStyles() {
	if(ab)
		oDv.removeChild(dvBdy);
	if (ah)
		oDv.removeChild(dvHdr);
	dvHdr=document.createElement("div");
	dvBdy=document.createElement("div");
	CBE.boCSSBDY?dvBdy.className=CBE.boCSSBDY:defBdyStyle();
	CBE.boCSSHDR?dvHdr.className=CBE.boCSSHDR:defHdrStyle();
	dvHdr.innerHTML=CBE.boHDR;
	dvBdy.innerHTML=CBE.boBDY;
	ah=false;
	ab=false;
	if (CBE.boHDR!='') {		
		oDv.appendChild(dvHdr);
		ah=true;
	}	
	if (CBE.boBDY!=''){
		oDv.appendChild(dvBdy);
		ab=true;
	}	
}
var CSE,iterElem,LSE,CBE,LBE, totalScrollLeft, totalScrollTop, width, height ;
var ini=false;
// Customised function for inner window dimension
function SHW() {
   if (document.body && (document.body.clientWidth !=0)) {
      width=document.body.clientWidth;
      height=document.body.clientHeight;
   }
   if (document.documentElement && (document.documentElement.clientWidth!=0) && (document.body.clientWidth + 20 >= document.documentElement.clientWidth)) {
      width=document.documentElement.clientWidth;   
      height=document.documentElement.clientHeight;   
   }   
   return [width,height];
}
var ID=null;
function moveMouse(e) {
   //boxMove=true;
	e?evt=e:evt=event;
	CSE=evt.target?evt.target:evt.srcElement;
	if (!CSE.hasbox) {
	   // Note we need to scan up DOM here, some elements like TR don't get triggered as srcElement
	   iElem=CSE;
	   while ((iElem.parentNode) && (!iElem.hasbox)) {
	      scanBO(iElem);
	      iElem=iElem.parentNode;
	   }	   
	}
	if ((CSE!=LSE)&&(!isChild(CSE,dvHdr))&&(!isChild(CSE,dvBdy))){		
	   if (!CSE.boxItem) {
			iterElem=CSE;
			while ((iterElem.hasbox==2)&&(iterElem.parentNode))
					iterElem=iterElem.parentNode; 
			CSE.boxItem=iterElem;
			}
		iterElem=CSE.boxItem;
		if (CSE.boxItem&&(CSE.boxItem.hasbox==1))  {
			LBE=CBE;
			CBE=iterElem;
			if (CBE!=LBE) {
				applyStyles();
				if (!CBE.requireclick)
					if (CBE.fade) {
						if (ID!=null)
							clearTimeout(ID);
						ID=setTimeout("fadeIn("+CBE.fadespeed+")",CBE.delay);
					}
					else {
						if (ID!=null)
							clearTimeout(ID);
						COL=1;
						ID=setTimeout("oDv.style.visibility='visible';ID=null;",CBE.delay);						
					}
				if (CBE.IEbugfix) {hideSelects();} 
				fixposx=!isNaN(CBE.fixX)?Left(CBE)+CBE.fixX:CBE.absX;
				fixposy=!isNaN(CBE.fixY)?Top(CBE)+CBE.fixY:CBE.absY;			
				lockX=0;
				lockY=0;
				boxMove=true;
				ox=CBE.offX?CBE.offX:10;
				oy=CBE.offY?CBE.offY:10;
			}
		}
		else if (!isChild(CSE,dvHdr) && !isChild(CSE,dvBdy) && (boxMove))	{
			// The conditional here fixes flickering between tables cells.
			if ((!isChild(CBE,CSE)) || (CSE.tagName!='TABLE')) {   			
   			CBE=null;
   			if (ID!=null)
  					clearTimeout(ID);
   			fadeOut();
   			showSelects();
			}
		}
		LSE=CSE;
	}
	else if (((isChild(CSE,dvHdr) || isChild(CSE,dvBdy))&&(boxMove))) {
		totalScrollLeft=0;
		totalScrollTop=0;
		iterElem=CSE;
		while(iterElem) {
			if(!isNaN(parseInt(iterElem.scrollTop)))
				totalScrollTop+=parseInt(iterElem.scrollTop);
			if(!isNaN(parseInt(iterElem.scrollLeft)))
				totalScrollLeft+=parseInt(iterElem.scrollLeft);
			iterElem=iterElem.parentNode;			
		}
		if (CBE!=null) {
			boxLeft=Left(CBE)-totalScrollLeft;
			boxRight=parseInt(Left(CBE)+CBE.offsetWidth)-totalScrollLeft;
			boxTop=Top(CBE)-totalScrollTop;
			boxBottom=parseInt(Top(CBE)+CBE.offsetHeight)-totalScrollTop;
			doCheck();
		}
	}
	if (boxMove&&CBE) {
		// This added to alleviate bug in IE6 w.r.t DOCTYPE
		bodyScrollTop=document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;
		bodyScrollLet=document.documentElement&&document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft;
		mouseX=evt.pageX?evt.pageX-bodyScrollLet:evt.clientX-document.body.clientLeft;
		mouseY=evt.pageY?evt.pageY-bodyScrollTop:evt.clientY-document.body.clientTop;
		if ((CBE)&&(CBE.windowLock)) {
			mouseY < -oy?lockY=-mouseY-oy:lockY=0;
			mouseX < -ox?lockX=-mouseX-ox:lockX=0;
			mouseY > (SHW()[1]-oDv.offsetHeight-oy)?lockY=-mouseY+SHW()[1]-oDv.offsetHeight-oy:lockY=lockY;
			mouseX > (SHW()[0]-dvBdy.offsetWidth-ox)?lockX=-mouseX-ox+SHW()[0]-dvBdy.offsetWidth:lockX=lockX;			
		}
		oDv.style.left=((fixposx)||(fixposx==0))?fixposx:bodyScrollLet+mouseX+ox+lockX+"px";
		oDv.style.top=((fixposy)||(fixposy==0))?fixposy:bodyScrollTop+mouseY+oy+lockY+"px";		
	}
}
function doCheck() {	
	if (   (mouseX < boxLeft)    ||     (mouseX >boxRight)     || (mouseY < boxTop) || (mouseY > boxBottom)) {
		if (!CBE.requireclick)
			fadeOut();
		if (CBE.IEbugfix) {showSelects();}
		CBE=null;
	}
}
function pauseBox(e) {
   e?evt=e:evt=event;
	boxMove=false;
	evt.cancelBubble=true;
}
function showHideBox(e) {
	oDv.style.visibility=(oDv.style.visibility!='visible')?'visible':'hidden';
}
function hideBox(e) {
	oDv.style.visibility='hidden';
}
var COL=0;
var stopfade=false;
function fadeIn(fs) {
		ID=null;
		COL=0;
		oDv.style.visibility='visible';
		fadeIn2(fs);
}
function fadeIn2(fs) {
		COL=COL+fs;
		COL=(COL>1)?1:COL;
		oDv.style.filter='alpha(opacity='+parseInt(100*COL)+')';
		oDv.style.opacity=COL;
		if (COL<1)
		 setTimeout("fadeIn2("+fs+")",20);		
}
function fadeOut() {
	oDv.style.visibility='hidden';
}
function isChild(s,d) {
	while(s) {
		if (s==d) 
			return true;
		s=s.parentNode;
	}
	return false;
}
var cSrc;
function checkMove(e) {
	e?evt=e:evt=event;
	cSrc=evt.target?evt.target:evt.srcElement;
	if ((!boxMove)&&(!isChild(cSrc,oDv))) {
		fadeOut();
		if (CBE&&CBE.IEbugfix) {showSelects();}
		boxMove=true;
		CBE=null;
	}
}
function showSelects(){
   var elements = document.getElementsByTagName("select");
   for (i=0;i< elements.length;i++){
      elements[i].style.visibility='visible';
   }
}
function hideSelects(){
   var elements = document.getElementsByTagName("select");
   for (i=0;i< elements.length;i++){
   elements[i].style.visibility='hidden';
   }
}var isFormDirty = false;
function goToConfirm(strUrl)
{	
	document.getElementById('conTargetUrl').value = strUrl;
	document.getElementById('pntDetailsForm').submit();
}
function conPopUp(strUrl)
{
	popUp(strUrl,800,500,100,75);
}
function pntIsDefined(elem)
{
	if ((!elem) || (typeof(elem)=="undefined")) return false;
	return true;
}
function init() {	
	initBoxOver();	
	pntExtraInitFunctions();
}
if (document.addEventListener) {
	document.addEventListener("DOMContentLoaded", init, false);
} else {
	  document.onreadystatechange = function() {
  	if (this.readyState == "complete") {
			init();
  	}
 	}
}
/*
    json2.js
    2008-02-14
    Public Domain
    No warranty expressed or implied. Use at your own risk.
    See http://www.JSON.org/js.html
    This file creates a global JSON object containing two methods:
        JSON.stringify(value, whitelist)
            value       any JavaScript value, usually an object or array.
            whitelist   an optional array parameter that determines how object
                        values are stringified.
            This method produces a JSON text from a JavaScript value.
            There are three possible ways to stringify an object, depending
            on the optional whitelist parameter.
            If an object has a toJSON method, then the toJSON() method will be
            called. The value returned from the toJSON method will be
            stringified.
            Otherwise, if the optional whitelist parameter is an array, then
            the elements of the array will be used to select members of the
            object for stringification.
            Otherwise, if there is no whitelist parameter, then all of the
            members of the object will be stringified.
            Values that do not have JSON representaions, such as undefined or
            functions, will not be serialized. Such values in objects will be
            dropped; in arrays will be replaced with null.
            JSON.stringify(undefined) returns undefined. Dates will be
            stringified as quoted ISO dates.
            Example:
            var text = JSON.stringify(['e', {pluribus: 'unum'}]);
            // text is '["e",{"pluribus":"unum"}]'
        JSON.parse(text, filter)
            This method parses a JSON text to produce an object or
            array. It can throw a SyntaxError exception.
            The optional filter parameter is a function that can filter and
            transform the results. It receives each of the keys and values, and
            its return value is used instead of the original value. If it
            returns what it received, then structure is not modified. If it
            returns undefined then the member is deleted.
            Example:
            // Parse the text. If a key contains the string 'date' then
            // convert the value to a date.
            myData = JSON.parse(text, function (key, value) {
                return key.indexOf('date') >= 0 ? new Date(value) : value;
            });
    This is a reference implementation. You are free to copy, modify, or
    redistribute.
    Use your own copy. It is extremely unwise to load third party
    code into your pages.
*/
/*jslint evil: true */
/*global JSON */
/*members "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
    charCodeAt, floor, getUTCDate, getUTCFullYear, getUTCHours,
    getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, length,
    parse, propertyIsEnumerable, prototype, push, replace, stringify, test,
    toJSON, toString
*/
if (!this.JSON) {
    JSON = function () {
        function f(n) {    // Format integers to have at least two digits.
            return n < 10 ? '0' + n : n;
        }
        Date.prototype.toJSON = function () {
// Eventually, this method will be based on the date.toISOString method.
            return this.getUTCFullYear()   + '-' +
                 f(this.getUTCMonth() + 1) + '-' +
                 f(this.getUTCDate())      + 'T' +
                 f(this.getUTCHours())     + ':' +
                 f(this.getUTCMinutes())   + ':' +
                 f(this.getUTCSeconds())   + 'Z';
        };
        var m = {    // table of character substitutions
            '\b': '\\b',
            '\t': '\\t',
            '\n': '\\n',
            '\f': '\\f',
            '\r': '\\r',
            '"' : '\\"',
            '\\': '\\\\'
        };
        function stringify(value, whitelist) {
            var a,          // The array holding the partial texts.
                i,          // The loop counter.
                k,          // The member key.
                l,          // Length.
                r = /["\\\x00-\x1f\x7f-\x9f]/g,
                v;          // The member value.
            switch (typeof value) {
            case 'string':
// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe sequences.
                return r.test(value) ?
                    '"' + value.replace(r, function (a) {
                        var c = m[a];
                        if (c) {
                            return c;
                        }
                        c = a.charCodeAt();
                        return '\\u00' + Math.floor(c / 16).toString(16) +
                                                   (c % 16).toString(16);
                    }) + '"' :
                    '"' + value + '"';
            case 'number':
// JSON numbers must be finite. Encode non-finite numbers as null.
                return isFinite(value) ? String(value) : 'null';
            case 'boolean':
            case 'null':
                return String(value);
            case 'object':
// Due to a specification blunder in ECMAScript,
// typeof null is 'object', so watch out for that case.
                if (!value) {
                    return 'null';
                }
// If the object has a toJSON method, call it, and stringify the result.
                if (typeof value.toJSON === 'function') {
                    return stringify(value.toJSON());
                }
                a = [];
                if (typeof value.length === 'number' &&
                        !(value.propertyIsEnumerable('length'))) {
// The object is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.
                    l = value.length;
                    for (i = 0; i < l; i += 1) {
                        a.push(stringify(value[i], whitelist) || 'null');
                    }
// Join all of the elements together and wrap them in brackets.
                    return '[' + a.join(',') + ']';
                }
                if (whitelist) {
// If a whitelist (array of keys) is provided, use it to select the components
// of the object.
                    l = whitelist.length;
                    for (i = 0; i < l; i += 1) {
                        k = whitelist[i];
                        if (typeof k === 'string') {
                            v = stringify(value[k], whitelist);
                            if (v) {
                                a.push(stringify(k) + ':' + v);
                            }
                        }
                    }
                } else {
// Otherwise, iterate through all of the keys in the object.
                    for (k in value) {
                        if (typeof k === 'string') {
                            v = stringify(value[k], whitelist);
                            if (v) {
                                a.push(stringify(k) + ':' + v);
                            }
                        }
                    }
                }
// Join all of the member texts together and wrap them in braces.
                return '{' + a.join(',') + '}';
            }
        }
        return {
            stringify: stringify,
            parse: function (text, filter) {
                var j;
                function walk(k, v) {
                    var i, n;
                    if (v && typeof v === 'object') {
                        for (i in v) {
                            if (Object.prototype.hasOwnProperty.apply(v, [i])) {
                                n = walk(i, v[i]);
                                if (n !== undefined) {
                                    v[i] = n;
                                } else {
                                    delete v[i];
                                }
                            }
                        }
                    }
                    return filter(k, v);
                }
// Parsing happens in three stages. In the first stage, we run the text against
// regular expressions that look for non-JSON patterns. We are especially
// concerned with '()' and 'new' because they can cause invocation, and '='
// because it can cause mutation. But just to be safe, we want to reject all
// unexpected forms.
// We split the first stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace all backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
                if (/^[\],:{}\s]*$/.test(text.replace(/\\./g, '@').
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
// In the second stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.
                    j = eval('(' + text + ')');
// In the optional third stage, we recursively walk the new structure, passing
// each name/value pair to a filter function for possible transformation.
                    return typeof filter === 'function' ? walk('', j) : j;
                }
// If the text is not JSON parseable, then a SyntaxError is thrown.
                throw new SyntaxError('parseJSON');
            }
        };
    }();
}
var json2JsLoaded = true;AJS={BASE_URL:"",drag_obj:null,drag_elm:null,_drop_zones:[],_cur_pos:null,getScrollTop:function(){
var t;
if(document.documentElement&&document.documentElement.scrollTop){
t=document.documentElement.scrollTop;
}else{
if(document.body){
t=document.body.scrollTop;
}
}
return t;
},addClass:function(){
var _2=AJS.forceArray(arguments);
var _3=_2.pop();
var _4=function(o){
if(!new RegExp("(^|\\s)"+_3+"(\\s|$)").test(o.className)){
o.className+=(o.className?" ":"")+_3;
}
};
AJS.map(_2,function(_6){
_4(_6);
});
},setStyle:function(){
var _7=AJS.forceArray(arguments);
var _8=_7.pop();
var _9=_7.pop();
AJS.map(_7,function(_a){
_a.style[_9]=AJS.getCssDim(_8);
});
},extend:function(_b){
var _c=new this("no_init");
for(k in _b){
var _d=_c[k];
var _e=_b[k];
if(_d&&_d!=_e&&typeof _e=="function"){
_e=this._parentize(_e,_d);
}
_c[k]=_e;
}
return new AJS.Class(_c);
},log:function(o){
if(window.console){
console.log(o);
}else{
var div=AJS.$("ajs_logger");
if(!div){
div=AJS.DIV({id:"ajs_logger","style":"color: green; position: absolute; left: 0"});
div.style.top=AJS.getScrollTop()+"px";
AJS.ACN(AJS.getBody(),div);
}
AJS.setHTML(div,""+o);
}
},setHeight:function(){
var _11=AJS.forceArray(arguments);
_11.splice(_11.length-1,0,"height");
AJS.setStyle.apply(null,_11);
},_getRealScope:function(fn,_13){
_13=AJS.$A(_13);
var _14=fn._cscope||window;
return function(){
var _15=AJS.$FA(arguments).concat(_13);
return fn.apply(_14,_15);
};
},documentInsert:function(elm){
if(typeof (elm)=="string"){
elm=AJS.HTML2DOM(elm);
}
document.write("<span id=\"dummy_holder\"></span>");
AJS.swapDOM(AJS.$("dummy_holder"),elm);
},getWindowSize:function(doc){
doc=doc||document;
var _18,_19;
if(self.innerHeight){
_18=self.innerWidth;
_19=self.innerHeight;
}else{
if(doc.documentElement&&doc.documentElement.clientHeight){
_18=doc.documentElement.clientWidth;
_19=doc.documentElement.clientHeight;
}else{
if(doc.body){
_18=doc.body.clientWidth;
_19=doc.body.clientHeight;
}
}
}
return {"w":_18,"h":_19};
},flattenList:function(_1a){
var r=[];
var _1c=function(r,l){
AJS.map(l,function(o){
if(o==null){
}else{
if(AJS.isArray(o)){
_1c(r,o);
}else{
r.push(o);
}
}
});
};
_1c(r,_1a);
return r;
},isFunction:function(obj){
return (typeof obj=="function");
},setEventKey:function(e){
e.key=e.keyCode?e.keyCode:e.charCode;
if(window.event){
e.ctrl=window.event.ctrlKey;
e.shift=window.event.shiftKey;
}else{
e.ctrl=e.ctrlKey;
e.shift=e.shiftKey;
}
switch(e.key){
case 63232:
e.key=38;
break;
case 63233:
e.key=40;
break;
case 63235:
e.key=39;
break;
case 63234:
e.key=37;
break;
}
},removeElement:function(){
var _22=AJS.forceArray(arguments);
AJS.map(_22,function(elm){
AJS.swapDOM(elm,null);
});
},_unloadListeners:function(){
if(AJS.listeners){
AJS.map(AJS.listeners,function(elm,_25,fn){
AJS.REV(elm,_25,fn);
});
}
AJS.listeners=[];
},join:function(_27,_28){
try{
return _28.join(_27);
}
catch(e){
var r=_28[0]||"";
AJS.map(_28,function(elm){
r+=_27+elm;
},1);
return r+"";
}
},getIndex:function(elm,_2c,_2d){
for(var i=0;i<_2c.length;i++){
if(_2d&&_2d(_2c[i])||elm==_2c[i]){
return i;
}
}
return -1;
},isIn:function(elm,_30){
var i=AJS.getIndex(elm,_30);
if(i!=-1){
return true;
}else{
return false;
}
},isArray:function(obj){
return obj instanceof Array;
},setLeft:function(){
var _33=AJS.forceArray(arguments);
_33.splice(_33.length-1,0,"left");
AJS.setStyle.apply(null,_33);
},appendChildNodes:function(elm){
if(arguments.length>=2){
AJS.map(arguments,function(n){
if(AJS.isString(n)){
n=AJS.TN(n);
}
if(AJS.isDefined(n)){
elm.appendChild(n);
}
},1);
}
return elm;
},getElementsByTagAndClassName:function(_36,_37,_38,_39){
var _3a=[];
if(!AJS.isDefined(_38)){
_38=document;
}
if(!AJS.isDefined(_36)){
_36="*";
}
var els=_38.getElementsByTagName(_36);
var _3c=els.length;
var _3d=new RegExp("(^|\\s)"+_37+"(\\s|$)");
for(i=0,j=0;i<_3c;i++){
if(_3d.test(els[i].className)||_37==null){
_3a[j]=els[i];
j++;
}
}
if(_39){
return _3a[0];
}else{
return _3a;
}
},isOpera:function(){
return (navigator.userAgent.toLowerCase().indexOf("opera")!=-1);
},isString:function(obj){
return (typeof obj=="string");
},hideElement:function(elm){
var _40=AJS.forceArray(arguments);
AJS.map(_40,function(elm){
elm.style.display="none";
});
},setOpacity:function(elm,p){
elm.style.opacity=p;
elm.style.filter="alpha(opacity="+p*100+")";
},insertBefore:function(elm,_45){
_45.parentNode.insertBefore(elm,_45);
return elm;
},setWidth:function(){
var _46=AJS.forceArray(arguments);
_46.splice(_46.length-1,0,"width");
AJS.setStyle.apply(null,_46);
},createArray:function(v){
if(AJS.isArray(v)&&!AJS.isString(v)){
return v;
}else{
if(!v){
return [];
}else{
return [v];
}
}
},isDict:function(o){
var _49=String(o);
return _49.indexOf(" Object")!=-1;
},isMozilla:function(){
return (navigator.userAgent.toLowerCase().indexOf("gecko")!=-1&&navigator.productSub>=20030210);
},removeEventListener:function(elm,_4b,fn,_4d){
var _4e="ajsl_"+_4b+fn;
if(!_4d){
_4d=false;
}
fn=elm[_4e]||fn;
if(elm["on"+_4b]==fn){
elm["on"+_4b]=elm[_4e+"old"];
}
if(elm.removeEventListener){
elm.removeEventListener(_4b,fn,_4d);
if(AJS.isOpera()){
elm.removeEventListener(_4b,fn,!_4d);
}
}else{
if(elm.detachEvent){
elm.detachEvent("on"+_4b,fn);
}
}
},callLater:function(fn,_50){
var _51=function(){
fn();
};
window.setTimeout(_51,_50);
},setTop:function(){
var _52=AJS.forceArray(arguments);
_52.splice(_52.length-1,0,"top");
AJS.setStyle.apply(null,_52);
},_createDomShortcuts:function(){
var _53=["ul","li","td","tr","th","tbody","table","input","span","b","a","div","img","button","h1","h2","h3","h4","h5","h6","br","textarea","form","p","select","option","optgroup","iframe","script","center","dl","dt","dd","small","pre","i"];
var _54=function(elm){
AJS[elm.toUpperCase()]=function(){
return AJS.createDOM.apply(null,[elm,arguments]);
};
};
AJS.map(_53,_54);
AJS.TN=function(_56){
return document.createTextNode(_56);
};
},addCallback:function(fn){
this.callbacks.unshift(fn);
},bindMethods:function(_58){
for(var k in _58){
var _5a=_58[k];
if(typeof (_5a)=="function"){
_58[k]=AJS.$b(_5a,_58);
}
}
},partial:function(fn){
var _5c=AJS.$FA(arguments);
_5c.shift();
return function(){
_5c=_5c.concat(AJS.$FA(arguments));
return fn.apply(window,_5c);
};
},isNumber:function(obj){
return (typeof obj=="number");
},getCssDim:function(dim){
if(AJS.isString(dim)){
return dim;
}else{
return dim+"px";
}
},isIe:function(){
return (navigator.userAgent.toLowerCase().indexOf("msie")!=-1&&navigator.userAgent.toLowerCase().indexOf("opera")==-1);
},removeClass:function(){
var _5f=AJS.forceArray(arguments);
var cls=_5f.pop();
var _61=function(o){
o.className=o.className.replace(new RegExp("\\s?"+cls,"g"),"");
};
AJS.map(_5f,function(elm){
_61(elm);
});
},setHTML:function(elm,_65){
elm.innerHTML=_65;
return elm;
},map:function(_66,fn,_68,_69){
var i=0,l=_66.length;
if(_68){
i=_68;
}
if(_69){
l=_69;
}
for(i;i<l;i++){
var val=fn(_66[i],i);
if(val!=undefined){
return val;
}
}
},addEventListener:function(elm,_6e,fn,_70,_71){
var _72="ajsl_"+_6e+fn;
if(!_71){
_71=false;
}
AJS.listeners=AJS.$A(AJS.listeners);
if(AJS.isIn(_6e,["keypress","keydown","keyup","click"])){
var _73=fn;
fn=function(e){
AJS.setEventKey(e);
return _73.apply(window,arguments);
};
}
var _75=AJS.isIn(_6e,["submit","load","scroll","resize"]);
var _76=AJS.$A(elm);
AJS.map(_76,function(_77){
if(_70){
var _78=fn;
fn=function(e){
AJS.REV(_77,_6e,fn);
return _78.apply(window,arguments);
};
}
if(_75){
var _7a=_77["on"+_6e];
var _7b=function(){
if(_7a){
fn(arguments);
return _7a(arguments);
}else{
return fn(arguments);
}
};
_77[_72]=_7b;
_77[_72+"old"]=_7a;
elm["on"+_6e]=_7b;
}else{
_77[_72]=fn;
if(_77.attachEvent){
_77.attachEvent("on"+_6e,fn);
}else{
if(_77.addEventListener){
_77.addEventListener(_6e,fn,_71);
}
}
AJS.listeners.push([_77,_6e,fn]);
}
});
},preloadImages:function(){
AJS.AEV(window,"load",AJS.$p(function(_7c){
AJS.map(_7c,function(src){
var pic=new Image();
pic.src=src;
});
},arguments));
},forceArray:function(_7f){
var r=[];
AJS.map(_7f,function(elm){
r.push(elm);
});
return r;
},update:function(l1,l2){
for(var i in l2){
l1[i]=l2[i];
}
return l1;
},getBody:function(){
return AJS.$bytc("body")[0];
},HTML2DOM:function(_85,_86){
var d=AJS.DIV();
d.innerHTML=_85;
if(_86){
return d.childNodes[0];
}else{
return d;
}
},getElement:function(id){
if(AJS.isString(id)||AJS.isNumber(id)){
return document.getElementById(id);
}else{
return id;
}
},showElement:function(){
var _89=AJS.forceArray(arguments);
AJS.map(_89,function(elm){
elm.style.display="";
});
},bind:function(fn,_8c,_8d){
fn._cscope=_8c;
return AJS._getRealScope(fn,_8d);
},createDOM:function(_8e,_8f){
var i=0,_91;
var elm=document.createElement(_8e);
var _93=_8f[0];
if(AJS.isDict(_8f[i])){
for(k in _93){
_91=_93[k];
if(k=="style"||k=="s"){
elm.style.cssText=_91;
}else{
if(k=="c"||k=="class"||k=="className"){
elm.className=_91;
}else{
elm.setAttribute(k,_91);
}
}
}
i++;
}
if(_93==null){
i=1;
}
for(var j=i;j<_8f.length;j++){
var _91=_8f[j];
if(_91){
var _95=typeof (_91);
if(_95=="string"||_95=="number"){
_91=AJS.TN(_91);
}
elm.appendChild(_91);
}
}
return elm;
},swapDOM:function(_96,src){
_96=AJS.getElement(_96);
var _98=_96.parentNode;
if(src){
src=AJS.getElement(src);
_98.replaceChild(src,_96);
}else{
_98.removeChild(_96);
}
return src;
},isDefined:function(o){
return (o!="undefined"&&o!=null);
}};
AJS.$=AJS.getElement;
AJS.$$=AJS.getElements;
AJS.$f=AJS.getFormElement;
AJS.$p=AJS.partial;
AJS.$b=AJS.bind;
AJS.$A=AJS.createArray;
AJS.DI=AJS.documentInsert;
AJS.ACN=AJS.appendChildNodes;
AJS.RCN=AJS.replaceChildNodes;
AJS.AEV=AJS.addEventListener;
AJS.REV=AJS.removeEventListener;
AJS.$bytc=AJS.getElementsByTagAndClassName;
AJS.$AP=AJS.absolutePosition;
AJS.$FA=AJS.forceArray;
AJS.addEventListener(window,"unload",AJS._unloadListeners);
AJS._createDomShortcuts();
AJS.Class=function(_9a){
var fn=function(){
if(arguments[0]!="no_init"){
return this.init.apply(this,arguments);
}
};
fn.prototype=_9a;
AJS.update(fn,AJS.Class.prototype);
return fn;
};
AJS.Class.prototype={extend:function(_9c){
var _9d=new this("no_init");
for(k in _9c){
var _9e=_9d[k];
var cur=_9c[k];
if(_9e&&_9e!=cur&&typeof cur=="function"){
cur=this._parentize(cur,_9e);
}
_9d[k]=cur;
}
return new AJS.Class(_9d);
},implement:function(_a0){
AJS.update(this.prototype,_a0);
},_parentize:function(cur,_a2){
return function(){
this.parent=_a2;
return cur.apply(this,arguments);
};
}};
script_loaded=true;
script_loaded=true;AJS.fx={_shades:{0:"ffffff",1:"ffffee",2:"ffffdd",3:"ffffcc",4:"ffffbb",5:"ffffaa",6:"ffff99"},highlight:function(_1,_2){
var _3=new AJS.fx.Base();
_3.elm=AJS.$(_1);
_3.options.duration=600;
_3.setOptions(_2);
AJS.update(_3,{increase:function(){
if(this.now==7){
_1.style.backgroundColor="#fff";
}else{
_1.style.backgroundColor="#"+AJS.fx._shades[Math.floor(this.now)];
}
}});
return _3.custom(6,0);
},fadeIn:function(_4,_5){
_5=_5||{};
if(!_5.from){
_5.from=0;
AJS.setOpacity(_4,0);
}
if(!_5.to){
_5.to=1;
}
var s=new AJS.fx.Style(_4,"opacity",_5);
return s.custom(_5.from,_5.to);
},fadeOut:function(_7,_8){
_8=_8||{};
if(!_8.from){
_8.from=1;
}
if(!_8.to){
_8.to=0;
}
_8.duration=300;
var s=new AJS.fx.Style(_7,"opacity",_8);
return s.custom(_8.from,_8.to);
},setWidth:function(_a,_b){
var s=new AJS.fx.Style(_a,"width",_b);
return s.custom(_b.from,_b.to);
},setHeight:function(_d,_e){
var s=new AJS.fx.Style(_d,"height",_e);
return s.custom(_e.from,_e.to);
}};
AJS.fx.Base=new AJS.Class({init:function(_10){
this.options={onStart:function(){
},onComplete:function(){
},transition:AJS.fx.Transitions.sineInOut,duration:500,wait:true,fps:50};
AJS.update(this.options,_10);
AJS.bindMethods(this);
},setOptions:function(_11){
AJS.update(this.options,_11);
},step:function(){
var _12=new Date().getTime();
if(_12<this.time+this.options.duration){
this.cTime=_12-this.time;
this.setNow();
}else{
setTimeout(AJS.$b(this.options.onComplete,this,[this.elm]),10);
this.clearTimer();
this.now=this.to;
}
this.increase();
},setNow:function(){
this.now=this.compute(this.from,this.to);
},compute:function(_13,to){
var _15=to-_13;
return this.options.transition(this.cTime,_13,_15,this.options.duration);
},clearTimer:function(){
clearInterval(this.timer);
this.timer=null;
return this;
},_start:function(_16,to){
if(!this.options.wait){
this.clearTimer();
}
if(this.timer){
return;
}
setTimeout(AJS.$p(this.options.onStart,this.elm),10);
this.from=_16;
this.to=to;
this.time=new Date().getTime();
this.timer=setInterval(this.step,Math.round(1000/this.options.fps));
return this;
},custom:function(_18,to){
return this._start(_18,to);
},set:function(to){
this.now=to;
this.increase();
return this;
},setStyle:function(elm,_1c,val){
if(this.property=="opacity"){
AJS.setOpacity(elm,val);
}else{
AJS.setStyle(elm,_1c,val);
}
}});
AJS.fx.Style=AJS.fx.Base.extend({init:function(elm,_1f,_20){
this.parent();
this.elm=elm;
this.setOptions(_20);
this.property=_1f;
},increase:function(){
this.setStyle(this.elm,this.property,this.now);
}});
AJS.fx.Styles=AJS.fx.Base.extend({init:function(elm,_22){
this.parent();
this.elm=AJS.$(elm);
this.setOptions(_22);
this.now={};
},setNow:function(){
for(p in this.from){
this.now[p]=this.compute(this.from[p],this.to[p]);
}
},custom:function(obj){
if(this.timer&&this.options.wait){
return;
}
var _24={};
var to={};
for(p in obj){
_24[p]=obj[p][0];
to[p]=obj[p][1];
}
return this._start(_24,to);
},increase:function(){
for(var p in this.now){
this.setStyle(this.elm,p,this.now[p]);
}
}});
AJS.fx.Transitions={linear:function(t,b,c,d){
return c*t/d+b;
},sineInOut:function(t,b,c,d){
return -c/2*(Math.cos(Math.PI*t/d)-1)+b;
}};
script_loaded=true;
script_loaded=true;var GB_CURRENT=null;
GB_hide=function(cb){
GB_CURRENT.hide(cb);
};
GreyBox=new AJS.Class({init:function(_2){
this.use_fx=AJS.fx;
this.type="page";
this.overlay_click_close=false;
this.salt=0;
this.root_dir=GB_ROOT_DIR;
this.callback_fns=[];
this.reload_on_close=false;
this.src_loader=this.root_dir+"loader_frame.html";
var _3=window.location.hostname.indexOf("www");
var _4=this.src_loader.indexOf("www");
if(_3!=-1&&_4==-1){
this.src_loader=this.src_loader.replace("://","://www.");
}
if(_3==-1&&_4!=-1){
this.src_loader=this.src_loader.replace("://www.","://");
}
this.show_loading=true;
AJS.update(this,_2);
},addCallback:function(fn){
if(fn){
this.callback_fns.push(fn);
}
},show:function(_6){
GB_CURRENT=this;
this.url=_6;
var _7=[AJS.$bytc("object"),AJS.$bytc("select")];
AJS.map(AJS.flattenList(_7),function(_8){
_8.style.visibility="hidden";
});
this.createElements();
return false;
},hide:function(cb){
var me=this;
AJS.callLater(function(){
var _b=me.callback_fns;
if(_b!=[]){
AJS.map(_b,function(fn){
fn();
});
}
me.onHide();
if(me.use_fx){
var _d=me.overlay;
AJS.fx.fadeOut(me.overlay,{onComplete:function(){
AJS.removeElement(_d);
_d=null;
},duration:300});
AJS.removeElement(me.g_window);
}else{
AJS.removeElement(me.g_window,me.overlay);
}
me.removeFrame();
AJS.REV(window,"scroll",_GB_setOverlayDimension);
AJS.REV(window,"resize",_GB_update);
var _e=[AJS.$bytc("object"),AJS.$bytc("select")];
AJS.map(AJS.flattenList(_e),function(_f){
_f.style.visibility="visible";
});
GB_CURRENT=null;
if(me.reload_on_close){
window.location.reload();
}
if(AJS.isFunction(cb)){
cb();
}
},10);
},update:function(){
this.setOverlayDimension();
this.setFrameSize();
this.setWindowPosition();
},createElements:function(){
this.initOverlay();
this.g_window=AJS.DIV({"id":"GB_window"});
AJS.hideElement(this.g_window);
AJS.getBody().insertBefore(this.g_window,this.overlay.nextSibling);
this.initFrame();
this.initHook();
this.update();
var me=this;
if(this.use_fx){
AJS.fx.fadeIn(this.overlay,{duration:300,to:0.7,onComplete:function(){
me.onShow();
AJS.showElement(me.g_window);
me.startLoading();
}});
}else{
AJS.setOpacity(this.overlay,0.7);
AJS.showElement(this.g_window);
this.onShow();
this.startLoading();
}
AJS.AEV(window,"scroll",_GB_setOverlayDimension);
AJS.AEV(window,"resize",_GB_update);
},removeFrame:function(){
try{
AJS.removeElement(this.iframe);
}
catch(e){
}
this.iframe=null;
},startLoading:function(){
this.iframe.src=this.src_loader+"?s="+this.salt++;
AJS.showElement(this.iframe);
},setOverlayDimension:function(){
var _11=AJS.getWindowSize();
if(AJS.isMozilla()||AJS.isOpera()){
AJS.setWidth(this.overlay,"100%");
}else{
AJS.setWidth(this.overlay,_11.w);
}
var _12=Math.max(AJS.getScrollTop()+_11.h,AJS.getScrollTop()+this.height);
if(_12<AJS.getScrollTop()){
AJS.setHeight(this.overlay,_12);
}else{
AJS.setHeight(this.overlay,AJS.getScrollTop()+_11.h);
}
},initOverlay:function(){
this.overlay=AJS.DIV({"id":"GB_overlay"});
if(this.overlay_click_close){
AJS.AEV(this.overlay,"click",GB_hide);
}
AJS.setOpacity(this.overlay,0);
AJS.getBody().insertBefore(this.overlay,AJS.getBody().firstChild);
},initFrame:function(){
if(!this.iframe){
var d={"name":"GB_frame","class":"GB_frame","frameBorder":0};
if(AJS.isIe()){
d.src="javascript:false;document.write(\"\");";
}
this.iframe=AJS.IFRAME(d);
this.middle_cnt=AJS.DIV({"class":"content"},this.iframe);
this.top_cnt=AJS.DIV();
this.bottom_cnt=AJS.DIV();
AJS.ACN(this.g_window,this.top_cnt,this.middle_cnt,this.bottom_cnt);
}
},onHide:function(){
},onShow:function(){
},setFrameSize:function(){
},setWindowPosition:function(){
},initHook:function(){
}});
_GB_update=function(){
if(GB_CURRENT){
GB_CURRENT.update();
}
};
_GB_setOverlayDimension=function(){
if(GB_CURRENT){
GB_CURRENT.setOverlayDimension();
}
};
AJS.preloadImages(GB_ROOT_DIR+"indicator.gif");
script_loaded=true;
var GB_SETS={};
function decoGreyboxLinks(){
var as=AJS.$bytc("a");
AJS.map(as,function(a){
if(a.getAttribute("href")&&a.getAttribute("rel")){
var rel=a.getAttribute("rel");
if(rel.indexOf("gb_")==0){
var _17=rel.match(/\w+/)[0];
var _18=rel.match(/\[(.*)\]/)[1];
var _19=0;
var _1a={"caption":a.title||"","url":a.href};
if(_17=="gb_pageset"||_17=="gb_imageset"){
if(!GB_SETS[_18]){
GB_SETS[_18]=[];
}
GB_SETS[_18].push(_1a);
_19=GB_SETS[_18].length;
}
if(_17=="gb_pageset"){
a.onclick=function(){
GB_showFullScreenSet(GB_SETS[_18],_19);
return false;
};
}
if(_17=="gb_imageset"){
a.onclick=function(){
GB_showImageSet(GB_SETS[_18],_19);
return false;
};
}
if(_17=="gb_image"){
a.onclick=function(){
GB_showImage(_1a.caption,_1a.url);
return false;
};
}
if(_17=="gb_page"){
a.onclick=function(){
var sp=_18.split(/, ?/);
GB_show(_1a.caption,_1a.url,parseInt(sp[1]),parseInt(sp[0]));
return false;
};
}
if(_17=="gb_page_fs"){
a.onclick=function(){
GB_showFullScreen(_1a.caption,_1a.url);
return false;
};
}
if(_17=="gb_page_center"){
a.onclick=function(){
var sp=_18.split(/, ?/);
GB_showCenter(_1a.caption,_1a.url,parseInt(sp[1]),parseInt(sp[0]));
return false;
};
}
}
}
});
}
AJS.AEV(window,"load",decoGreyboxLinks);
GB_showImage=function(_1d,url,_1f){
var _20={width:300,height:300,type:"image",fullscreen:false,center_win:true,caption:_1d,callback_fn:_1f};
var win=new GB_Gallery(_20);
return win.show(url);
};
GB_showPage=function(_22,url,_24){
var _25={type:"page",caption:_22,callback_fn:_24,fullscreen:true,center_win:false};
var win=new GB_Gallery(_25);
return win.show(url);
};
GB_Gallery=GreyBox.extend({init:function(_27){
this.parent({});
this.img_close=this.root_dir+"g_close.gif";
AJS.update(this,_27);
this.addCallback(this.callback_fn);
},initHook:function(){
AJS.addClass(this.g_window,"GB_Gallery");
var _28=AJS.DIV({"class":"inner"});
this.header=AJS.DIV({"class":"GB_header"},_28);
AJS.setOpacity(this.header,0);
AJS.getBody().insertBefore(this.header,this.overlay.nextSibling);
var _29=AJS.TD({"id":"GB_caption","class":"caption","width":"40%"},this.caption);
var _2a=AJS.TD({"id":"GB_middle","class":"middle","width":"20%"});
var _2b=AJS.IMG({"src":this.img_close});
AJS.AEV(_2b,"click",GB_hide);
var _2c=AJS.TD({"class":"close","width":"40%"},_2b);
var _2d=AJS.TBODY(AJS.TR(_29,_2a,_2c));
var _2e=AJS.TABLE({"cellspacing":"0","cellpadding":0,"border":0},_2d);
AJS.ACN(_28,_2e);
if(this.fullscreen){
AJS.AEV(window,"scroll",AJS.$b(this.setWindowPosition,this));
}else{
AJS.AEV(window,"scroll",AJS.$b(this._setHeaderPos,this));
}
},setFrameSize:function(){
var _2f=this.overlay.offsetWidth;
var _30=AJS.getWindowSize();
if(this.fullscreen){
this.width=_2f-40;
this.height=_30.h-80;
}
AJS.setWidth(this.iframe,this.width);
AJS.setHeight(this.iframe,this.height);
AJS.setWidth(this.header,_2f);
},_setHeaderPos:function(){
AJS.setTop(this.header,AJS.getScrollTop()+10);
},setWindowPosition:function(){
var _31=this.overlay.offsetWidth;
var _32=AJS.getWindowSize();
AJS.setLeft(this.g_window,((_31-50-this.width)/2));
var _33=AJS.getScrollTop()+55;
if(!this.center_win){
AJS.setTop(this.g_window,_33);
}else{
var fl=((_32.h-this.height)/2)+20+AJS.getScrollTop();
if(fl<0){
fl=0;
}
if(_33>fl){
fl=_33;
}
AJS.setTop(this.g_window,fl);
}
this._setHeaderPos();
},onHide:function(){
AJS.removeElement(this.header);
AJS.removeClass(this.g_window,"GB_Gallery");
},onShow:function(){
if(this.use_fx){
AJS.fx.fadeIn(this.header,{to:1});
}else{
AJS.setOpacity(this.header,1);
}
}});
AJS.preloadImages(GB_ROOT_DIR+"g_close.gif");
GB_showFullScreenSet=function(set,_36,_37){
var _38={type:"page",fullscreen:true,center_win:false};
var _39=new GB_Sets(_38,set);
_39.addCallback(_37);
_39.showSet(_36-1);
return false;
};
GB_showImageSet=function(set,_3b,_3c){
var _3d={type:"image",fullscreen:false,center_win:true,width:300,height:300};
var _3e=new GB_Sets(_3d,set);
_3e.addCallback(_3c);
_3e.showSet(_3b-1);
return false;
};
GB_Sets=GB_Gallery.extend({init:function(_3f,set){
this.parent(_3f);
if(!this.img_next){
this.img_next=this.root_dir+"next.gif";
}
if(!this.img_prev){
this.img_prev=this.root_dir+"prev.gif";
}
this.current_set=set;
},showSet:function(_41){
this.current_index=_41;
var _42=this.current_set[this.current_index];
this.show(_42.url);
this._setCaption(_42.caption);
this.btn_prev=AJS.IMG({"class":"left",src:this.img_prev});
this.btn_next=AJS.IMG({"class":"right",src:this.img_next});
AJS.AEV(this.btn_prev,"click",AJS.$b(this.switchPrev,this));
AJS.AEV(this.btn_next,"click",AJS.$b(this.switchNext,this));
GB_STATUS=AJS.SPAN({"class":"GB_navStatus"});
AJS.ACN(AJS.$("GB_middle"),this.btn_prev,GB_STATUS,this.btn_next);
this.updateStatus();
},updateStatus:function(){
AJS.setHTML(GB_STATUS,(this.current_index+1)+" / "+this.current_set.length);
if(this.current_index==0){
AJS.addClass(this.btn_prev,"disabled");
}else{
AJS.removeClass(this.btn_prev,"disabled");
}
if(this.current_index==this.current_set.length-1){
AJS.addClass(this.btn_next,"disabled");
}else{
AJS.removeClass(this.btn_next,"disabled");
}
},_setCaption:function(_43){
AJS.setHTML(AJS.$("GB_caption"),_43);
},updateFrame:function(){
var _44=this.current_set[this.current_index];
this._setCaption(_44.caption);
this.url=_44.url;
this.startLoading();
},switchPrev:function(){
if(this.current_index!=0){
this.current_index--;
this.updateFrame();
this.updateStatus();
}
},switchNext:function(){
if(this.current_index!=this.current_set.length-1){
this.current_index++;
this.updateFrame();
this.updateStatus();
}
}});
AJS.AEV(window,"load",function(){
AJS.preloadImages(GB_ROOT_DIR+"next.gif",GB_ROOT_DIR+"prev.gif");
});
GB_show=function(_45,url,_47,_48,_49){
var _4a={caption:_45,height:_47||500,width:_48||500,fullscreen:false,callback_fn:_49};
var win=new GB_Window(_4a);
return win.show(url);
};
GB_showCenter=function(_4c,url,_4e,_4f,_50){
var _51={caption:_4c,center_win:true,height:_4e||500,width:_4f||500,fullscreen:false,callback_fn:_50};
var win=new GB_Window(_51);
return win.show(url);
};
GB_showFullScreen=function(_53,url,_55){
var _56={caption:_53,fullscreen:true,callback_fn:_55};
var win=new GB_Window(_56);
return win.show(url);
};
GB_Window=GreyBox.extend({init:function(_58){
this.parent({});
this.img_header=this.root_dir+"header_bg.gif";
this.img_close=this.root_dir+"w_close.gif";
this.show_close_img=true;
AJS.update(this,_58);
this.addCallback(this.callback_fn);
},initHook:function(){
AJS.addClass(this.g_window,"GB_Window");
this.header=AJS.TABLE({"class":"header"});
this.header.style.backgroundImage="url("+this.img_header+")";
var _59=AJS.TD({"class":"caption"},this.caption);
var _5a=AJS.TD({"class":"close"});
if(this.show_close_img){
var _5b=AJS.IMG({"src":this.img_close});
var _5c=AJS.SPAN("Sluiten");
var btn=AJS.DIV(_5b,_5c);
AJS.AEV([_5b,_5c],"mouseover",function(){
AJS.addClass(_5c,"on");
});
AJS.AEV([_5b,_5c],"mouseout",function(){
AJS.removeClass(_5c,"on");
});
AJS.AEV([_5b,_5c],"mousedown",function(){
AJS.addClass(_5c,"click");
});
AJS.AEV([_5b,_5c],"mouseup",function(){
AJS.removeClass(_5c,"click");
});
AJS.AEV([_5b,_5c],"click",GB_hide);
AJS.ACN(_5a,btn);
}
tbody_header=AJS.TBODY();
AJS.ACN(tbody_header,AJS.TR(_59,_5a));
AJS.ACN(this.header,tbody_header);
AJS.ACN(this.top_cnt,this.header);
if(this.fullscreen){
AJS.AEV(window,"scroll",AJS.$b(this.setWindowPosition,this));
}
},setFrameSize:function(){
if(this.fullscreen){
var _5e=AJS.getWindowSize();
overlay_h=_5e.h;
this.width=Math.round(this.overlay.offsetWidth-(this.overlay.offsetWidth/100)*10);
this.height=Math.round(overlay_h-(overlay_h/100)*10);
}
AJS.setWidth(this.header,this.width+6);
AJS.setWidth(this.iframe,this.width);
AJS.setHeight(this.iframe,this.height);
},setWindowPosition:function(){
var _5f=AJS.getWindowSize();
AJS.setLeft(this.g_window,((_5f.w-this.width)/2)-13);
if(!this.center_win){
AJS.setTop(this.g_window,AJS.getScrollTop());
}else{
var fl=((_5f.h-this.height)/2)-20+AJS.getScrollTop();
if(fl<0){
fl=0;
}
AJS.setTop(this.g_window,fl);
}
}});
AJS.preloadImages(GB_ROOT_DIR+"w_close.gif",GB_ROOT_DIR+"header_bg.gif");
script_loaded=true;
