addLoadEvent(linkToUsSetup);


function linkToUsSetup() {
	
	clearRadioBtns("link-to-us-txt-choices","link-to-us-txt");
	
	var linkTitle = new Array();
	var linkCode = new Array();
	
	linkTitle[0] = "Selected: Text Link";
	linkCode[0] = "";
	
	linkTitle[1] = "Selected: Extra Small #1 (135 x 20)";
	linkCode[1] = "<a href=\"http://www.BundleMyServices.com\"><img border=\"0\" src=\"http://www.whitefence.com/qsrimages/linkShare/BMS/BMS-xsm-01.gif\" /></a>";
	
	linkTitle[2] = "Selected: Extra Small #2 (135 x 20)";
	linkCode[2] = "<a href=\"http://www.BundleMyServices.com\"><img border=\"0\" src=\"http://www.whitefence.com/qsrimages/linkShare/BMS/BMS-xsm-02.gif\" /></a>";
	
	linkTitle[3] = "Selected: Small #1 (135 x 80)";
	linkCode[3] = "<a href=\"http://www.BundleMyServices.com\"><img border=\"0\" src=\"http://www.whitefence.com/qsrimages/linkShare/BMS/BMS-sm-02.gif\" /></a>";
	
	linkTitle[4] = "Selected: Small #2 (135 x 80)";
	linkCode[4] = "<a href=\"http://www.BundleMyServices.com\"><img border=\"0\" src=\"http://www.whitefence.com/qsrimages/linkShare/BMS/BMS-sm-02.gif\" /></a>";
	
	linkTitle[5] = "Selected: Banner #2 (468 x 60)";
	linkCode[5] = "<div style=\"font-family: Verdana, Arial; position:relative; display: block; width: 468px; height: 60px; text-decoration: none\"><div style=\"position:absolute; top: 6px; right: 6px; color: #fff; z-index: 99; width: 200px; font-size: 7pt; line-height: 11pt; text-align:right;\">Order from trusted, national<br />companies, like <a style=\"color: #fff; text-decoration: underline\" href=\"http://www.BundleMyServices.com/att/index.html\">AT&amp;T</a>, <a style=\"color: #fff; text-decoration: underline\" href=\"http://www.BundleMyServices.com/verizon/index.html\">Verizon</a>,<br /> <a style=\"color: #fff; text-decoration: underline\" href=\"http://www.BundleMyServices.com/qwest/index.html\">Qwest</a>, <a style=\"color: #fff; text-decoration: underline\" href=\"http://www.BundleMyServices.com/embarq/index.html\">EMBARQ</a> and more.</div><a href=\"http://www.BundleMyServices.com\"><img border=\"0\" src=\"http://www.whitefence.com/qsrimages/linkShare/BMS/BMS-banner-02.jpg\" /></a></div>";		
	
	textArea = document.getElementById('link-to-us-code');
	textArea.value = "";
	textArea.onclick = function() {
		this.select();
	}
	
	myTitle = document.getElementById('link-to-us-title');
	myImg = document.getElementById('link-to-us-img');
	
	link_1 = document.getElementById('link-to-us-01');
	link_1.onclick = function() {
		myTitle.firstChild.nodeValue = linkTitle[1];
		textArea.value = linkCode[1];
		myImg.src = this.firstChild.src;
		removeLinkExample();
		clearRadioBtns("link-to-us-txt-choices","link-to-us-txt");
	}

	link_2 = document.getElementById('link-to-us-02');
	link_2.onclick = function() {
		myTitle.firstChild.nodeValue = linkTitle[2];
		textArea.value = linkCode[2];
		myImg.src = this.firstChild.src;
		removeLinkExample();
		clearRadioBtns("link-to-us-txt-choices","link-to-us-txt");
	}

	link_3 = document.getElementById('link-to-us-03');
	link_3.onclick = function() {
		myTitle.firstChild.nodeValue = linkTitle[3];
		textArea.value = linkCode[3];
		myImg.src = this.firstChild.src;
		removeLinkExample();
		clearRadioBtns("link-to-us-txt-choices","link-to-us-txt");
	}
	
	link_4 = document.getElementById('link-to-us-04');
	link_4.onclick = function() {
		myTitle.firstChild.nodeValue = linkTitle[4];
		textArea.value = linkCode[4];
		myImg.src = this.firstChild.src;
		removeLinkExample();
		clearRadioBtns("link-to-us-txt-choices","link-to-us-txt");
	}

	link_5 = document.getElementById('link-to-us-05');
	link_5.onclick = function() {
		myTitle.firstChild.nodeValue = linkTitle[5];
		textArea.value = linkCode[5];
		myImg.src = 'http://www.whitefence.com/qsrimages/linkShare/BMS/BMS-banner-02-dummy.jpg';
		removeLinkExample();
		clearRadioBtns("link-to-us-txt-choices","link-to-us-txt");
	}
	
	link_txt_01 = document.getElementById('link-to-us-txt-01');	
	link_txt_01.onclick = function() {
		removeLinkExample();
		addLinkExample("Get Home Service through BundleMyServices");
		myTitle.firstChild.nodeValue = linkTitle[0];
		myImg.src = 'images/spacer.gif';	
	}

	link_txt_02 = document.getElementById('link-to-us-txt-02');	
	link_txt_02.onclick = function() {
		removeLinkExample();
		addLinkExample("Compare and Order Bundles Service through BundleMyServices");
		myTitle.firstChild.nodeValue = linkTitle[0];
		myImg.src = 'images/spacer.gif';	
	}

	link_txt_03 = document.getElementById('link-to-us-txt-03');	
	link_txt_03.onclick = function() {
		removeLinkExample();
		addLinkExample("Choose Your Bundle through BundleMyServices");
		myTitle.firstChild.nodeValue = linkTitle[0];
		myImg.src = 'images/spacer.gif';	
	}	

}

function addLinkExample(linkText) {
	textLinkCode = '<a href="http://thrull.qcorps.com/WebStrategies/BundleMyServices">' + linkText + '</a>';
	textArea.value = textLinkCode;
	example = document.getElementById('link-to-us-example');
	anchor = document.createElement("a");
	anchor.href = "http://www.BundleMyServices.com";
	anchor.id = "show-link-example"
	txt = document.createTextNode(linkText);
	anchor.appendChild(txt);
	example.appendChild(anchor);		
}

function removeLinkExample() {
	if (example = document.getElementById('link-to-us-example')) {
		if (a = document.getElementById('show-link-example')) {
			example.removeChild(a);
		}
	}
}

function clearRadioBtns(formId,radioId) {

	if (myForm = document.getElementById(formId)) {
		for (var i=0; i<myForm.length; i++) {
			myForm[i].checked = false;
		}
	}
}	


