function wopen(url, name, w, h){w += 32;h += 96;wleft = (screen.width - w) / 2;wtop = (screen.height - h) / 2;var win = window.open(url, name, 'width=' + w + ', height=' + h + ', ' + 'left=' + wleft + ', top=' + wtop + ', ' + 'location=no, menubar=no, ' + 'status=no, toolbar=no, scrollbars=no, resizable=no');
win.resizeTo(w, h); win.moveTo(wleft, wtop);win.focus();}
function n(url) { window.location.href=url; }
window.onload = function() {var id=Math.floor(Math.random() * 4); s(id+1); }
function co(obj) { obj.className = "menuItem_on"; }
function ct(obj) { obj.className = "menuItem_off"; }
function cso(obj) { obj.className = "submenuItem_on"; }
function cst(obj) { obj.className = "submenuItem_off"; }
function search() { var txtSearch = document.getElementById("q"); window.location.href = "/search/?q=" + encodeURIComponent(txtSearch.value);}
function sKey(event) {var key = window.event ? event.keyCode : event.which; 
if (key == 13) { search(); return false; } return true; }
function s(id) {var ss = new Array("img_set1","img_set2","img_set3", "img_set4");var i;for (i=0; i<=ss.length; i++) { if (i == (id-1)) { changeObjectVisibility(ss[i], 'visible'); } else { changeObjectVisibility(ss[i], 'hidden'); }} return false; }
function getValue(obj) { if (obj != null) { return obj.options[obj.selectedIndex].value;}}
function redirect(url) { var version = parseInt(navigator.appVersion); if (version>=4 || window.location.replace) { window.location.replace(url); } else { window.location.href = url; }}
function getStyleObject(objectId) { if(document.getElementById && document.getElementById(objectId)) { return document.getElementById(objectId).style; } else if (document.all && document.all(objectId)) {
return document.all(objectId).style; } else if (document.layers && document.layers[objectId]) {return document.layers[objectId]; } else { return false; }}
function changeObjectVisibility(objectId, newVisibility) { var styleObject = getStyleObject(objectId); if(styleObject) { styleObject.visibility = newVisibility; if (newVisibility == "visible") { styleObject.display = 'block'; } else { styleObject.display = 'none'; }
return true; } else { return false; }}
function doUploadMsg() {changeObjectVisibility('uploadMsg', 'visible');changeObjectVisibility('upload_1', 'hidden');
}
var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only

if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
	try { 
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("menu").getElementsByTagName("div"); //DynamicDrive.com change
		if(el.style.display != "block"){ //DynamicDrive.com change
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") //DynamicDrive.com change
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}} catch (e) {}
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function onloadfunction(){
try { 
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename)
if (cookievalue!="")
document.getElementById(cookievalue).style.display="block"
}
} catch(ex) {}
}

function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}

if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate
