// JavaScript Document


function hideTopLevelMenues(itemPrefix) 
{
	var i, objElement;
	for(i=1;i<=99;i++)
	{
		objElement = document.getElementById(itemPrefix+"_"+i);
		if(!objElement)
		{
			//break;
		}
		else 
		{
			objElement.style.display='none';
		}
	}
}

/*
function hideRow(rowId)
{
	curRow = document.getElementById(rowId);
	curRow.style.display='none';
}
function showRow(rowId)
{
	curRow = document.getElementById(rowId);
	curRow.style.display='';
}



function showThisItem(itemPrefix, itemNo) 
{
	var i, objElement;
	for(i=1;i<=99;i++)
	{
		objElement = document.getElementById(itemPrefix+"_"+i);
		if(!objElement)
		{
			//break;
		}
		else 
		{
			if (i==itemNo)
			{
				showRow(itemPrefix+"_"+i);
			}
			else
			{
				hideRow(itemPrefix+"_"+i);
			}
			
		}
	}
}

function setBlockActive(blockName, blockActive) 
{
	var i, objElement;

	for(i=1;i < 999;i++)
	{
		var objElement = document.getElementById(blockName+"_"+i);
		if(!objElement)
		{
			break;
		}
		else
		{
			if (i==blockActive)
			{
				objElement.className = "cngcoloract";
			}
			else
			{
				objElement.className = "cngcolor";;
			}
		}
	}
}

*/

function showHideThisItem(itemPrefix, itemNo) 
{
	var i, objElement, objCurElement, objCurSpan, objSpan;
	
	objCurElement = document.getElementById(itemPrefix + "_" + itemNo);
	if(!objCurElement)
	{
		return true;
	}

	objCurSpan = document.getElementById("span_" + itemPrefix + "_" + itemNo);
	if(!objCurSpan)
	{
		return true;
	}

	if(objCurElement.style.display!='none')
	{
		//--- Hide current menu item
		objCurElement.style.display = 'none';
		objCurSpan.className = 'closed';
		return true;
	}
	else
	{
		//--- Show current menu item
		objCurElement.style.display = '';
		objCurSpan.className = 'opened';
		
		//--- Hide other siblings max(99)
		for(i=1;i<=99;i++)
		{
			objElement = document.getElementById(itemPrefix+"_"+i);
			objSpan = document.getElementById("span_"+itemPrefix+"_"+i);
			if(objElement)
			{
				if(i!=itemNo)
				{
					objElement.style.display = 'none';
				}
				
			}
			if(objSpan)
			{
				if(i!=itemNo)
				{
					objSpan.className = 'closed';
				}
				
			}
		}
		return true;
	}
	
}



//--- Show Font Size
var min=8;
var max=16;
function increaseFontSize() {
   var p = document.getElementsByTagName('td');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=max) {
         s += 1;
      }
      p[i].style.fontSize = s+"px"
   }
}
function decreaseFontSize() {
   var p = document.getElementsByTagName('td');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=min) {
         s -= 1;
      }
      p[i].style.fontSize = s+"px"
   }   
}

// TO PRINT .

/*
addPrintLink function by Roger Johansson, www.456bereastreet.com
*/
var addPrintLink = {
	init:function(sTargetEl,sLinkText) {
		if (!document.getElementById || !document.createTextNode) {return;} // Check for DOM support
		if (!document.getElementById(sTargetEl)) {return;} // Check that the target element actually exists
		if (!window.print) {return;} // Check that the browser supports window.print
		var oTarget = document.getElementById(sTargetEl);
		var oLink = document.createElement('a');
		oLink.id = 'print-link'; // Give the link an id to allow styling
		oLink.href = '#'; // Make the link focusable for keyboard users
		oLink.appendChild(document.createTextNode(sLinkText));
		oLink.onclick = function() {window.print(); return false;} // Return false prevents the browser from following the link and jumping to the top of the page after printing
		oTarget.appendChild(oLink);
	},
/*
addEvent function included here for portability. Replace with your own addEvent function if you use one.
*/
/* addEvent function from http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html */
	addEvent:function(obj, type, fn) {
		if (obj.addEventListener)
			obj.addEventListener(type, fn, false);
		else if (obj.attachEvent) {
			obj["e"+type+fn] = fn;
			obj[type+fn] = function() {obj["e"+type+fn](window.event);}
			obj.attachEvent("on"+type, obj[type+fn]);
		}
	}
};
addPrintLink.addEvent(window, 'load', function(){addPrintLink.init('article','Print this page');});

function popupmenu(choice,wt,ht)
 		{
			var winOpts="toolbars=no,maximized=no,status=no,resizable=0,fullscreen=0,top=20,left=0,scrollbars=no,width="+wt+",height="+ht+",location=0,directories= no";
			confirmWin=window.open('','theconfirmWin',winOpts);
			confirmWin.close();
  			confirmWin=window.open(choice,'theconfirmWin',winOpts);
		}

