====== checkAvailability ======
Checks the availability of the specified page. Terminates performing of the task, if the page was unavailable.
===== Syntax =====
checkAvailability = function(aPage, aExpectedIP, aIncludedText, aUserAgent);
checkAvailability = function(aCheckItems);
==== Parameters ====
* **//aPage//**
* //functions:// verified page
* **//aExpectedIP//**
* //functions:// supposed IP host on which the page is situated
* **//aIncludedText//**
* //functions:// text contained in the source code of the checked page
* **//aUserAgent//**
* //functions:// User-agent, which will be specified when loading the source code of the checked page
* **//aCheckItem//**
* //functions:// record containing the information required to verify the page
* **//aCheckItems//**
* //functions:// array of records to check multiple pages
===== Notes =====
* To test the page goes through the following algorithm:
- verified the availability of the host on which the page is situated. If the host is available, then
- if IP host coincides with aExpectedIP or aExpectedIP and equals '0 .0.0.0 ', then
- if aIncludedText not empty, the source code of the page is loaded using aUserAgent (redirects are not supported!). If aUserAgent empty, then used User-agent, installed for your browser. If the source code of the page contains aIncludedText or aIncludedText - empty string, then
- test passes, the script continues to execute
* If the test fails, the script will stop execution
* The procedure may be performed only once, and only being the first method that performed by a script. If there were performed other methods before, the software will ignore CheckAvailability.
* If you check the array pages, will be checked only the first five elements of array
===== Examples =====
- checkAvailability('habrahabr.ru');
- checkAvailability('habrahabr.ru', '178.248.233.33');
- checkAvailability('habrahabr.ru', '178.248.233.33', 'habr');
- checkAvailability([
{"page":"habrahabr.ru","expectedIP":"178.248.233.33","includedTextt":"habr"},
{"page":"liveinternet.ru","includedText":"stat","userAgent":"my ua"}
]);