//menu items
var menu=Array();
menu[0]=Array();
menu[0]['name']='Contents';
menu[0][0]='Introduction';
menu[0][1]='iSoftPhone Console navigation';
menu[1]=Array();
menu[1]['name']='Setup/Configuration';
menu[1][0]='How do I install iSoftPhone?';
menu[1][1]='How to make free calls to other iSoftPhone users?';
menu[1][2]='How to configure iSoftPhone to use a SIP provider?';
menu[1][3]='Settings';
menu[1][4]='Advanced Settings';
menu[1][5]='Network Routing';
menu[1][6]='What is a VoIP codec?';
menu[1][7]='CRM Integration with Daylite';
menu[1][8]='External Line Prefix for local PABX';
menu[2]=Array();
menu[2]['name']='Call Features';
menu[2][0]='Call Features';
menu[2][1]='Making a conference call';
menu[2][2]='Hotkeys';
menu[2][3]='Line States';
menu[2][4]='Web Call Back';
menu[3]=Array();
menu[3]['name']='Address Book';
menu[3][0]='How do I add contacts to the Address Book?';
menu[3][1]='How to view contacts using Bonjour?';
menu[3][2]='Synchronizing iSoftPhone with Exchange - Address Book 4.0';
menu[3][3]='Using LDAP with iSoftPhone for AddressBook 4.0';
menu[3][4]='Synchronizing iSoftPhone with Exchange LDAP - Address Book 5.0';
menu[4]=Array();
menu[4]['name']='Call History';
menu[4][0]='How do I view the call history?';
menu[4][1]='Adding to the Address Book, deleting call history';
menu[5]=Array();
menu[5]['name']='Searching';
menu[5][0]='How do I find a number or a person?';
menu[6]=Array();
menu[6]['name']='Customise';
menu[6][0]='Can I customise iSoftPhone?';
menu[7]=Array();
menu[7]['name']='SMS and IM Chat';
menu[7][0]='Sending SMS and IM Chat';
menu[8]=Array();
menu[8]['name']='Privacy & Presence';
menu[8][0]='Privacy Rule & Presence';
menu[9]=Array();
menu[9]['name']='Applescript';
menu[9][0]='Applescript';
menu[10]=Array();
menu[10]['name']='Voicemail';
menu[10][0]='Voicemail';
menu[11]=Array();
menu[11]['name']='Troubleshooting';
menu[11][0]='Troubleshooting';
menu[11][1]='Connection problem';
menu[11][2]='DTMF - Interaction with Auto-Attendant';

//menu links
var path='html_docs/';
var links=Array();
links[0]=Array();
links[0][0]='Introduction.html';
links[0][1]='A quick guide to the iSoftPhone console.html';
links[1]=Array();
links[1][0]='How do I install iSoftPhone.html';
links[1][1]='How to make free calls to other iSoftPhone users.html';
links[1][2]='How to configure iSoftPhone to use a SIP provider.html';
links[1][3]='Settings.html';
links[1][4]='Advanced Settings.html';
links[1][5]='Network Routing.html';
links[1][6]='What is a VoIP codec.html';
links[1][7]='CRM Integration with Daylite.html';
links[1][8]='External Line Prefix for local PABX.html';
links[2]=Array();
links[2][0]='Call Features.html';
links[2][1]='Making a conference call.html';
links[2][2]='Hotkeys.html';
links[2][3]='Line States.html';
links[2][4]='Web Call Back.html';
links[3]=Array();
links[3][0]='How do I add contacts to the Address Book.html';
links[3][1]='How to view contacts using Bonjour.html';
links[3][2]='Synchronizing iSoftPhone with Exchange - Address Book 4.0.html';
links[3][3]='Using LDAP with iSoftPhone for AddressBook 4.0.html';
links[3][4]='Synchronizing iSoftPhone with Exchange LDAP - Address Book 5.0.html';
links[4]=Array();
links[4][0]='How do I view the call history.html';
links[4][1]='Adding to the Address Book, deleting call history.html';
links[5]=Array();
links[5][0]='How do I find a number or a person.html';
links[6]=Array();
links[6][0]='Can I customise iSoftPhone.html';
links[7]=Array();
links[7][0]='Sending SMS and IM Chat.html';
links[8]=Array();
links[8][0]='Privacy Rule and Presence.html';
links[9]=Array();
links[9][0]='Applescript.html';
links[10]=Array();
links[10][0]='Voicemail.html';
links[11]=Array();
links[11][0]='Troubleshooting.html';
links[11][1]='Connection problem.html';
links[11][2]='DTMF - Interaction with Auto-Attendant.html';

//show main menu function 
function showMainMenu() {
var content='<TABLE WIDTH="100%" CELLSPACING="1" CELLPADDING="0">';
	for (i=0;i<menu.length;i++) {
		content+='<TR><TD><A HREF="javascript:top.CONTROL.loadMenu('+i+',0,\'\')">'+menu[i]['name']+'</A></TD></TR>';
	}
	content+='</TABLE>';
	document.getElementById('menu-content').innerHTML=content;
}

//load frame functions
function loadMenu(x,y,z) {
	m=x; s=y; a=z;
	top.MAINMENU.location.replace('./frames.html');
}

function showContent(m,s) {
var content='<TABLE WIDTH="100%" CELLSPACING="1" CELLPADDING="0">';
	for (i=0;i<menu.length;i++) {
		if (i==m) {
			content+='<TR><TD COLSPAN="2">'+menu[i]['name']+'</TD></TR>';
			for (j=0;j<menu[i].length;j++) {
				if (j==s) content+='<TR CLASS="submenu"><TD WIDTH="1%">'+(i+1)+'.'+(j+1)+'</TD><TD CLASS="submenu" style="color:#FF6B6B">'+menu[i][j]+'</TD></TR>'; else content+='<TR CLASS="submenu"><TD WIDTH="1%">'+(i+1)+'.'+(j+1)+'</TD><TD CLASS="submenu"><A HREF="javascript:top.CONTROL.callMenu('+i+','+j+',\'\')">'+menu[i][j]+'</A></TD></TR>';
			}
		} else content+='<TR><TD COLSPAN="2"><A HREF="javascript:top.CONTROL.callMenu('+i+',0,\'\')">'+menu[i]['name']+'</A></TD></TR>';
	}
	content+='</TABLE>';
	top.MAINMENU.MENU.document.getElementById('menu-content').innerHTML=content;
}

//show menu function
function callMenu(m,s,a) {
	showContent(m,s);
	top.MAINMENU.MAIN.location.replace('./'+path+links[m][s]+a);
}

//show menu function
function showMenu(m,s,a) {
	showContent(m,s);
	top.MAINMENU.MAIN.location.replace('./'+links[m][s]+a);
	
}

//force frames function
function forceFrames() {
	if (window.self==parent.window) {
		var str=location.href.substring(location.href.lastIndexOf('/')+1,location.href.length);
		location.replace('../iSoftPhone Help Guide.html'+'#'+str);
	}
}

//find indexes function
function findIndexes(str) {
var str2;
	while (str.indexOf('%20')>-1) str = str.replace('%20',' ');
	for (i=0;i<links.length;i++) {
		for (j=0;j<links[i].length;j++) {
			str2 = links[i][j];
			if (str2.substring(str2.lastIndexOf('/')+1,str2.length)==str) {
				m=i;
				s=j;
				found=true;
			}
		}
	}
}

//resize images function
function resizeImages() {
	divs = document.getElementsByTagName("div");
	for (i=0;i<divs.length;i++) divs[i].style.width=document.body.clientWidth-2+'px';
}
