var url = window.location; var urlref = window.location.href; //if the url has profile in the there var profileRegExp = /profile/; var nologPos1 = urlref.search(profileRegExp); //Function header function myAwards(){ if (!ning.CurrentProfile){ var username = "anon"; } if (ning.CurrentProfile){ var username = ning.CurrentProfile.id; } var ajaxRequest; try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ //find div by id - "xg_layout_column_1" var parentDiv = document.getElementById("xg_layout_column_1"); //find child node [2], insert a div before it var childDiv1 = parentDiv.childNodes[1]; var childDiv2 = parentDiv.childNodes[2]; //create a new div var rewardsDiv = document.createElement("div"); rewardsDiv.setAttribute("class", "xg_module") rewardsDiv.innerHTML = '