var arrElement = new Array();

function ajaxform( nameID , ResponseId )
{	
	
	if ( arrElement[nameID] != 1 )
	{		
		advAJAX.assign(document.getElementById(nameID), 
		{
			onLoading : function() 
			{			  	 
				//document.getElementById(ResponseId).innerHTML='<img src="images/indicator.gif">';       
        	},	
			onSuccess : function(obj) 
			{
				//alert(obj.responseText);
				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, alert)
{	

	if(alert!= undefined && alert!= '' )
	if(window.confirm(alert)  === false)
	return false; 
	
	
	//window.alert(link);
	//link = link;
	
	//link = '?&ajax=1';
 	advAJAX.get({
    url: link,
    onLoading : function() {
    	document.getElementById(ResponseId).innerHTML='???';       
    },
     
     onSuccess : function(obj) { 
     
    //var result = ToArray.str2array(obj.responseText, '###');
	document.getElementById(ResponseId).innerHTML = obj.responseText;	
	//alert( 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();
 }
}