function generate(sLongURL, sCustomURL, objMyDivOutput) { // creating request var req = null; try { req = new XMLHttpRequest(); } catch (ms) { try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch (nonms) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch (failed) { req = null; } } } if (req == null) { // error } // set nice text if (objMyDivOutput != null) { objMyDivOutput.style.display = 'block'; objMyDivOutput.innerHTML = 'berechne...'; } // doing request (GET, url, request is asynchronous) req.open('GET', 'http://linkd.de/_jx?longurl=' + escape(sLongURL) + '&customurl=' + escape(sCustomURL), true); // called when request changes state req.onreadystatechange = function() { switch(req.readyState) { case 4 : if(req.status != 200) { // error } else { // write the response in html objMyDivOutput.innerHTML = getDivHTML(req.responseText); } break; default : return false; break; } }; req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); req.send(null); } function getDivHTML(sShortURLResponse) { var aData = eval('(' + sShortURLResponse + ')'); var s = ''; if (!aData.bValidURL) { return s = '