//LINK OBJECT FUNCTION//
function randomLink(a, b){
	this.url = a;
	this.text = b;
	this.link = assignLink;
}
function assignLink(){
	return '<a href="' + this.url + '" class="textlink" target="_blank">' + this.text + '</a>';
}
function publishLink(){
	/*Test to see if old text is the same as new text*/
	var oldText = document.getElementById("randlink").innerHTML;
	var newText = links[Math.floor(Math.random()*links.length)].link();
	while(oldText==newText){
		newText = links[Math.floor(Math.random()*links.length)].link();
	}
	document.getElementById("randlink").innerHTML = newText;
}

//ESTABLISH ARRAY//
var links = [];
links.push(new randomLink("http://css-tricks.com/", '<abbr title="Cascading Style Sheets" class="initialism">CSS</abbr> Tricks'));
links.push(new randomLink("http://psd.tutsplus.com/", '<abbr title="Photoshop Document" class="initialism">PSD</abbr> Tuts'));
links.push(new randomLink("https://www.youtube.com/watch?v=RDIdT8kqb-8", "Welcome to the Club (DJ Execute Remix) - Manian"));
links.push(new randomLink("https://www.youtube.com/watch?v=nEI_vzI_CWQ", '"Epic Love" - Zander Zon'));
links.push(new randomLink("http://www.newegg.com/", "Newegg"));
links.push(new randomLink("http://www.soundclick.com/bands/default.cfm?bandID=20215&content=music", "Sanxion7 Music"));
links.push(new randomLink("http://www.nekogames.jp/mt/2008/01/cursor10.html", "Cursor*10"));
links.push(new randomLink("http://www.soundclick.com/bands/default.cfm?bandID=329009&content=music", "Draigun Music"));
links.push(new randomLink("https://www.youtube.com/watch?v=hW93CV6m-JU", "Mad World - Gary Jules"));
links.push(new randomLink("http://us.akinator.com/", "Akinator, the Web Genius"));
links.push(new randomLink("http://binaerpilot.no/", "Bin&#228;rpilot"));
links.push(new randomLink("http://www.techsmartly.net/freeps3.php", "Don\'t click this!!"));
links.push(new randomLink("http://megatokyo.com/", "MegaTokyo"));
links.push(new randomLink("http://www.cad-comic.com/", "Control+Alt+Delete"));
links.push(new randomLink("http://userstyles.org/", "Stylish"));
links.push(new randomLink("http://questionablecontent.net/view.php?comic=223#news", "SCORPION DOES NOT APPRECIATE BEING IN MATTRESS."));

//PUBLISH LINK//
publishLink();
