﻿// Nifty Little Helpers
//
// Mootools 1.11 Multibox
var box = {};
window.addEvent('domready', function(){
	box = new MultiBox('mb', {useOverlay: true});
});

// External Links
window.addEvent('domready', function() {
	if (!document.getElementsByTagName) {
    	return null;
    	}
    var anchors = document.getElementsByTagName("a");
    	for (var i=0;i < anchors.length;i++) {
    		var anchor = anchors[i];
                if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
                    anchor.setAttribute("target", "_blank");
                	}
            }
        });

// Popups
function newWin(file,name,win_width,win_height) {
	pos_x = screen.availWidth - win_width - 40;
	pos_y=40;
	resizeflag="yes";
	if(navigator.appName.substring(0,8)=="Netscape" && parseInt(navigator.appVersion)==4) resizeflag="no";
	win_options = "height=" + win_height;
	win_options += ",width=" + win_width;
	win_options += ",left=" + pos_x;
	win_options += ",top=" + pos_y;
	win_options += ",toolbar=no";       
	win_options += ",location=no";    
	win_options += ",directories=no"; 
  win_options += ",status=no";    
  win_options += ",menubar=no";     
  win_options += ",scrollbars=yes";
  win_options += ",resizable=" + resizeflag;  
  win_options += ",dependent";      
  window.open(file,name,win_options);
}

function newPictureWin(file,win_width,win_height) {
	pos_x = 10;
	pos_y = 10;
	resizeflag="yes";
	if(navigator.appName.substring(0,8)=="Netscape" && parseInt(navigator.appVersion)==4) resizeflag="no";
	win_options = "height=" + win_height + 100;
	win_options += ",width=" + win_width + 10;
	win_options += ",left=" + pos_x;
	win_options += ",top=" + pos_y;
	win_options += ",toolbar=no";       
	win_options += ",location=no";    
	win_options += ",directories=no"; 
  win_options += ",status=no";    
  win_options += ",menubar=no";     
  win_options += ",scrollbars=yes";
  win_options += ",resizable=" + resizeflag;  
  win_options += ",dependent";      
  window.open(file,"Zoom",win_options);
}

function toggleCaption(section) {
	// alert('toggleCaption ' + section);

	// overflow
	if(document.getElementById(section).style.visibility=="visible") {
		document.getElementById(section).style.visibility="hidden";
	}
	else {
		document.getElementById(section).style.visibility="visible";
		// document.getElementById(section).style.display = "block";
	}

	return false;
}
		
function showToolhint(section, hint) {

	document.getElementById(section).innerHTML = hint;
	
	return false;
}