/**************** ZIDweb JavaScript *******************/
/*********** http://www.univie.ac.at/ZID/ *************/

//*** Capslock check ***
function capsError( capsEngaged ) {
	if( capsEngaged ){
		document.getElementById('capslock').style.visibility = 'visible';
	} else {
		document.getElementById('capslock').style.visibility = 'hidden';
	}
}

function capsDetect( e ) {
	if( !e ) { e = window.event; } if ( !e ) { MWJ_say_Caps( false ); return; }
	var theKey = e.which ? e.which : ( e.keyCode ? e.keyCode : ( e.charCode ? e.charCode : 0 ));
	var theShift = e.shiftKey || ( e.modifiers && ( e.modifiers & 4 ) ); 
	MWJ_say_Caps(( theKey > 64 && theKey < 91 && !theShift ) || ( theKey > 96 && theKey < 123 && theShift ));
}

function MWJ_say_Caps( oC ) {
	if( typeof( capsError ) == 'string' ) { if( oC ) { alert( capsError ); } } else { capsError( oC ); }
}

//*** Tooltips ***
$.fn.cluetip.defaults.width = 350;
$.fn.cluetip.defaults.cluetipClass = 'jtip';
$.fn.cluetip.defaults.arrows = true;
$.fn.cluetip.defaults.closePosition = 'title';
$.fn.cluetip.defaults.closeText = '<img src="/ZID/img/close.png" alt="X" />';

$(document).ready(function() {
	$('.tt_title').cluetip({  splitTitle: '  ' });
	$('.tt_extern').cluetip({ local: false, sticky: true, width: '320px' });
	$('.tt_handy').cluetip({  local: false, width: '160px', dropShadow: false, positionBy: 'mouse', tracking: true, clickThrough: true, leftOffset: 30 });
	$('.tt_mouse').cluetip({  arrows: false, positionBy: 'mouse', tracking: true, leftOffset: 22 });
	$('.tt_height').cluetip({ local: false, sticky: true, width: '500px', height: '400px' });
	$('.tt_click').cluetip({  local: false, sticky: true, width: '400px', activation: 'click' });
	$('.tt_pers').cluetip({   local: false, sticky: true, width: '400px', height: '280px', activation: 'click' });
	$('.tt_local').cluetip({  local: true, sticky: true, width: '600px', activation: 'click', cursor: 'pointer' });
});

//*** Lightbox ***
Shadowbox.init({
	animate: false,
	animateFade: false,
	flashParams: 0,
	resizeDuration: 0,
	initialHeight: 280,
	initialWidth: 400,
	overlayColor: "#999",
	overlayOpacity: "0.6",
	viewportPadding: 60
});

