function clrpasswd()
{
	var pwd = $('psdclr');
	if ( pwd == null )
		return;
	pwd.value="";
}

function doMenuHeight()
{
	var menuDiv = $('left-menu-section');
	if ( menuDiv == null )
		return;
	var menuHeight = menuDiv.offsetHeight;

	var contentDiv = $('contentSection');
	var contentHeight = contentDiv.offsetHeight;
	var difference = contentHeight - menuHeight;
	var differenceStr = difference + 'px';
	
	menuDiv.style.paddingBottom=differenceStr;
}

function doIndexHeight()
{
	var indexLeftMid = $('indexLeftMid');
	var indexRightMid = $('indexRightMid');

	if ( ( indexLeftMid == null ) || ( indexRightMid == null ) )
	{
		return;
	}
	var generalDeficit=0;
	if ( indexRightMid.offsetHeight > indexLeftMid.offsetHeight )
	{
		var leftHeightDeficit  = indexRightMid.offsetHeight - indexLeftMid.offsetHeight;
		var RightHeightDeficit = 0;

		if ( indexRightMid.offsetHeight < 400 )
		{
			generalDeficit = 400 - indexRightMid.offsetHeight;
		}
	}
	else
	{
		var RightHeightDeficit  = indexLeftMid.offsetHeight - indexRightMid.offsetHeight;
		var leftHeightDeficit = 0;

		if ( indexLeftMid.offsetHeight < 400 )
		{
			generalDeficit = 400 - indexLeftMid.offsetHeight;
		}
	}
	
	indexLeftMid.style.paddingBottom = 40 + leftHeightDeficit + generalDeficit + 'px';
	indexRightMid.style.paddingBottom = 40 + RightHeightDeficit + generalDeficit + 'px';
	
}


var Rollover = Class.create({
    initialize: function(id, options) {
        this.id = id;
		if ( $(this.id) != null )
		{
			this.origsource = $(this.id).src;
			this.setOptions(options);
			this.preloadRollover();
	//        this.rollbackImage();
			this.observeMouse();
		}
},

    setOptions: function(options) {
        this.options = {
            prefix: 'hover-'
        };
        Object.extend(this.options, options || {});
    },

    observeMouse: function() {
        $(this.id).observe('mouseover', this.rolloverImage.bindAsEventListener(this));
        $(this.id).observe('mouseout', this.rollbackImage.bindAsEventListener(this));
    },

    preloadRollover: function() {
        this.preload = new Image();
        this.preload.setAttribute('src',this.parseRollbackSource());
        this.preload_orig = new Image();
        this.preload_orig.setAttribute('src',this.origsource);
    },

    parseRollbackSource: function()
    {
        path = this.origsource.match(/(.*)\/(.*\.(png|gif|jpg))/)[1];
        filename = this.origsource.gsub(path, '').substr(1);
        return path + '/' + this.options.prefix + filename;
    },

    rolloverImage: function(e) {
        $(this.id).setAttribute('src',this.parseRollbackSource());
    },

    rollbackImage: function(e) {
        $(this.id).setAttribute('src',this.origsource);
    }
});




function initPage()
{
	doMenuHeight();
	new Rollover('roll0');
	new Rollover('roll1');
	new Rollover('roll2');
	new Rollover('roll3');
	e = $('xSearch');
	if( e )
	{
		e.focus();
	}
	else
	{
		e = $('grabFocus');
		if( e )
		{
			e.focus();
		}
	}
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=600');");
}


Event.observe( window, 'load', initPage );
