function select_set_value (object, value) {
	if (!object.length && object.value==value) object.selected=true;
	for (var i=0; i<object.length; i++) {
		if (object[i].value==value) {
			object[i].selected=true;
			break } } }

function radio_set_value (object, value) {
	if (!object.length && object.value==value) object.checked=true;
	for (var i=0; i<object.length; i++) {
		if (object[i].value==value) {
			object[i].checked=true;
			break;
		}
	}
}

function checkbox_set_value (object, value) {
	if (!value) object.checked=true;
	if (!object.length && object.value==value) object.checked=true;
	for (var i=0; i<object.length; i++) {
		if (object[i].value==value) {
			object[i].checked=true;
		}
	}
}

function checkbox_disabled (object, disabled) {
	if (!value) object.disabled=disabled;
	if (!object.length && object.value==value) object.disabled=disabled;
	for (var i=0; i<object.length; i++) {
		object[i].disabled=disabled;
	}
}

function flash (movie, width, height) {

	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
		+ 'width="' + width + '" ' 
		+ 'height="' + height + '" '
		+ 'codebase="' + location.protocol + '//www.macromedia.com/go/getflashplayer' +'">'
		+ '<param name="movie" value="' + movie + '" />'
		+ '<param name="wmode" value="' + 'transparent' + '" />'
		+ '<embed src="' + movie + '" ' 
		+ 'width="' + width + '" '
		+ 'height="' + height + '" '
		+ 'wmode="' + 'transparent' + '" '
		+ 'type="application/x-shockwave-flash" '
		+ 'pluginspage="' + location.protocol + '//www.macromedia.com/go/getflashplayer' +'">'
		+ '</embed>'
		+ '</object>');

}

/* //////////////////////////////////////////////////////////////////////////////////////
Variables needed:
filepath, width, height, align, pluginspage, name, id, quality, wmode, bgcolor, loop
////////////////////////////////////////////////////////////////////////////////////// */ 
function flash_adv (movie, width, height, align, name, id, quality, wmode, bgcolor, loop){
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
    + 'width="' + width + '" ' 
	+ 'height="' + height + '" '
    + 'codebase="' + location.protocol + '//www.macromedia.com/go/getflashplayer' +'">'
    + '<param name="movie" value="' + movie + '" />'
	+ '<param name="quality" value="' + quality + '" />'
	+ '<param name="wmode" value="' + wmode + '" />'
    + '<param name="bgcolor" value="' + bgcolor + '" />'
	+ '<param name="loop" value="' + loop + '" />'
	+ '<param name="play" value="true" />'
    + '<embed src="' + movie + '" ' 
	+ 'bgcolor="' + bgcolor + '" '
    + 'width="' + width + '" '
	+ 'height="' + height + '" '
    + 'wmode="' + wmode + '" '
	+ 'play="true" '
    + 'loop="' + loop + '" '
    + 'quality="' + quality + '" '
    + 'allowScriptAccess="sameDomain" '
    + 'type="application/x-shockwave-flash" '
    + 'pluginspage="' + location.protocol + '//www.macromedia.com/go/getflashplayer' +'">'
    + '<\/embed>'
    + '<\/object>');
}

function window_pop_up (location, name, width, height) {

	winPop = window.open(location, name, 'width=' + width + ', height=' + height + ', toolbar=0, resizable=0, status=0');

	winPop.focus();

}

function setCookie(name, value, expire) {
          document.cookie = name + "=" + escape(value)
          + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
}

function getCookie(Name) {
          var search = Name + "="
          if (document.cookie.length > 0) { // if there are any cookies
                    offset = document.cookie.indexOf(search)
                    if (offset != -1) { // if cookie exists
                              offset += search.length
                              // set index of beginning of value
                              end = document.cookie.indexOf(";", offset)
                              // set index of end of cookie value
                              if (end == -1)
                                        end = document.cookie.length
                              return unescape(document.cookie.substring(offset, end))
                    }
          }
}

function jump_select( select ) {
    if (select.options[select.selectedIndex].value != '') { 
        window.location = select.options[select.selectedIndex].value;
    }
}

function toggleItem(id)
{
    itm = document.getElementById(id);

    if(!itm)
    {
        return false;
    }

    if(itm.style.display == 'none')
        itm.style.display = '';
    else
        itm.style.display = 'none';
    
    return false;
}

function changeTab(anchor){
    
    var tabbox = anchor;
    var target;

    while(tabbox != null && (tabbox.className == null || tabbox.className.indexOf("tabbox") == -1)){
        tabbox = tabbox.parentNode;

        if(tabbox.className.indexOf("tabname") != -1)
        {
            target = tabbox.parentNode;
        }
    }
    if(tabbox == null || target == null){
        return false;
    }
                
    
    var tag;
    for(var i = 0; i < tabbox.childNodes.length; i++){
        tag = tabbox.childNodes[i];
        
        if(tag.nodeName.toLowerCase() == "div" && tag.className != null && tag.className.indexOf("selected") > -1){
            tag.className = tag.className.replace("selected", "");
            break;
        }
    }
    
    if(target != null){
        target.className = (target.className || "") +" selected";
    }
    
    return false;
}
