// Sharing short cut menu on the right of the page
// the highlight decision is made by interpreting the page's parent directory from the url
var h1 = '<tr><td style="background-color:#ffcc66;color:#993333;" class="boxtext" width="100%" nowrap>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
var h2 = '</td></tr>';
var d1 = '<tr onmouseover="this.style.backgroundColor=\'#fedbb5\';this.style.cursor=\'pointer\';" onmouseout="this.style.backgroundColor=\'white\';" onclick="location.href=\'';
var d2 = '\'"><td nowrap>&nbsp;<img src="http://lc.ust.hk/common_img/gray_dot.gif" style="vertical-align:middle">&nbsp;<span class="purplenav">';
var d3 = '</span></td></tr>';
var v1 = '<tr onmouseover="this.style.backgroundColor=\'#fedbb5\';this.style.cursor=\'pointer\';" onmouseout="this.style.backgroundColor=\'white\';" onclick="window.open(\'';
var v2 = '\')"><td nowrap>&nbsp;<img src="http://lc.ust.hk/common_img/gray_dot.gif" style="vertical-align:middle">&nbsp;<span class="purplenav">';
var s = '';
var cp = document.URL.split('/')[4].toLowerCase();  // Current page
var root = true;
if( cp=='welcome.html' || /^welcome/.test(cp)==true ) {
    s += h1 + 'Welcome' + h2;
    root = false;
} else {
    s += d1 + 'http://lc.ust.hk/~sac/welcome.html' + d2 + 'Welcome' + d3;
}
if( cp=='activity' || cp=='activities' || cp=='sacact.html' ) {
    s += h1 + 'Activities' + h2;
    root = false;
} else {
    s += d1 + 'http://lc.ust.hk/~sac/sacact.html' + d2 + 'Activities' + d3;
}
if( cp=='adviser' || cp=='sacadviser.html' ) {
    s += h1 + 'SAC Advisers' + h2;
    root = false;
} else {
    s += d1 + 'http://lc.ust.hk/~sac/sacadviser.html' + d2 + 'SAC Advisers' + d3;
}
//s += v1 + 'http://vela.ust.hk/' + v2 + 'VELA' + d3;
if( cp=='sheet' || cp=='sacadsheet.html' ) {
    s += h1 + 'Support Documents' + h2;
    root = false;
} else {
    s += d1 + 'http://lc.ust.hk/~sac/sacadsheet.html' + d2 + 'Support Documents' + d3;
}
if( cp=='material' || cp=='materials' || cp=='sacmat.html' ) {
    s += h1 + 'Materials' + h2;
    root = false;
} else {
    s += d1 + 'http://lc.ust.hk/~sac/sacmat.html' + d2 + 'Materials' + d3;
}
if( cp=='guide' || cp=='sacguide.html') {
    s += h1 + 'User\'s Guide' + h2;
    root = false;
} else {
    //s += d1 + 'http://lc.ust.hk/~sac/sacguide.html' + d2 + 'User\'s Guide' + d3;
	s += d1 + 'http://lc.ust.hk/~sac/guide/environment.html' + d2 + 'User\'s Guide' + d3;
}
if( cp=='project' ) {
    s += h1 + 'Projects' + h2;
    root = false;
} else {
    s += d1 + 'http://lc.ust.hk/~sac/project/' + d2 + 'Projects' + d3;
}
if( cp=='new' ) {
    s += h1 + 'What\'s New' + h2;
    root = false;
} else {
    s += d1 + 'http://lc.ust.hk/~sac/new/new.htm' + d2 + 'What\'s New' + d3;
}
if( root ) {
    s = h1 + 'Language Commons' + h2 + s;
} else {
    s = d1 + 'http://lc.ust.hk/~sac/' + d2 + 'Language Commons' + d3 + s;
}
document.write('<table cellpadding=2 cellspacing=0 style="border:solid 1px #ffcc66;width:145px;">' + s + '</table>');
