var userAgent = navigator.userAgent.toLowerCase();
var vBobjects = new Array();
function fetch_object(idname, forcefetch){
    vBobjects[idname] = document.getElementById(idname);
	return vBobjects[idname];
}
function toggle_collapse(objid){
    obj = fetch_object(objid);
	if (obj.style.display == "none"){ obj.style.display = ""; }
    else{ obj.style.display = "none"; }
	return false;
}


function show(objid){
    obj = fetch_object(objid);
    obj.style.display = "";
	return false;
}


function hide(objid){
    obj = fetch_object(objid);
    obj.style.display = "none";
	return false;
}


function switch_id(selectobj)
{
    var type = 'style';
    var id = selectobj.options[selectobj.selectedIndex].value;

	if (id == ''){ return; }
	var url = new String(window.location);
	var fragment = new String('');

	// get rid of fragment
	url = url.split('#');

	// deal with the fragment first
	if (url[1])
	{
		fragment = '#' + url[1];
	}

	// deal with the main url
	url = url[0];

	// remove id=x& from main bit
	if (url.indexOf(type + '=') != -1 && is_regexp)
	{
		re = new RegExp(type + "=\\d+&?");
		url = url.replace(re, '');
	}

	// add the ? to the url if needed
	if (url.indexOf('?') == -1)
	{
		url += '?';
	}
	else
	{
		// make sure that we have a valid character to join our id bit
		lastchar = url.substr(url.length - 1);
		if (lastchar != '&' && lastchar != '?')
		{
			url += '&';
		}
	}

	window.location = url + type + '=' + id + fragment;
}



function switch_fid(selectobj)
{
    var id = selectobj.options[selectobj.selectedIndex].value;
	if (id == ''){ return; }
	window.location = 'showforums.php?f=' + id;
}



function Popup(url, window_name, window_width, window_height)
{ settings=
"toolbar=no,location=no,directories=no,"+
"status=no,menubar=no,scrollbars=yes,"+
"resizable=yes,width="+window_width+",height="+window_height;

NewWindow=window.open(url,window_name,settings);
return false;
}


function subm(name,location){
   if(location){
     name = fetch_object(name);
     name.action = location;
     return name.submit();
     //name.message.value = location+location+location+location+location+location+location;
     //return true;
   }
}



function refresh_code(url){

    var Digital = new Date();
    var seconds = Digital.getMinutes()+''+Digital.getSeconds();


    document.getElementById('sec_img_load').innerHTML = "<img src='images/progress.gif' width='16' height='16' border=0>";
    document.getElementById('sec_img').src = '';
    document.getElementById('sec_img').src = url+'&'+seconds;
    setTimeout("document.getElementById('sec_img_load').innerHTML = '';",2000);
    //document.getElementById('sec_img_load').innerHTML = '';
    return false;
}