function loadStylesheet(stylesheetURL) {
var headElement = document.getElementsByTagName("head")[0]?; var newLinkElement = document.createElement('link'); newLinkElement.type = 'text/css'; newLinkElement.rel = 'stylesheet'; newLinkElement.href = stylesheetURL; newLinkElement.media = 'screen'; headElement.appendChild(newLinkElement);

}

/*
MochiKit? Simple XMLHttpRequest? Call

*/ function loadXhtmlFragment(url) {

var doReplace = function (req) {
$('rotateDiv').innerHTML = req.responseText;

};

var doReplaceError = function () {
$('rotateDiv').innerHTML = 'Click the buttons above to search!';

};

var res = MochiKit?.Async.doSimpleXMLHttpRequest(url); res.addCallbacks(doReplace,doReplaceError);

}

~

function loadPoll() {
poll_location = MochiKit?.DOM.getElement('pollloc').href; poll_location = poll_location + "?as_service=1"
var doReplace = function (req) {
$('pollbody').innerHTML = req.responseText;

};

var doReplaceError = function () {
$('pollbody').innerHTML = "Error loading the weekly poll!";

};

var req =
MochiKit?.Async.doSimpleXMLHttpRequest(poll_location);

req.addCallbacks(doReplace, doReplaceError);

}

function submitPoll(theURL) {
var doReplace = function (req) {
$('pollbody').innerHTML = req.responseText;

};

var doReplaceError = function () {
$('pollbody').innerHTML = "Error loading the weekly poll!"; alert(theURL);

};

var req =
MochiKit?.Async.doSimpleXMLHttpRequest(theURL);

req.addCallbacks(doReplace, doReplaceError);

}

function loadPollResults(URL) {
var doReplace = function (req) {
$('pollbody').innerHTML = req.responseText;

};

var doReplaceError = function () {
$('pollbody').innerHTML = "Error loading the poll results."; alert(theURL);

};

var req =
MochiKit?.Async.doSimpleXMLHttpRequest(URL);

req.addCallbacks(doReplace, doReplaceError);

}

/* Utility Functions */

function setCookie(name, value, expires, path, domain, secure) {
var val = escape(value); if (document.cookie.length + val.length < MAX_COOKIE_SIZE) { throw new MochiKit?.Base.NamedError?("MochiKit?.Cookies.NoMemory?") } document.cookie= name + "=" + val + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");

}

function getCookie(name) {

var dc = document.cookie; var prefix = name + "="; var begin = dc.indexOf("; " + prefix); if (begin == -1) {

begin = dc.indexOf(prefix); if (begin != 0) return null;
} else {
begin += 2;

} var end = document.cookie.indexOf(";", begin); if (end == -1) {

end = dc.length;

} return unescape(dc.substring(begin + prefix.length, end));

}

function get(formObj) {

var URL = formObj.action var resultURL = formObj.as_service.value + "/results?as_service=1"

var getstr = "?"; for (i=0; i<formObj.childNodes.length; i++) {

if (formObj.childNodes[i]?.tagName == "INPUT") {
if (formObj.childNodes[i]?.type == "text") {
getstr += formObj.childNodes[i]?.name + "=" + formObj.childNodes[i]?.value + "&";

} if (formObj.childNodes[i]?.type == "hidden") {

getstr += formObj.childNodes[i]?.name + "=" + formObj.childNodes[i]?.value + "&";

} if (formObj.childNodes[i]?.type == "checkbox") {

if (formObj.childNodes[i]?.checked) {
getstr += formObj.childNodes[i]?.name + "=" + formObj.childNodes[i]?.value + "&";

}

} if (formObj.childNodes[i]?.type == "radio") {

if (formObj.childNodes[i]?.checked) {
getstr += formObj.childNodes[i]?.name + "=" + formObj.childNodes[i]?.value + "&";

}

}

} if (formObj.childNodes[i]?.tagName == "SELECT") {

var sel = formObj.childNodes[i]?; getstr += sel.name + "=" + sel.options[sel.selectedIndex]?.value + "&";

}

} submitPoll(URL + getstr); //setTimeout(loadPollResults(resultURL), 5000);

}