//-----------------------------------------------------------------------------------------------
//	Function:	getURL
//	Purpose:	Returns a string with the current domain name or starting path
//	Use:		Type in javascript -> value1 = getURL();
//  Parameters:	value1 ->  type: string
//				  	  	   current URL is strored in this string variable
//-----------------------------------------------------------------------------------------------
function getURL()
{
	if(location.href.indexOf("file:") >= 0)
	{
		//This determines which drive the user is associated to this file
		loc = location.href.lastIndexOf("2004");
		url = location.href.substring(0,location.href.indexOf("/",loc)+1);
	}
	else
		var url = "http://www.unylogix.com/";
		
	return url;
}

//-----------------------------------------------------------------------------------------------
//	Function:	trim
//	Purpose:	Returns a string with all blank spaces to the left and right of text deleted
//	Use:		Type in javascript -> trim(string-variable);
//				ex: 	trim("  mirroring  ");
//						temp = trim(title1);
//  Parameters:	s ->  type: string
//				  	  enter a string that you wish to have trimmed
//	  				  the return variable should be a string as well
//-----------------------------------------------------------------------------------------------
function trim(s){
/*
Cette fonction a pour but d'eliminer tous les espace au début et a la fin de la chaine s 
si la chaine est vide ou null alors retourne une chaine vide ("")
*/ 

	//determine si la chaine contient une valeur
	if( s==null || s.length==0 )
		return "";

	if( (s == null) || (s.length == 0) )
		return ""

    var debut = 0
    var fin   = s.length-1

    while((s.charAt(fin) == " ") && (fin >= 0))
        fin--

    while((s.charAt(debut) == " ") && (debut <= fin))
        debut++

    return s.substring(debut, fin + 1)
}
// End of file

//-----------------------------------------------------------------------------------------------
//	Function:	writeBlueHighlightBar
//	Purpose:	Displays a blue menu header
//	Use:		Type in javascript -> writeBlueHighlightBar(string-variable, string, string);
//				ex: 	writeBlueHighlightBar("Data Storage", "100%", "center");
//						writeBlueHighlightBar("Tapes")
//  Parameters:	textTitle ->	type: string
//				  	  		  	enter a string as title for the header
//				width -> 		type: string/int
//								enter the width size of header
//								(default: 1)
//				align -> 		type: string
//								enter the alignment type of the text in header
//								(default: left)
//-----------------------------------------------------------------------------------------------
function writeBlueHighlightBar(textTitle, width, align)
{
	var url = getURL();

	//Set default if none specified
	if(trim(width) == '')width="1";
	
	//Set default if none specified	
	if(trim(width) == '')align='left';

	document.write(url);		
	document.write('<table width="' + width + '" border="0" cellpadding="0" cellspacing="0" height="1" align="' + align + '">');
	document.write('<tr>');
	document.write('	<td width="1"><img src="' + url + 'images/title_left_corner.gif"></td>');
	document.write('	<td align="center" valign="middle" background="' + url + 'images/title_middle.gif">');
	document.write('		<font color="#ffffff"><b>' + textTitle + '</b></font></td>');
	document.write('	<td width="1"><img src="' + url + 'images/title_right_corner.gif"></td>');
	document.write('</tr>');
	document.write('</table>');
	
	return writeBlueHighlightBar
}


//-----------------------------------------------------------------------------------------------
//	Function:	writeClientServerTable
//	Purpose:	Displays a table highlighting the clients & servers supported
//	Use:		Type in javascript -> writeClientServerTable(string, string);
//				ex: 	writeBlueHighlightBar("1234", "24");
//						writeBlueHighlightBar("134")
//  Parameters:	servers ->		type: string
//				  	  		  	enter a string of #'s to specify the server
//				clients -> 		type: string/int
//				  	  		  	enter a string of #'s to specify the client
//-----------------------------------------------------------------------------------------------
function writeClientServerTable(servers, clients)
{
	var url = getURL();

	//Verify whether both are empty, if so, then exit without writing anything
	if((clients==null || clients.length==0 ) && (servers==null || servers.length==0 ))
		return;

	document.write('<span>');
	document.write('<table border="0" bordercolor="#aaaaaa" class="platformtbl"><tr>');

	//If 1 or more server platforms are indicated, then display it
	if((servers!=null && servers.length>0 ))
	{
		document.write('<td class="servertbl"><nobr>');
		document.write('<img src="' + url + 'images/img_server.gif" border=0 alt="Supported Servers:">');
		//Display all the server platforms indicated
		for(x=0; x<=servers.length; x++)
			displayPlatformImage(servers.substr(x,1));
	
		document.write('</nobr></td>');
		document.write('<td></td>');
	}

	//If 1 or more client platforms are indicated, then display it
	if((clients!=null && clients.length>0 ))
	{	
		document.write('<td valign="bottom"><nobr>');
		document.write('<table width="100%" height="100%" border="3" bordercolor="#D9F1FF" cellspacing="0" cellpadding="0"><tr><td valign="bottom">');
		document.write('<img src="' + url + 'images/img_client.gif" border=0 alt="Supported Clients:">');
	
		for(x=0; x<=clients.length; x++)
			displayPlatformImage(clients.substr(x,1));
			
		document.write('</td>');
		document.write('</tr></table></nobr>');
	}

	document.write('</td></tr></table>');
	document.write('</span>');
	
	return writeBlueHighlightBar;
}


//-----------------------------------------------------------------------------------------------
//	Function:	displayPlatformImage
//	Purpose:	Displays an image for the platform indicated
//	Use:		Type in javascript -> displayPlatformImage(string);
//				ex: 	displayPlatformImage("4");
//  Parameters:	servers ->		type: string
//				  	  		  	enter a string with 1 number in it
//-----------------------------------------------------------------------------------------------
function displayPlatformImage(no)
{	
	var url = getURL();
	
	switch (no)
	{
	case "1":
		document.write('&nbsp;<img src="' + url + 'images/unix_icon_small.gif" width=18 height=18 border=0 alt="Unix">');
		break;
	case "2":
		document.write('&nbsp;<img src="' + url + 'images/redhat_icon_small.gif" width=16 height=16 border=0 alt="Linux">');
		break;
	case "3":
		document.write('&nbsp;<img src="' + url + 'images/novell_icon_small.gif" width=16 height=16 border=0 alt="Novell Netware">');
		break;
	case "4":
		document.write('&nbsp;<img src="' + url + 'images/win_icon_small.gif" width=16 height=16 border=0 alt="Microsoft Windows">');
		break;
	case "5":
		document.write('&nbsp;<img src="' + url + 'images/macosx_icon_small.jpg" border=0 alt="Apple Mac OSX">');
		break;
	}

	return displayPlatformImage;
}

//-----------------------------------------------------------------------------------------------
//	Function:	displaySectionHeader
//	Purpose:	Displays a background image with a specified title
//	Use:		Type in javascript -> displaySectionTitle(string);
//				ex: 	displayPlatformImage("Configurations");
//  Parameters:	servers ->		type: string
//-----------------------------------------------------------------------------------------------
function displaySectionHeader(txtTitle)
{	
	var url = getURL();	
	
	if(screen.availWidth <= 800)
	{
		var tblWidth = 600;
		var colWidth = 250;
		var lastColWidth = 40;
		var classNameTxt = 'txt_overshadow_800x600';
		var classNameShadow = 'txt_shadow_800x600';
		var imgName = 'blue_section_background800x600.GIF';
	}
	else
	{   
		var tblWidth = 769;
		var colWidth = 390;
		var lastColWidth = 34;
		var classNameTxt = 'txt_overshadow_1024x768';
		var classNameShadow = 'txt_shadow_1024x768';
		var imgName = 'blue_section_background1024x768.GIF';
	}
	
	document.write('<table height="31" width="' + tblWidth + '" background="' + url + '/images/' + imgName + '" cellpadding="2">');
	document.write('	<tr>');
	document.write('		<td width="' + colWidth + '"><font color="#000000" class="' + classNameTxt + '"><b>');
	document.write(txtTitle);
	document.write('</b></font></td>');
	document.write('		<td width="' + colWidth + '"><font color="#ffffff" class="' + classNameShadow + '"><b>');
	document.write(txtTitle);
	document.write('</b></font></td>');
	document.write('		<td width="' + lastColWidth + '"></td>');
//	document.write('		</td>');
	document.write('	</tr>');
	document.write('</table>');
	
	return displaySectionHeader;
}