//***********************************************************
//	           	LangExport Poject
//	   	     LangFunc Version 0.1 (beta)
//This file contains all the function that will help you to
//access the languages string that defined in the diffrent
//files.
//for a deep look in the machanizem get the following document:
//			LangExport - SID.Doc
//***********************************************************

// Function list 
//__________________________________________________________
//*CheckForJs(LangID, LangVarName) *
//__________________________________________________________
//*LangWrite(LangID, LangVarName) *
//__________________________________________________________
//*Get_LNValue(LangID, LangVarName) *
//__________________________________________________________
//*LangWritePOP(LangID, LangVarName) *
//__________________________________________________________
//*Get_LNValuePOP(LangID, LangVarName) *
//__________________________________________________________
//*CreateImage (ImageName, ImageSRC, ImageAlt, ImageBorder, ImageHeight, ImageWidth)*
//__________________________________________________________
//*CreateOption (V)
//__________________________________________________________

//***********************************************************
// Function: CheckForJs(LangID, LangVarName)
// Description: checks that global.js file is loaded
// Parameters:
//		 :  property
//************************************************************
function CheckForJs(LangID, LangVarName)
{

   if (LangID==1) 
   {
  	      var done=false;
   		var count=0;
     	while((done == false) && (count <= 1000))
		{
			if (eval(LN_global_JS_path+LangVarName)) 
				{
					done = true;
				}
//					else
//			{
//				alert("search no " + (count+1));
//			}
				count++;
     		} 

   }	
     
}



//***********************************************************
// Function: LangWrite(LangID, LangVarName)
// Description: writes the correct string to the user screen 
// Parameters:
//		LangID : The language ID 
//		LangVarName: the name of the varubale that you 
//			    wish to desplay.
//************************************************************


function LangWrite (LangID, LangVarName)
{
	if (LangID == 1)
	{
	var done  = false;
	var count = 0;

		if (! eval (LN_global_JS_path + LangVarName))
		{
			while ((done == false) && (count <= 50))
			{
				if (eval (LN_global_JS_path + LangVarName))
				{
					done = true;
					document.write (eval (LN_global_JS_path + LangVarName));
				}
				++count;
			}
		}
		else
		{
			if (eval (LN_global_JS_path + LangVarName))
			{
				document.write(eval(LN_global_JS_path+LangVarName));
			}
			else
				if (eval ('document.' + LangVarName))
					document.write (eval ('document.' + LangVarName));
	            else
					document.write ('<B><FONT color="red" face=Arial>LangError</FONT></B>');     
		}
	}
}


//***********************************************************
// Function: Get_LNValue(LangID, LangVarName) 
// Description: returns the correct string as a prameter
// Parameters:
//		LangID : The language ID 
//		LangVarName: the name of the varubale that you 
//			    wish to display.
//************************************************************


function Get_LNValue(LangID, LangVarName)
{
   if (LangID==1) 
   {
  	  var done=false;
   		var count=0;
     	while((done == false) && (count <= 50))
			{
				if (eval(LN_global_JS_path+LangVarName)) 
				{
				done = true;
				return eval(LN_global_JS_path+LangVarName);
				}
				count++;
     			} 
   	 } 
       	else
       	 { 
            if (eval('document.'+LangVarName)) 
	  		{return  eval('document.'+LangVarName);}
            else
                  return "LangError";
        		}
}

//***********************************************************
// Function: Get_LNValue2(LangID, LangVarName)
// Description: returns the correct string as a prameter
// Parameters:
//		LangID : The langyage ID 
//		LangVarName: the name of the varubale that you 
//			    wish to desplay.
//************************************************************
function Get_LNValue2(LangID, LangVarName)
{
	if (LangID==1) 
   	{
   //	if(navigator.appName.indexOf("netscape") == -1)  
//	{
//   		try{
   		if (eval(LangVarName))
	      	return eval(LangVarName);
	      else
	      	if (eval('document.'+LangVarName)) 
				return eval('document.'+LangVarName);
	        else
	        	return 'LangError';
/*     	}
	 	catch(error) // no element - return the var without the 'LN_' prefix
	 	{
	 		return LangVarName.substr(3);
	 	}*/
//	}
/*	else
	{
		//netscape
		if(typeof(LangVarName) == "undefined")
	      	{
			return LangVarName.substr(3);
	      	}
	      	else
	      	{
			if (eval(LangVarName)) 
	      		return eval(LangVarName);
	      	else
	      		if (eval('document.'+LangVarName))
				return eval('document.'+LangVarName);
	        	else
	        		return 'LangError';
	        }
	}*/
   	}
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% POP%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//***********************************************************
// Function: LangWritePOP(LangID, LangVarName)
// Description: writes the correct string to the user screen 
//             use this in pop up windows 
//	don't forget to include the global.js
// Parameters:
//		LangID : The langyage ID 
//		LangVarName: the name of the varubale that you 
//			    wish to desplay.
//************************************************************


function LangWritePOP(LangID, LangVarName)
{
   if (LangID==1) 
    {
     document.write(eval(LangVarName));
    }
}


//***********************************************************
// Function: Get_LNValuePOP(LangID, LangVarName)
// Description: returns the correct string as a prameter
//             use this in pop up windows 
//	don't forget to include the global.js
// Parameters:
//		LangID : The langyage ID 
//		LangVarName: the name of the varubale that you 
//			    wish to desplay.
//************************************************************


function Get_LNValuePOP(LangID, LangVarName)
{
   if (LangID==1) 
   {
      if (eval(LangVarName)) 
            return eval(LangVarName);
      else
        { 
            if (eval('document.'+LangVarName)) 
	  		{
				return eval('document.'+LangVarName);
			}
            else
                return 'LangError';
        }
   }
}







//***********************************************************
// Function: CreateOption (V)
// Description: writes the OPTION of a SELECT tag to the HTML file
// Parameters:
//		 :  property
//************************************************************
function CreateOption(LangID, LangVarName)
{
	var s='<OPTION>';
	if (LangID==1) 
    	{ s=s+LangVarName; }
	s=s+'<OPTION>';
	alert(s);
	document.write(s);
}




