 /* 
 * JS   			:	iconfunc.js 
 * Description 		:	provides functions for the toolbar
 * @author 			:	respective to functions
 * History			: 	
 * 
 * Date 		Modified by		Description
 * --------------------------------------------------------------
 * 
 */

var getElementTab = document.getElementsByTagName("table"); 
var getElementBody = document.getElementsByTagName("P");	
var eachElementTab;
var eachElementBody;

var lh; // line hight
var fs; // fontsize
/* 
 * Plus()			: Function used to increase the font
 * Author 			: Ajay Shah	
 */

function plus()
{
		var flagset = 0;
		k= 0;
		y = document.getElementById('Darea');
		x = y.getElementsByTagName('TD');
		for (i=0;i< x.length; i++) 
    	{
      		eachElementTab = x[i];
      		if(isNaN(parseInt(eachElementTab.style.fontSize)))
			{
				if(fs == null)
				{
         			eachElementTab.style.fontSize = 13;
				}
				else
				{
         			eachElementTab.style.fontSize = fs;
				}
				if(lh == null)
				{
					eachElementTab.style.lineHeight = 1;
				}
				else
				{
					eachElementTab.style.lineHeight = lh;
				}
			}				
			if(eachElementTab.style.fontSize < "16px")
			{
				eachElementTab.style.fontSize = parseInt(eachElementTab.style.fontSize) + 1;
				eachElementTab.style.lineHeight =parseFloat(eachElementTab.style.lineHeight)+0.1 ;
			}
			else
			{
				flagset = 1;
			}
    	}
		y = document.getElementById('Earea');
		x = y.getElementsByTagName('TD');
		for (i=0;i<(x.length); i++) 
    	{
      		eachElementTab = x[i];
      		if(isNaN(parseInt(eachElementTab.style.fontSize)))
      		{
				if(fs == null)
				{
         			eachElementTab.style.fontSize = 13;
				}
				else
				{
         			eachElementTab.style.fontSize = fs;
				}
				if(lh == null)
				{
					eachElementTab.style.lineHeight = 1;
				}
				else
				{

					eachElementTab.style.lineHeight = lh;
				}
			}
			if(eachElementTab.style.fontSize < "16px")
			{
				eachElementTab.style.fontSize = parseInt(eachElementTab.style.fontSize) + 1;
				eachElementTab.style.lineHeight = parseFloat(eachElementTab.style.lineHeight)+0.1;
			}
			else
			{
				flagset = 1;
			}
    	}
		if (flagset == 1)
		{
			alert("You cannot increase the font any further");
		}    

	lh = eachElementTab.style.lineHeight;
	fs = eachElementTab.style.fontSize;
}

/* 
 * Minus()			: Function used to decrease the font
 * Author 			: Ajay Shah	
 */

function minus()
{
	
	var flagset = 0;
	y = document.getElementById('Darea');
	x = y.getElementsByTagName('TD');
		for (i=0;i<x.length; i++) 
    	{
      		eachElementTab = x[i];
      		if(isNaN(parseInt(eachElementTab.style.fontSize)))
      		{
				if(fs == null)
				{
         			eachElementTab.style.fontSize = 13;
				}
				else
				{
         			eachElementTab.style.fontSize = fs;
				}
				if(lh == null)
				{
					eachElementTab.style.lineHeight = 1;
				}
				else
				{

					eachElementTab.style.lineHeight = lh;
				}
      		}
      		
      		if(eachElementTab.style.fontSize > "10px")
      		{
      			eachElementTab.style.fontSize = parseInt(eachElementTab.style.fontSize) - 1;
      			eachElementTab.style.lineHeight = eachElementTab.style.lineHeight - 0.1;
      		}
      		else
      		{
				flagset = 1;
      		}
    	}
		y = document.getElementById('Earea');
		x = y.getElementsByTagName('TD');

		for (i=0;i<x.length; i++) 
    	{
      		eachElementTab = x[i];
      		if(isNaN(parseInt(eachElementTab.style.fontSize)))
      		{
				if(fs == null)
				{
         			eachElementTab.style.fontSize = 13;
				}
				else
				{
         			eachElementTab.style.fontSize = fs;
				}
				if(lh == null)
				{
					eachElementTab.style.lineHeight = 1;
				}
				else
				{
					eachElementTab.style.lineHeight = lh;
				}
      		}
      		
      		if(eachElementTab.style.fontSize > "10px")
      		{
      			eachElementTab.style.fontSize = parseInt(eachElementTab.style.fontSize) - 1;
      			eachElementTab.style.lineHeight = eachElementTab.style.lineHeight - 0.1;
      		}
      		else
      		{
				flagset = 1;
      		}
    	}
		if (flagset == 1)
		{
			alert("You cannot decrease the font any further");
		}    

	lh = eachElementTab.style.lineHeight;
	fs = eachElementTab.style.fontSize;
}
/* 
 * mail()			: Function used to send link of page by Mail 
 * Author 			: Ajay Shah	
 */


function mail()
{
	window.open("mailto:?body=" + document.URL);
}



/* 
 * addBookmark()	: Function used to add the current page as bookmark
 * Author 			: Ajay Shah	
 */


function addBookmark()
{
	if( window.sidebar && window.sidebar.addPanel ) 
	{
	    //Gecko (Netscape 6 etc.) - add to Sidebar
	    window.sidebar.addPanel( this.title, this.href, '' );
	} 
	else if( window.external && ( navigator.platform == 'Win32' ||
      ( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) ) ) 
    {
    	//IE Win32 or iCab - checking for AddFavorite produces errors for no
    	//good reason, so I use a platform and browser detect.
    	//adds the current page page as a favourite; if this is unwanted,
    	//simply write the desired page in here instead of 'location.href'
    	window.external.AddFavorite( location.href, document.title );
	} 
	else if( window.opera && window.print ) 
	{
 	   //Opera 6+ - add as sidebar panel to Hotlist
  	  return true;
	} 
	else if( document.layers ) 
	{
 	   	//NS4 & Escape - tell them how to add a bookmark quickly (adds current page,
  	  	//not target page)
   		 window.alert( 'Please click OK then press Ctrl+D to create a bookmark' );
	} 
	else 
	{
 	   //other browsers - tell them to add a bookmark (adds current page, not target page)
  	  window.alert( 'Please use your browser\'s bookmarking facility to create a bookmark' );
	}	
	return false;
}

/* 
 * openHelp()		: Function used to pop up the help window for Toolbar
 * Author 			: Ashutosh Belhekar
 */


function openHelp(contextRoot,chIdent)
{
	var url;
	url = contextRoot + "/jsp/common/toolbar_help.jsp?chIdent=" + chIdent;
	showModalDialog(url,window,"status:no;dialogWidth:50em;dialogHeight:25em");
	
}





function OpenCloseHelp() {
	var browser = "NotIE";
	if(document.all) {
		browser = "IE";
	}
	help = document.getElementById('hlpTool');
	if(help.style.display==''){
		help.style.display='none';
	}else{
		if(browser=="IE"){
			help.style.left = 608;
			help.style.top  = 170;
		}else{
			help.style.left = -108;
			help.style.top  = 170;
		}
		help.style.display='';
	}
//	if ( helpFlag == true) {
//		document.getElementById('hlpToolDiv').style.display='none';
//		helpFlag = false;
//	}
//	else {
//		document.getElementById('hlpToolDiv').style.display='';
//		helpFlag = true;
//	}
}
function openfeedback()
{
	var websealJunction = junctionName(); //getWebsealJunction();
	if (siteAudience=="Employees") {
		var fbDir = "/dcms/"
		if (channel == "whatsnew") {
			fbDir='/webserv/'
		}
		displayPopUp(websealJunction + fbDir + channel + '.nsf/frmFeedback?OpenForm',800,500,'DCMSFeedback');
	} else if (document.URL.indexOf("ifgbonds") > -1){
		displayPopUp('/servlet/dcms?c=ifgbonds&rkey=27',800,500,'contactus');
	} else if (document.URL.indexOf("heritage") > -1){
		displayPopUp('/apps/contactus/contact_us.cfm?sendto=heritage@ffic.com',600,600,'contactus');		
	}else {
		displayPopUp('/servlet/dcms?c=about&req=ContactUs',800,500,'contactus');
	}
}

