function link( who, linkto )
{
	var thewin;
	thewin = window.open( '', '' );
	if( ! thewin || typeof( thewin.closed ) == 'undefined' ) {	// In case it didn't open!
		who.href = "link.php?" + linkto;
		return true;
	}
	thewin.document.write( "<html><meta http-equiv=refresh content=\"2; url=" + linkto + "\">\n" );
	thewin.document.write( "<body><center>\n" );
	thewin.document.write( "<font face=arial size=+7>New Window</font><P><BR><BR>\n" );
	thewin.document.write( "Going to:<P><BR><BR>\n" );
	thewin.document.write( "<font face=arial size=+7><a href=" + linkto + ">" + linkto + "</a>\n" );
	thewin.document.write( "</font></center></body></html>\n" );
	thewin.document.close();
	thewin.focus();
	thewin.location = "link.php?" + linkto
	return false;
}
function mk_e_link( dom, subdom, usr, sub )
{
	var lnk = subdom + '.' + dom;
	lnk = usr + '@' + lnk;
	var t_op = 'lto:'  
	t_op = '<' + 'a hre' + 'f=mai' + t_op;
	t_op += lnk;
	if( sub != '' )
		t_op += '?subject=' + escape( sub );
	document.write( t_op + '>' );
	t_op = '</a>';
	document.write( lnk + t_op );
}
function mk_text_e_link( dom, subdom, usr, sub, text )
{
	var lnk = subdom + '.' + dom;
	lnk = usr + '@' + lnk;
	var t_op = 'lto:'  
	t_op = '<' + 'a hre' + 'f=mai' + t_op;
	t_op += lnk;
	if( sub != '' )
		t_op += '?subject=' + escape( sub );
	document.write( t_op + '>' );
	t_op = '</a>';
	document.write( text + t_op );
}
function mk_img_e_link( dom, subdom, usr, sub, img )
{
	var lnk = subdom + '.' + dom;
	lnk = usr + '@' + lnk;
	var t_op = 'lto:'  
	t_op = '<' + 'a hre' + 'f=mai' + t_op;
	t_op += lnk;
	if( sub != '' )
		t_op += '?subject=' + escape( sub );
	document.write( t_op + '>' );
	t_op = '</a>';
	document.write( "<img src='" + img + "' border='0' />" + t_op );
}
function abstract_show_hide( which )
{
	//alert( "'" + document.getElementById('abs_'+which).style.display + "'" );
	if( document.getElementById('abs_'+which).style.display == '' || 
			document.getElementById('abs_'+which).style.display == 'none' ) {
		document.getElementById('abs_'+which).style.display = 'block';
		document.getElementById('sh_'+which).innerHTML = 'Hide Abstract';
	}
	else {
		document.getElementById('abs_'+which).style.display = 'none';
		document.getElementById('sh_'+which).innerHTML = 'Show Abstract';
	}
}
function ss_setup( ctrl_name )	// e.g. call as: ss_setup( "ctrl" );
{
	if( ctrl_name == "_xx_" ) {
		alert( "ss_setup() can not cope with ctrl object named '_xx_'.  Use a different name." );
		return;
	}
	var _xx_;
	eval( "_xx_ = " + ctrl_name );	// Create a variable that is a reference to the object named ctrl_name
	document.write(
			"<table>\n" +
			"	<tr><td colspan='3'><a href='javascript:ss_change_size(" + ctrl_name + ")'><img id='" + _xx_.id + "_img' border='0' src=''></a></td></tr>\n" +
			"	<tr>\n" +
			"		<td align='left' width='33%'><span id='" + _xx_.id + "_prev'>\n" + // id needed in <span> otherwise strange outlines appear in id is put in <a>-->
			"							<a href='javascript:ss_prev(" + ctrl_name + ")'>&lt;&lt; Previous</a>\n" +
			"						</span></td>\n" +
			"		<td align='center' width='34%'><a id='" + _xx_.id + "_scale' href='javascript:ss_change_size(" + ctrl_name + ")'>[Enlarge]</a></td>\n" +
			"		<td align='right' width='33%'><span id='" + _xx_.id + "_next'>\n" +
			"							<a href='javascript:ss_next(" + ctrl_name + ")'>Next &gt;&gt;</a>\n" +
			"						</span></td>\n" +
			"	</tr>\n" +
			"</table>\n" );
	ss_init( _xx_ );
}
function ss_init( ctrl )
{
	ctrl.imagesActive = ctrl.images;
	ss_next( ctrl );
	ss_prev( ctrl );
	var i = 0;
	for( i=0; i<ctrl.images.length; ++i ) {
		var img = new Image();
		img.src = ctrl.images[i];
	}
	for( i=0; i<ctrl.imagesBig.length; ++i ) {
		var img = new Image();
		img.src = ctrl.imagesBig[i];
	}
}
function ss_img( ctrl )
{
	//alert( ctrl.constructor.name );
	document.getElementById( ctrl.id + "_img" ).src = ctrl.imagesActive[ctrl.index];
}
function ss_next_rotate( ctrl )
{
	ctrl.index++;
	if( ctrl.index >= ctrl.images.length ) ctrl.index = 0;
	ss_img( ctrl );
}
function ss_prev_rotate( ctrl )
{
	ctrl.index--;
	if( ctrl.index < 0 ) ctrl.index = ctrl.images.length - 1;
	ss_img( ctrl );
}
function ss_next( ctrl )
{
	ctrl.index++;
	if( ctrl.index == ctrl.images.length - 1 ) document.getElementById( ctrl.id + "_next" ).style.display = 'none';
	document.getElementById( ctrl.id + "_prev" ).style.display = 'block';
	ss_img( ctrl );
}
function ss_prev( ctrl )
{
	ctrl.index--;
	if( ctrl.index == 0 ) document.getElementById( ctrl.id + "_prev" ).style.display = 'none';
	document.getElementById( ctrl.id + "_next" ).style.display = 'block';
	ss_img( ctrl );
}
function ss_change_size( ctrl )
{
	if( ! ctrl.isBig || ctrl.isBig == false ) {
		document.getElementById( ctrl.id + "_scale" ).innerHTML = "[Shrink]";
		ctrl.imagesActive = ctrl.imagesBig;
		ctrl.isBig = true;
	}
	else {
		document.getElementById( ctrl.id + "_scale" ).innerHTML = "[Enlarge]";
		ctrl.imagesActive = ctrl.images;
		ctrl.isBig = false;
	}
	ss_img( ctrl );
}
