var arrElement = new Array();

function ajaxform( nameID , ResponseId )
{	
	if ( arrElement[nameID] != 1 )
	{		
		advAJAX.assign(document.getElementById(nameID), 
		{
			onLoading : function() 
			{			  	 
				document.getElementById(ResponseId).innerHTML='??';       
        	},	
			onSuccess : function(obj) 
			{
				if(obj.responseText.indexOf("<!-- header -->") != -1 )
				{
					document.location.href = '/';
					return true;
				}
				
				document.getElementById(ResponseId).innerHTML = obj.responseText;
			},
		    onError : function(obj) 
		    {
		      	window.alert(obj.error);
		    }
		    
		     
		  });	    
	}	
	
	if (document.getElementById(nameID) != "null"  )
	{
		arrElement[nameID] = 1;
	}
	
	return false;	
}


function ajaxget(  link, ResponseId )
{	
	
	advAJAX.get({
    url: link,
    onLoading : function() {
    	  	  	 //document.getElementById(ResponseId).innerHTML='<img src="images/indicator.gif">';       
    },
     
     onSuccess : function(obj) { 
    	
    	if(obj.responseText.indexOf("<!-- header -->") != -1 )
		{
			document.location.href = '/';
			return true;
		}
    	document.getElementById(ResponseId).innerHTML = obj.responseText;	
	 
	}
 });
}


var ToArray = {
  version: '1.0',
  
  str2array: function (string, separator) {
    if (!separator) {
      separator = ';';
    }
    var result=string.split(separator);
    return result;
  }
}



var blnAjaxDebug = false;
function ajaxDebug( HTMLtext )
{
 if ( blnAjaxDebug == true )
   {      
  okno = window.open("","ajaxDebug","width=800,height=600,top=10,left=20,resizable=no,scrollbars=no,menubar=no,toolbar=no,status=no,location=no,status=no");
  okno.document.write('<HTML>');
  okno.document.write('<TITLE>DEBUG AJAX</TITLE>');
  okno.document.write('<HEAD>');
  okno.document.write('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />');
  okno.document.write('</HEAD>');
  okno.document.write('<BODY>');
  okno.document.write(HTMLtext); 
  okno.document.write('</BODY>');
  okno.document.write('</HTML>');
  okno.document.close();
 }
}