/*======================================*\
 * #################################### *
 * # Ext Link Downloader Modification # *
 * #                         v1.0.4   # *
 * #################################### *
 * #     AJAX JavaScript Code         # *
 * #################################### *
 * #  Developed for vBHackers.com (c) # *
 * #  by Idan B.                      # *
 * #           ---                    # *
 * #  Disclaimer:                     # *
 * #  ##########                      # *
 * #  Author of mod and/or vbhackers  # *
 * #  CANNOT be held responsible      # *
 * #  for use of this mod.            # *
 * #                                  # *
 * #  This modification created       # *
 * #  to allow check of external HTTP # *
 * #  links that MUST contain ONLY    # *
 * #  LEGAL & NON-copyright file(s).  # *
 * #                                  # *
 * #  ANY use of this code as part of # *
 * #  system (or web) to allow so     # *
 * #  called "warez" site/forum is    # *
 * #  NOT allowed & STRICTLY          # *
 * #  FORBIDDEN !!                    # *
 * #                                  # *
 * #################################### *
\*======================================*/


function ajax_check_link(link_id)
{
	Check_Ajax = new vB_AJAX_Handler(true);
	Check_Ajax.postid = link_id;
	Check_Ajax.onreadystatechange(ajax_callback_check_link_complete);	
	Check_Ajax.send('checker.php','linkid=' + link_id);
}

function ajax_callback_check_link_complete()
{
	if (Check_Ajax.handler.readyState == 4 && Check_Ajax.handler.status == 200)
	{
		//alert('debug: ' + Check_Ajax.handler.responseText.toString());
		// Split data input from php file to flag & text information
		var result_bits = Check_Ajax.handler.responseText.toString().split("|");
		var online_status = result_bits[0];
		var check_date = result_bits[1];
		if (online_status != 2 )
		{
			if (online_status == 1 )
			{
				fetch_object('status_id' + Check_Ajax.postid).innerHTML = '<font color=green>Online</font>';	
			} else {
				fetch_object('status_id' + Check_Ajax.postid).innerHTML = '<font color=red>Offline</font>';
			}
			fetch_object('last_checked_id' + Check_Ajax.postid).innerHTML = check_date;
			fetch_object('checked_id' + Check_Ajax.postid).innerHTML = '<img src="images/checked.gif" alt="Link checked !" />';
        } else {
            //alert('ERROR: Could not verify status of link !');	
        }
    }
} 
   
			
