/**
*@author Carsten Schäfer 08/03/05 12:56
*/
function getTemplate()
{
  var tpl =	"<table border=0 class=\"libAtomContainer\" cellspacing=1 cellpadding=3>\n"
				+ '<colgroup><col width="120px"></colgroup>'
				+'  <tr>'
//				+'    <td class="USERthumb" rowspan="3">'
//				+'      {thumbpath}<!--<br>(PATH Image)--></td>\n'
				+'    <th colspan="9" class="USERtitle" title="Name and acronym of product">{title}<!-- (TITLE: plain text)--></th>\n'
				//+'    <th class="USERtitle"><a href="#" onclick="javascript:toggle(\'optionalRow{atomNo}\')"><img border=0 id="imgoptionalRow{atomNo}" src="plus.gif"></a></th>\n'
				//+'    <th olspan="3" lass="USERtitle">X</th>\n'
				+'  </tr>\n'
				+'  <tr>\n'
				+'    <td class="USERmeta" title="Who provides the product">'+getLabel("Product Provider")+'{provider}<!-- (PROVIDER: comma sep. plain text)--></td>\n'
//				+'     <td class="USERmeta">'+getLabel("Satellite")+'{sat}<!-- (sat: comma sep. plain text)--></td>\n'
				+'     <td class="USERmeta" title="GMES classification of societal benefits">'+getLabel("Societal Benefit Area")+'{benefit}<!-- (benefit: comma sep. plain text)--></td>\n'
				+'     <td class="USERmeta">'+getLabel("Product Status")+'{status}<!-- (sat: comma sep. plain text)--></td>\n'
				//+'     <td class="USERmeta">&nbsp;</td>\n'
				+'  </tr>\n'
				+'  <tr>\n'
				+'    <td  class="USERmeta USERtext" colspan="9" title="Short description of product">'+getLabel("Description")+'{text}</td>\n'
				+'  </tr>\n'
				+'  <tr id="optionalRow{atomNo}" style="display:none">\n'
				+'  <td colspan="9">\n'
				+'  <table width="100%">\n'
				+'  </tr>\n'
				+'  <tr>\n'
				+'    <td class="USERmeta USERtext" title="Disseminated product availability">'+getLabel("Dissemination")+'{availability}<!--(availability:     text)--></td>\n'
				+'    <td class="USERmeta USERtext">'+getLabel("EUMETCast Channel")+'{channel}</td>\n'
				+'    <td class="USERmeta USERtext" title="Dissemination frequency">'+getLabel("Products per Day")+'{frequency}<!--(frequency: text)--></td>\n'
				+'    <td class="USERmeta USERtext">'+getLabel("Projection/Resolution")+'{resolution}<!--(RESOLUTION: text)--></td>\n'
				+'  </tr>\n'
			    +'  <tr>\n'
				+'    <td class="USERmeta USERlinks USERtext">'+getLabel("Dissemination links")+'{link_x}<!--<p>Link 4 (Weblocation (originator):Location Dissemination\n'
				+'        FTP) (full link with prefix icon) [AD] | [AS]</p>\n'
				+'      <p>Link 5 (Weblocation (originator):High Rate SEVIRI)</p>\n'
				+'      <p>Link 6 ....</p>--></td>\n'
				+'    <td class="USERmeta USERtext">'+getLabel("Dissemination Formats")+'{formats}<!--(FORMATS: comma sep. text, non-linked)--></td>\n'
				+'    <td class="USERmeta USERlinks USERtext" title="Availabile from archive">'+getLabel("Archive")+'{archive_x}</td>\n'
				+'    <td class="USERmeta USERtext">'+getLabel("Archive Formats")+'{archiveformats}<!--(FORMATS: comma sep. text, non-linked)--></td>\n'
//				+'   <td  class="USERmeta USERtext" >'+getLabel("Multicast Channel")+'{channel}</td>\n'
				+'  </tr>\n'
				+'    <td> </td>\n'
				+'  </tr>\n'
				+'  <tr>\n'
				+'    <td class="USERmeta USERtext" colspan="9">'+getLabel("EUMETCast File Name Example")+'{namingconvention}</td>\n'		
				+'  </tr>\n'
				+'  <tr>\n'
				+'    <td class="USERmeta USERlinks USERtext" colspan="9" title="More information">'+getLabel("Resources")+'{resources_x}</td>\n'
				+'  </tr>\n'
				+'</table>\n'
				+'  </tr>\n'
				+'  <tr class="USERtitle"><td colspan="9" align="right"><a href="#" onclick="javascript:toggle(\'optionalRow{atomNo}\'); return false;"><img border=0 id="imgoptionalRow{atomNo}" src="more.gif" alt="more information" title="more information"></a></td></tr\>\n'
				//+'  </td>\n'
//								
				+'</table>\n';

  return tpl;
}


function getIotmTPL(iotmPath)
{
  return "<span style='white-space:nowrap;'><img src='"
              + CONFIG['DATA']['cssImagePath'] + "icon_link_moreinfo_coloured.gif' class='navigationIcon' "
			        +"alt='[Enter study]' border='0'>"
			        +"<a href=\""
			        + CONFIG['DATA']['iotmPath'] + iotmPath
			        +"\" target='_blank' class='contentColouredAnkerBox' title='link'>"
			        +"<span class='colouredText'><strong>more</strong></span></a></span>";

}

function getCrossLinkTPL(title, link, selected)
{
  return "<span style='white-space:nowrap;' class='contentMiddleText'>"
			        + ( selected
			          ?
			          ""
			          :
			          "<a href=\"" + link +"\" class='contentColouredAnkerBox' title='link'>"
			          )
			          +( selected ? "<span class='coloured2Text'><strong>"+title+"</strong></span>":"<span class='colouredText'><strong>"+title+"</strong></span></a>")
			          +"</span>";
}

function getType(entry)
{
  return CONFIG['MAPPERS']['type'][entry] ? CONFIG['MAPPERS']['type'][entry]:entry;
}

function getCat(entry)
{
  return CONFIG['MAPPERS']['category'][entry] ? CONFIG['MAPPERS']['category'][entry]:entry;
}

function getCaps(entry)
{
  return entry.toUpperCase();
}

function listNamingConvention(entry)
{
	return entry.replace(/,/g, "<br />");
}

function getLabel(text){
	return '<table class="miniCaption" width=1% cellspacing=0 cellpadding=0><tr><td class="miniCaption" > '+text+' </td></tr></table>';
}

function trimText(text)
{
	var limit = 10;
	var ret = text.substr(0, limit)+"...<span onclick=\"javascript:change(this)\" class=\"displ\" style=\"display:none;visibility:hidden\">"+text.substr(limit)+"</span>";
	return ret;
}

function change(obj)
{
	alert(obj.style.visibility);

}

function getThumb(source)
{
	//alert(!source || source=="" || source.trim()==0);
	//alert("'"+source+"'");
	if(!source || source=="" || source.trim()==0 || source=="undefined")
		return "<div class=\"USERthumb imagePlaceholder\">&nbsp;</div>";
	else
		return "<img class=\"USERthumb\" src=\""+CONFIG['DATA']['thumbPath']+source+"\" idth=\"75\" eight=\"75\" />";
}


function toggle(id)
{
	var tr = document.getElementById(id);
	if (tr==null) 
	{ return; }
	var bExpand = tr.style.display == '';
	tr.style.display = (bExpand ? 'none' : '');
	var img = document.getElementById('img'+id);
	if (img!=null)
	{
		if (bExpand)
			img.src = 'more.gif';
		else
			img.src = 'close.gif';
	}
}
   
