// ===========
// = Headers =
// ===========

// This method uses a dynamic attribute 'prev_src'
// to store the uri to the image before the image
// is changed to the "over" state image
// _elem => element (object, obtained via 'this')
// _op   => operand e.g. 'over' and 'out' (string)
// _img  => image name (string)
function handleHeaderRoll( _elem, _op, _img ) {
	if ( _op == "over" ) {
		_elem.setAttribute( 'prev_src', _elem.src );		
		_elem.src = '../images/headers/' + _img + '_over.gif';
		_elem.style.cursor = "pointer";
	} else {
		_elem.src = _elem.getAttribute( 'prev_src' );
		_elem.style.cursor = "";
	}
}

// This method expands and collapses content boxes
// It uses a dynamic attribute 'prev_src'
// to store the uri to the image before the image
// is changed to the "over" state image
// _elem => element (object, obtained via 'this')
// _op   => operand e.g. 'over' and 'out' (string)
// _img  => image name (string)
function handleHeaderClick( _elem, _id, _img ) {
	if ( $( _id ).style.display == "none" ) {
		_elem.src = '../images/headers/' + _img + '_opened.gif';
		$( _id ).style.display = "";
	} else {
		_elem.src = '../images/headers/' + _img + '_closed.gif';
		$( _id ).style.display = "none";
	}
	_elem.setAttribute( 'prev_src', _elem.src );		
}

// ============================
// = FLV (Flash Video Player) =
// ============================

// Displays and plays an FLV using the FLVPlayer
function playFLV( _id, _placeholder_id, _flvfile, _autostart ) {
	if ( _placeholder_id != null ) {
	  $( _placeholder_id ).height = 0;
	}
  var so = new SWFObject( '../swf/flvplayer.swf', 'flv.'+_id, 380, 312, 8, '#ffffff' );
  so.addVariable( 'file', _flvfile );
  so.addVariable( 'autostart', _autostart );
  so.addVariable( 'allowfullscreen', 'true' );
  so.useExpressInstall( '../swf/expressinstall.swf' );
	so.setAttribute( "style", ";" );
  so.write( _id );
	$( _id ).show();
}

// ============
// = Menu SWF =
// ============

function showMenu( _sel, _wuzzer ) {
  var so = new SWFObject( '../swf/header.swf', 'headerswf', 820, 110, 8, '#ffffff' );
  so.addVariable( 'xmlurl', '../swf/wuz.xml' );
  so.addVariable( 'sel', _sel );
  so.addVariable( 'wuzzer', _wuzzer );
  so.useExpressInstall( '../swf/expressinstall.swf' );
	so.setAttribute( "style", ";" );
  so.write( "flash_menu" );
	$( "flash_menu" ).show();
}

// =====================
// = Full size picture =
// =====================

function showFullSizeHint( _id, _picname ) {
  if( /MSIE/.test(navigator.userAgent) ) {
		$( "hintpic."+_id ).style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/" + _picname + "')";	
	} else {
		$( "hintpic."+_id ).style.backgroundImage = "url(../images/" + _picname + ")";	
	}
	$( "hintpic."+_id ).show();
}

function hideFullSizeHint( _id ) {
	$( "hintpic."+_id ).hide();
}

function toggleFullSizePic( _event, _id, _path ) {
	// obtain event in case of IE
	if ( !_event ) var _event = window.event;
	if ( $( "zoompic."+_id ).style.display=="none" ) {
		$( "zoompic."+_id ).src = _path;
		$( "zoompic."+_id ).setAttribute( 'start_x', _event.screenX );		
		$( "zoompic."+_id ).setAttribute( 'start_y', _event.screenY );		
		$( "zoompic."+_id ).show();
		hideFullSizeHint( _id );
	} else {
		hideFullSizePic( _event, _id, true );
	}
}

function hideFullSizePic( _event, _id, _ignore_delta ) {
	if ( !_event ) var _event = window.event;
	var elem = $( "zoompic." + _id );
	if ( $( "zoompic."+_id ).style.display!="none" ) {
		var start_x = elem.getAttribute( 'start_x' );
		var start_y = elem.getAttribute( 'start_y' );
		var page_x = elem.getAttribute( 'page_x' );
		var page_y = elem.getAttribute( 'page_y' );
		var xoffset = elem.getAttribute( 'xoffset' );
		var DELTA = 18;
		if ( _ignore_delta || Math.abs( start_x - _event.screenX ) >= DELTA || Math.abs( start_y - _event.screenY ) >= DELTA ) {
			elem.hide();
		}
	}
}

// ===============
// = Login hints =
// ===============

function showUsernameHint() {
  $( "login.usernamehint" ).show();
  $( "login.passwordhint" ).hide();
}

function showPasswordHint() {
  $( "login.passwordhint" ).show();
  $( "login.usernamehint" ).hide();
}

function hideHints( _id ) {
  $( "login.usernamehint" ).hide();
  $( "login.passwordhint" ).hide();
}

// ==========
// = Search =
// ==========

function handleSearchClick( _id ) {
	if ( $( _id ).value.strip() == "" ) {
		alert( "Vul svp een zoekterm in." );
		return false;
	} else {
		return true;
	}
}

// ==========
// = Editor =
// ==========

function setRadioButton( _id ) {
	$( _id ).checked = true;
}

// ========
// = Misc =
// ========

function evalJS( _func ) { try { f( _func ); } catch(exception) { } }


function swapImage (e,i) { e.src = i; }

/* EOF */
