var the_timeout;
var the_timeout2;

function expand_xhtml() {
	var the_style = getStyleObject("xhtml");
	if (the_style) {
		var current_right = parseInt(the_style.right);
		
		if (current_right == 82) {
			contract_xhtml();
		} else {
			var new_right = current_right + 4;
			if (document.layers) {
				the_style.right = new_right;
			} else  {
				the_style.right = new_right + "px";
			}
			if (new_right < 82) {
				the_timeout = setTimeout('expand_xhtml();',1);
			}
		}
	}
}
function contract_xhtml() {
	var the_style = getStyleObject("xhtml");
	var current_right = parseInt(the_style.right);
	var new_right = current_right - 4;
	if (document.layers) {
		the_style.right = new_right;
	} else  {
		the_style.right = new_right + "px";
	}
	if (new_right > 2) {
		the_timeout2 = setTimeout('contract_xhtml();',1);
	}
}

function expand_css() {
	var the_style = getStyleObject("css");
	if (the_style) {
		var current_right = parseInt(the_style.right);
		
		if (current_right == 161) {
			contract_css();
		} else {
			var new_right = current_right + 6;
			if (document.layers) {
				the_style.right = new_right;
			} else  {
				the_style.right = new_right + "px";
			}
			if (new_right < 161) {
				if (new_right == 158) {
					the_style.right = 161 + "px";
				} else {
					the_timeout = setTimeout('expand_css();',1);
				}
				
			}
		}
	}
}
function contract_css() {
	var the_style = getStyleObject("css");
	var current_right = parseInt(the_style.right);
	var new_right = current_right - 6;
	if (document.layers) {
		the_style.right = new_right;
	} else  {
		the_style.right = new_right + "px";
	}
	if (new_right > 2) {
		if (new_right == 5) {
			the_style.right = 2 + "px";
		} else {
			the_timeout2 = setTimeout('contract_css();',1);
		}

	}
}

function expand_rss() {
	var the_style = getStyleObject("rss");
	if (the_style) {
		var current_right = parseInt(the_style.right);
		
		if (current_right == 240) {
			contract_rss();
		} else {
			var new_right = current_right + 8;
			if (document.layers) {
				the_style.right = new_right;
			} else  {
				the_style.right = new_right + "px";
			}
			if (new_right < 240) {
				if (new_right == 234) {
					the_style.right = 240 + "px";
				} else {
					the_timeout = setTimeout('expand_rss();',1);
				}
				
			}
		}
	}
}
function contract_rss() {
	var the_style = getStyleObject("rss");
	var current_right = parseInt(the_style.right);
	var new_right = current_right - 8;
	if (document.layers) {
		the_style.right = new_right;
	} else  {
		the_style.right = new_right + "px";
	}
	if (new_right > 2) {
		if (new_right == 8) {
			the_style.right = 2 + "px";
		} else {
			the_timeout2 = setTimeout('contract_rss();',1);
		}
	}
}

function expand_rss_feed() {
	var the_style = getStyleObject("rss_feed");
	if (the_style) {
		var current_right = parseInt(the_style.right);
		
		if (current_right == 319) {
			contract_rss_feed();
		} else {
			var new_right = current_right + 10;
			if (document.layers) {
				the_style.right = new_right;
			} else  {
				the_style.right = new_right + "px";
			}
			if (new_right < 319) {
				if (new_right == 312) {
					the_style.right = 319 + "px";
				} else {
					the_timeout = setTimeout('expand_rss_feed();',1);
				}
				
			}
		}
	}
}
function contract_rss_feed() {
	var the_style = getStyleObject("rss_feed");
	var current_right = parseInt(the_style.right);
	var new_right = current_right - 10;
	if (document.layers) {
		the_style.right = new_right;
	} else  {
		the_style.right = new_right + "px";
	}
	if (new_right > 2) {
		if (new_right == 9) {
			the_style.right = 2 + "px";
		} else {
			the_timeout2 = setTimeout('contract_rss_feed();',1);
		}
	}
}

function expand_php() {
	var the_style = getStyleObject("php");
	if (the_style) {
		var current_right = parseInt(the_style.right);
		
		if (current_right == 398) {
			contract_php();
		} else {
			var new_right = current_right + 12;
			if (document.layers) {
				the_style.right = new_right;
			} else  {
				the_style.right = new_right + "px";
			}
			if (new_right < 398) {
				if (new_right == 398) {
					the_style.right = 398 + "px";
				} else {
					the_timeout = setTimeout('expand_php();',1);
				}
				
			}
		}
	}
}
function contract_php() {
	var the_style = getStyleObject("php");
	var current_right = parseInt(the_style.right);
	var new_right = current_right - 12;
	if (document.layers) {
		the_style.right = new_right;
	} else  {
		the_style.right = new_right + "px";
	}
	if (new_right > 2) {
		if (new_right == 2) {
			the_style.right = 2 + "px";
		} else {
			the_timeout2 = setTimeout('contract_php();',1);
		}
	}
}

function expand_mysql() {
	var the_style = getStyleObject("mysql");
	if (the_style) {
		var current_right = parseInt(the_style.right);
		
		if (current_right == 477) {
			contract_mysql();
		} else {
			var new_right = current_right + 14;
			if (document.layers) {
				the_style.right = new_right;
			} else  {
				the_style.right = new_right + "px";
			}
			if (new_right < 477) {
				if (new_right == 464) {
					the_style.right = 477 + "px";
				} else {
					the_timeout = setTimeout('expand_mysql();',1);
				}
				
			}
		}
	}
}
function contract_mysql() {
	var the_style = getStyleObject("mysql");
	var current_right = parseInt(the_style.right);
	var new_right = current_right - 14;
	if (document.layers) {
		the_style.right = new_right;
	} else  {
		the_style.right = new_right + "px";
	}
	if (new_right > 2) {
		if (new_right == 15) {
			the_style.right = 2 + "px";
		} else {
			the_timeout2 = setTimeout('contract_mysql();',1);
		}
	}
}
function getStyleObject(objectId) {
	// cross-browser function to get an object's style object given its
	if(document.getElementById && document.getElementById(objectId)) {
		// W3C DOM
		return document.getElementById(objectId).style;
	} else if (document.all && document.all(objectId)) {
		// MSIE 4 DOM
		return document.all(objectId).style;
	} else if (document.layers && document.layers[objectId]) {
		// NN 4 DOM.. note: this won't find nested layers
		return document.layers[objectId];
	} else {
		return false;
	}
}

function gotoSite(obj) {
	var comic;
	comic=obj.options[obj.selectedIndex].value
	location.href=comic;
}

// Set up left (37) and right (39) arrows to go to the previous/next
// message.
setKeybinding(37, 'arrowHandler');
setKeybinding(39, 'arrowHandler');

function arrowHandler(e, key)
{
    if (!document.getElementById || e.altKey || e.shiftKey || e.ctrlKey) {
        return false;
    }

    var loc;
    if (key == 37) {
        loc = document.getElementById('back_key');
    } else if (key == 39) {
        loc = document.getElementById('next_key');
    }

    if (loc) {
        document.location.href = loc.href;
    }
    return true;
}

