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 resizeElement(id, w, h) {
	document.getElementById(id).style.width=w;
	document.getElementById(id).style.height=h;
}

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;
}

function getElementsByClass(searchClass,node,tag) {
    var classElements = new Array();
    if ( node == null )
        node = document;
    if ( tag == null )
        tag = '*';
    var els = node.getElementsByTagName(tag);
    var elsLen = els.length;
    var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
    for (i = 0, j = 0; i < elsLen; i++) {
        if ( pattern.test(els[i].className) ) {
            classElements[j] = els[i];
            j++;
        }
    }
    return classElements;
}

function include_dom() {
    var args = Array.prototype.slice.apply(arguments);
    var script_filename = args[0];

    if( args.length > 1 ) {
        include_queue_add.apply( null, args );
    }
	
    var html_doc = document.getElementsByTagName('head').item(0);
    var js = document.createElement('script');
	js.setAttribute('language', 'javascript');
	js.setAttribute('type', 'text/javascript');
	js.setAttribute('src', script_filename);


    js.onload = function() { // Firefox
        var script = included_files[include_queue_find(script_filename)];
        script.loaded = true;
        include_queue_run( script_filename );
    }

    js.onreadystatechange = function () { // IE
        if ( (js.readyState == 'complete') || (js.readyState == 'loaded')) {
            var script = included_files[include_queue_find(script_filename)];
            script.loaded = true;
            include_queue_run( script_filename );
        }
    }

    if( /webkit/.test(navigator.userAgent.toLowerCase()) ) {
        var safariTimer = setInterval( function() {
            if ( document.readyState == "loaded" || document.readyState == "complete" ) {
				
                // If either one are found, remove the timer
                clearInterval( safariTimer );
                safariTimer = null;
				
                // and execute any waiting functions
                var script = included_files[include_queue_find(script_filename)];
                script.loaded = true;
                include_queue_run( script_filename );
            } 
        }, 10 );
    }

    html_doc.appendChild(js);


    return false;
}

function include_once() {
    var args = Array.prototype.slice.apply(arguments);
    var script_filename = args[0];
    var script = included_files[include_queue_find(script_filename)];

    if( ! script ) {
        var script = new Object;
        script.filename = script_filename;
        script.queue = new Array();
        script.loaded = false;

        included_files[included_files.length] = script;
        include_queue_add.apply(null,args);
        include_dom(script_filename);
    }
    else {
        if( script.loaded ) {
            args[1].apply( null, args.slice(2) );
        }
        else {
            include_queue_add.apply(null,args);
        }
    }

}

var included_files = new Array();

function include_queue_add() {
    var args = Array.prototype.slice.apply(arguments);
    var script_filename = args[0];

    if( args.length ) {

        var script = included_files[include_queue_find(script_filename)];

        var funcs = script.queue;

        funcs.push( args.slice(1) );
    }

}
    
function include_queue_run(script_filename) {

    var script = included_files[include_queue_find(script_filename)];

    var funcs = script.queue;

    while( funcs.length ) {
        var func_call;
        func_call = funcs.pop(); // Funcs is an array of arrays, func_pointer followed by arguments for each entry
        var func = func_call[0];
        var args = func_call.slice(1);

        func.apply( null, func_call.slice(1) )
    }

}

function include_queue_find( script_filename ) {
    for (var i = 0; i < included_files.length; i++) {
        if (included_files[i].filename == script_filename) {
            return i;
        }
    }
    return false;
}

function unique(a) {
    tmp = new Array(0);
    for(i=0;i<a.length;i++){
        if(!contains(tmp, a[i])){
            tmp.length+=1;
            tmp[tmp.length-1]=a[i];
        }
    }
    return tmp;
}

function contains(a, e) {
    for(j=0;j<a.length;j++)if(a[j]==e)return true;
    return false;
}

function flash_adv (movie, width, height, align, name, id, quality, wmode, bgcolor, loop){
	flash(movie, width, height, window.location.protocol + '//www.macromedia.com/go/getflashplayer', align, name, id, quality, wmode, bgcolor, loop);
}

if(!flash_bar_created) var flash_bar_created = false;

function create_get_flash_bar(){
    include_once('/js/swfobject.js',
        function () {
			var so = new SWFObject(undefined, undefined, undefined, undefined, 8);
			
			if((flash_bar_created!=true) && !so.installedVer.versionIsValid(so.getAttribute('version'))){
				var body = document.getElementsByTagName("body")[0];
				var div = document.createElement('div');
				div.style.backgroundColor = '#FFFFE1';
				div.style.position = 'absolute';
				div.style.zIndex = '999';
				div.style.top = '0px';
				div.style.left = '0px';
				div.style.width = body.clientWidth;
				div.style.borderBottomStyle = 'ridge';
				div.style.fontFamily = 'Tahoma, sans-serif';
				div.style.color = "#000000";
				div.style.fontSize = '9pt';
				if ( window.location.protocol == 'http:' ) {
				div.innerHTML = '<a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="" border="0" align="left" style="padding: 10px"></a>' +
								'<div style="padding: 10px;"> This website requires the latest <a href="http://www.adobe.com/go/getflashplayer">Adobe Flash Player</a>.</div>';
				}
				if ( window.location.protocol == 'https:' ) {
				div.innerHTML = '<a href="https://www.adobe.com/go/getflashplayer"><img src="https://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="" border="0" align="left" style="padding: 10px"></a>' +
								'<div style="padding: 10px;"> This website requires the latest <a href="https://www.adobe.com/go/getflashplayer"">Adobe Flash Player</a>.</div>';
				}
				body.insertBefore( div, body.firstChild );
				flash_bar_created = true
			}
		}
	);
}

if(!flash_inc) var flash_inc = 0;

function flash(movie, width, height, pluginspage, align, name, id, quality, wmode, bgcolor, loop, classname){
    flash_inc = flash_inc + 1;
    var span_id = 'flash_' + flash_inc;
    document.write('<span align="center" id="' + span_id + '" style="visibility:hidden" width="' + width + '" height:"' + height + '"></span>');
	
    include_once('/js/swfobject.js',
        function () {
            var span = document.getElementById(span_id);
            span.style.visibility = 'visible';
            var so = new SWFObject(movie, span_id, width, height, '8');
			if(pluginspage) so.addParam("pluginspage", pluginspage);
			if(align) so.addParam("align", align);
			if(name) so.addParam("name", name);
			if(id) so.addParam("id", id);
			if(quality) so.addParam("quality", quality);
			if(wmode){
				so.addParam("wmode", wmode);
			}else{
				so.addParam("wmode", "transparent");
			}
			if(bgcolor) so.addParam("bgcolor", bgcolor);
			if(loop) so.addParam("loop", loop);
			if(classname) so.addParam("classname", classname);
			so.write(span_id);
			
			create_get_flash_bar()
		}
	);
}

document.write('<img style="visibility:hidden; position:absolute;" onerror="javascript:create_get_flash_bar();" />');
document.write('<script src="/js/create_get_flash_bar.js"></script>');

function clearAuth() {
try{
  var agt=navigator.userAgent.toLowerCase();
  if (agt.indexOf("msie") != -1) {
    // IE clear HTTP Authentication
    document.execCommand("ClearAuthenticationCache");
  } 
  else {
    var xmlhttp = createXMLObject();
    xmlhttp.open("GET","#",true,"logout","");
    xmlhttp.send("");
    xmlhttp.abort();
  }
} catch(e) {
// There was an error
}
}

function createXMLObject() {
    try {
        if (window.XMLHttpRequest) {
            xmlhttp = new XMLHttpRequest();
        }
        // code for IE
        else if (window.ActiveXObject) {
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
    } catch (e) {
        xmlhttp=false
    }
    return xmlhttp;
}

function logout(url) {
	clearAuth();
	window.location=url;
}
