var lastLink="";
var lastSection="";
var lastSub="";

function clickMenu(name)
{
	currentClass=document.getElementById(name).className;
	if(lastSection!="")
	{
		document.getElementById(lastSection).className="helpHidden";
	}
	lastSection=name;

	if(currentClass=="helpHidden")
	{
		document.getElementById(name).className="helpShow";
	}
	else
	{
		document.getElementById(name).className="helpHidden";
	}
}

function clickSub(name)
{
	currentClass=document.getElementById(name).className;
	if(lastSub!="")
	{
		document.getElementById(lastSub).className="helpHidden";
	}
	lastSub=name;

	if(currentClass=="helpHidden")
	{
		document.getElementById(name).className="helpShow";
	}
	else
	{
		document.getElementById(name).className="helpHidden";
	}
}

function clickLink(name, url)
{
	if(lastLink!="")
	{
		document.getElementById(lastLink).className="helpItem";
	}
	document.getElementById(name).className="helpActive";
	parent.content.location=url;
	lastLink=name;
}

function closeAll()
{
	if(lastLink!="")
	{
		document.getElementById(lastLink).className="helpItem";
	}
	lastLink="";
	if(lastSub!="")
	{
		document.getElementById(lastSub).className="helpHidden";
	}
	lastSub="";
	if(lastSection!="")
	{
		document.getElementById(lastSection).className="helpHidden";
	}
	lastSection="";
	parent.content.location.replace("cover.php");

}

function airlines()
{
	url='../supportedAirlines.php';
	openEditWindow(url,'Airlines',400,400,'no');
}

function openEditWindow(url,name,wd,ht,statusbar)
{
	x=0;
	y=0;
	if(window.outerWidth)
	{
		xAvail=window.outerWidth;
		if(wd>xAvail){wd=xAvail;}
		yAvail=window.outerHeight;
		if(ht>yAvail){ht=yAvail;}
		x=((xAvail-wd)/2);  
		y=((yAvail-ht)/2);
	}
	else if(document.documentElement.clientWidth)
	{
		xAvail=document.documentElement.clientWidth;
		if(wd>xAvail){wd=xAvail;}
		yAvail=document.documentElement.clientHeight;
		if(ht>yAvail){ht=yAvail;}
		xp=window.screenLeft;
		yp=window.screenTop;
		x=((xAvail-wd)/2)+xp;  
		y=((yAvail-ht)/2)+yp;
	}
	if(window.screenX)
	{
		x+=window.screenX;
		y+=window.screenY;
	}

	//if(x<0){x=0;}
	if(y<0){y=0;}
	winProp= 'width=' + wd + ',';
	winProp+='height=' + ht + ',';
	winProp+='left=' + x + ',';
	winProp+='top=' + y + ',';
	winProp+='status=' + statusbar + ',';
	winProp+='resizable=yes,scrollbars=yes';
	editWin=window.open(url,name,winProp);
	editWin.focus();
}

function sendMail(address, subject)
{
	addr=new Array();
	addr[1]='subscribe';
	addr[2]='development';
	addr[3]='security';
	addr[4]='support';
	em=addr[address]+'@';
	em=em+'pilotlog';
	em=em+'.';
	em=em+'co';
	em=em+'.';
	em=em+'uk';
	window.location.replace('mailto:'+em+'?subject='+subject);
}
