fix / simplify ip detection javascript

use .ready() instead of first delay
merge script blocks