// Gmail Fixed Navigation
// version 0.9.3 BETA!
// 2007/09/07
// Copyright (c) 2007, Hiroyuki Nakamura <hiroyuki@maloninc.com>
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
//
// --------------------------------------------------------------------
//
// ==UserScript==
// @name           Gmail Fixed Navigation
// @namespace      http://www.maloninc.com/greasemonkey/
// @description    To fix gmail navigation menu
// @include        http*://mail.google.*/*mail/*
// @include        http*://mail.google.com/a/*
// ==/UserScript==

function fixMenu() {
	var cont = document.getElementById('co');
	var menu = document.getElementById('nav');
	if (cont != null && menu !=null){
		cont.style.marginLeft = "20ex";
		menu.style.overflowX = "hidden";
		menu.style.overflowY = "auto";
		menu.style.position = "fixed";
		menu.style.height   = document.body.clientHeight - 59;
		menu.style.width = "20ex"; 
		menu.style.zIndex = 1; 
	}else{
		setTimeout(fixMenu, 500);
	}
}

function fixCompose(){
	var comp = document.getElementById('cm_compose');
	var cont = document.getElementById('co'); 
	var foot = document.getElementById('ft');
	if (comp != null && cont != null && foot != null){
		comp.style.paddingLeft = "31px";
		foot.parentNode.style.paddingLeft = "20ex";
	}else{
		setTimeout(fixCompose, 500);
	}
}

function fixLogo() {
	var ds = document.getElementById('ds_inbox');
	if (ds !=null){
		ds.style.position = "fixed";
		ds.style.paddingTop = 0; 
	}else{
		setTimeout(fixLogo, 500);
	}
}

function fixArrow() {
	var arrow = document.getElementById('ar');
	var foot  = document.getElementById('ft');
	if (arrow != null && foot != null) {
		arrow.style.left = "200px";
		arrow.style.top = "140px";
		foot.parentNode.style.paddingLeft = "20ex";
	} else {
		setTimeout(fixArrow, 500);
	}
}

fixLogo();
fixMenu();
fixCompose();
fixArrow();

