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


function align(items, target, shift) {
	if (!items || !target || items.length == 0) return;
	items.each(function(item)
	{
		if (item.offsetHeight <= (target.offsetHeight + shift) )
		{
			item.style.height = (target.offsetHeight + shift) + 'px';
		} 
	});

}

function sameHeight(items, shift)
{
  var max = 0;
  if (!items || items.length == 0) return;
  items.each(function(item) { 
    if (max < item.offsetHeight) max = item.offsetHeight;
  });
  items.each(function(item) {
    item.style.height = (max + shift) + "px";
  });
}

function quick_go( quickObj )
{
	var item = quickObj.selectedIndex ;
	var url = quickObj.options[ item ].value ;
	if (url != "0") window.location.href = url ;
}

function initMaster() 
{
	var alignItems = $$('.aligned');
	var menu = $('menu-sub');
  align(alignItems, menu, -12);
	alignItems = $$('.aligned-2');
  align(alignItems, menu, -12);
  sameHeight($$('.columns2 .inner'), -12);
   // document.body.style.height = document.documentElement.scrollHeight + 'px';

    // Instantiate the Dialog
    var errors = $$('#dialogLogin .error');
    var viewDialog = false;
    errors.each(function(item) {
      if (item.innerHTML.length > 5) viewDialog = true;
    });
      
    
    YAHOO.dialogLogin = new YAHOO.widget.Dialog("dialogLogin", 
        { 
            width : "218px",
            fixedcenter : true, 
            visible : viewDialog, 
            modal : true,
            underlay: "none",
            constraintoviewport : true,
            postmethod: "form"  
       } 
    );

    YAHOO.dialogLogin.render();
}
