// Suckerfish :focus routine. http://www.htmldog.com/articles/suckerfish/focus/
sfFocus = function() { var sfEls = document.getElementsByTagName("INPUT"); for (var i=0; i<sfEls.length; i++) {	sfEls[i].onfocus=function() { this.className+=" sffocus"; } 
sfEls[i].onblur=function() { this.className=this.className.replace(new RegExp(" sffocus\\b"), ""); } } }
if (window.attachEvent) window.attachEvent("onload", sfFocus);


// Ensure form only submitted a single time
//var submitted = 0;
//function singleSubmit() { if(!submitted) { submitted ++; return true; } else { return false; } }
function singleSubmit(form) { for(i=0; i<form.elements.length; i++){ if(form.elements[i].type=="submit" || form.elements[i].type=="reset"){ form.elements[i].disabled=true; } } }

function addHiddenField(element, name, value) { var field = document.createElement("input"); field.setAttribute("type","hidden"); field.setAttribute("name",name); field.setAttribute("value",value); element.appendChild(field); }

// Get Window Width
function getWindowWidth() { var windowWidth = 0; if (typeof(window.innerWidth) == 'number') { windowWidth = window.innerWidth; } else { if (document.documentElement && document.documentElement.clientWidth) { windowWidth = document.documentElement.clientWidth; } else { if (document.body && document.body.clientWidth) { windowWidth = document.body.clientWidth;	} } } return windowWidth; }

function getParameter(name){var q=document.location.search;var i=q.indexOf(name+'=');if(i==-1){return false}var r=q.substr(i+name.length+1,q.length-i-name.length-1);i=r.indexOf('&');if(i!=-1){r=r.substr(0,i)}return r.replace(/\+/g,' ')}

function getPath(script){var i,nl=document.getElementsByTagName('script');for(i=0;i<nl.length;i++){if(nl[i].src&&nl[i].src.indexOf(script)!=-1){return nl[i].src.substring(0,nl[i].src.indexOf(script))}}}