var LoadedLib;
if (!LoadedLib) LoadedLib={}
LoadedLib.FRS_Public=true;


function CFRS_Public()
{
	
	this.GetElement = function(eID)
	{
		return document.getElementById(eID);
	}
	
	this.SetElementClassName = function(Element , ClassName)
	{
		Element.setAttribute("class",ClassName);
	}
	
	
	
	this.IsIE = function()
	{
		var browserName=navigator.appName; 
		if (browserName=="Microsoft Internet Explorer")
		{
			return true;
		}
	}
	
	
	this.IsNetscape = function()
	{
		var browserName=navigator.appName; 
		if (browserName=="Netscape")
		{ 
			return true;
		}
	}
	
	
	this.URLwithoutHash = function(URL)
	{
		var BaseURL='';
		
		if(URL==null)
		{
			BaseURL = document.location.href;
		}else
		{
			BaseURL = URL;
		}
		
		
		if (BaseURL.indexOf('#'))
		{
			BaseURL = BaseURL.substring(0,BaseURL.indexOf('#'));
		}
		
		return BaseURL;
	}



	this.URLwithoutQuery = function(URL)
	{
		var BaseURL='';
		
		if(URL==null)
		{
			BaseURL = document.location.href;
		}else
		{
			BaseURL = URL;
		}
		
		
		if (BaseURL.indexOf('?')!=-1)
		{
			BaseURL = BaseURL.substring(0,BaseURL.indexOf('?'));
		}
		
		return BaseURL;
	}


	
	this.Navigate=function(URL)
	{
		document.location.href=URL;
	}	
	


	this.SetWindowScrollY = function(NewValue)
	{
		document.documentElement.scrollTop = NewValue;
	}
	
	
	this.SetWindowScrollX = function(NewValue)
	{
		document.documentElement.scrollLeft = NewValue;
	}
	



	this.WindowScrollMaxY = function()
	{
		return document.documentElement.scrollHeight;
	}
	
	
	this.WindowScrollMaxX = function()
	{
		return document.documentElement.scrollWidth ;
	}
	
	

	this.WindowScrollY = function()
	{
		return document.documentElement.scrollTop;
	}
	
	
	this.WindowScrollX = function()
	{
		return document.documentElement.scrollLeft ;
	}
	
	this.PageWidth = function()
	{
		return document.documentElement.clientWidth;
	}
	
	this.OpenPopup= function(URL ,ID , Left , Top , Width , Height)
	{
			
		var Settings="toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,";
		
		if(Width==null)
		{
			Width = screen.width;
		}
		
		if(Height==null)
		{
			Height=screen.height;
		}
		
		if(Left==null)
		{
			Left=screen.left;
		}
		
		if(Top==null)
		{
			Top=screen.top;
		}		
		
		Settings+="width=" + Width;
		Settings+=",height=" + Height;
		Settings+=",fullscreen";
		Settings+=",left=" + Left ; 
		Settings+=",top=" + Top;
		
		NewWindow =window.open(URL , ID , Settings);
		NewWindow.focus();
		
	}
	
	this.PageHeight=function()
	{
		return document.documentElement.clientHeight;
	}
	
	
	
	this.AddURLQuery = function (QueryVariable , QueryValue , URL)
	{
		var Query = '';
		var URLwithoutQuery = this.URLwithoutQuery(URL);
		
		QueryVariable = QueryVariable.toLowerCase();
		
		if(URL==null)
		{
			URL = document.URL;
		}
		
		if(URLwithoutQuery.toLowerCase()!=URL)
		{
			Query = URL.substr(URLwithoutQuery.length+1);
		}else
		{
			Query = '';
		}
		
		
		if(Query.length)
		{
			Ary=Query.split("&");
			
			Found=false;
			for(i=0;i<Ary.length;i++)
			{
				if(Ary[i].toLowerCase().indexOf(QueryVariable + "=")!=-1)
				{
					Ary[i]=QueryVariable + "=" + QueryValue;
					Found=true;
				}
			}
			
			if(!Found)
			{
				Ary.push( QueryVariable + "=" + QueryValue);
			}
			
			NewQuery=Ary.join("&");
			
		}else
		{
			NewQuery=QueryVariable +  "=" + QueryValue;
		}
		
		return URLwithoutQuery + "?" + NewQuery ;
	}
	
	
	
	this.ListFunctions = new mListFunctions();
	

}



function mListFunctions()
{
	this.MoveListItem=function(SourceList,DestList,Item)
	{
		var Opt = new Option(Item.text,Item.value);
		DestList.options[DestList.options.length]=Opt;
		SourceList.options[Item.index]=null;
		
		return true;
	}
	
	
	
	this.MoveSelectedItems=function(SourceList,DestList)
	{
		for(i=SourceList.options.length-1;i>=0;i--)
		{
			if(SourceList.options[i].selected)
			{
				this.MoveListItem(SourceList,DestList,SourceList.options[i]);
			}
		}
	}
	
	
	
	this.MoveItems = function(SourceList,DestList)
	{
		for(i=SourceList.options.length-1;i>=0;i--)
		{
			this.MoveListItem(SourceList,DestList,SourceList.options[i]);
		}		
	}
	
	
	this.DeleteItem=function(List,Item)
	{
		
	}
	
	this.DeleteSelectedItems=function(List)
	{
		
	}
	
	
	this.EmptyList=function(Element)
	{
        for(i=Element.options.length-1;i>=0;i--)
        {
        	Element.options[i]=null;
        }
	}
	
	this.SelectAll = function(List)
	{
        for(i=List.options.length-1;i>=0;i--)
        {
        	List.options[i].selected=true;
        }
	}
}
