//current notes June 9th trying to figure out how to make the Global varibles into local / private and pass them successfully to other functions
//Last accessed and or updated on July 24th 2009
//javascript for the brand widget 
//Added dynamic diclosure link


		//create arrays for each brand one array for the images and one for the text links
		window.onload = initWidget;
		
			
		
		function initWidget(){
		//set the LOGO
		
		var tHeader = document.getElementById("text");
		if(tHeader.childNodes[1] == null) {
		var logoSet = document.createElement("img");
			//logoSet.setAttribute("id","tableheader");
			logoSet.setAttribute("src","images/lampslogo.jpeg");
			logoSet.setAttribute("alt","Table Lamps for You");
			tHeader.appendChild(logoSet);	
		}
		//alert(tHeader.childNodes[1]);
		
		//done with set Logo
		
	 //Reference to dynamic link function// 		
	// disclosureLink();
		isItNull();
   //Initiate the date 
		 theDay();
	   var startAds = setInterval("arraySwitch()",3000);
	//Initiate AJAX request 	
	try{
	initAJAX();	
	}
	catch(e){
	//do nothing some pages require this function and some do not
	}

		// move the ads back and forward
    //Retrieve the elements that will be used for the event handlers
		var nextLink = document.getElementById("nxt");
		var previousLink = document.getElementById("pre");
		var imageDisplay = document.getElementById("imagespot");
		var linkDisplay = document.getElementById("links");
		var selectElem = document.getElementById("opt");
    //these 2 onclick events will cycle forward and backward through the ads
		nextLink.onclick = arraySwitch;
		previousLink.onclick = arraySwitch;
		
	//These mouse events are used to stop and restart the cycle 
		nextLink.onmouseover = stopAds;
		nextLink.onmouseout = initWidget;
		
		previousLink.onmouseover = stopAds;
		previousLink.onmouseout = initWidget;
		
		imageDisplay.onmouseover = stopAds;
		imageDisplay.onmouseout = initWidget;
		
		linkDisplay.onmouseover = stopAds;
		linkDisplay.onmouseout = initWidget;
		
		selectElem.onmouseover = stopAds;
		selectElem.onmouseout = initWidget;
	//---------------------------------------------------------------//
	// the onclick event for the merchant selection
		document.getElementById("opt").onchange = arraySwitch;
		
	//When this function is trigered the cycle is stopped 
		function stopAds(){
		clearInterval(startAds);
		}
     
	 }
		
	//this will be the object that will hold the arrays of links and
	//images and will also be responsible for displaying them
		function LinkImage(link,image){
							this.link = link;
							this.image = image;



		          	}
		
		
	//Arrays for the images and links 
		function arraySwitch(){
		
		  
		
		var brandMfg = document.getElementById("opt").options.selectedIndex;
		
	var	schonbekLinks = [		new LinkImage('<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FSchonbek-Cellini-Antique-Silver-Crystal-Buffet-Table-Lamp__42643.html" target="new">Schonbek Cellini Antique Silver Crystal Buffet Table Lamp $594.91</a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">','<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FSchonbek-Cellini-Antique-Silver-Crystal-Buffet-Table-Lamp__42643.html" target="new"><img alt="icon" border="0" src="http://images.lampsplus.com/images/42643.fpx?cell=245,245&qlt=75&cvt=jpeg"></a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">'),
								new LinkImage('<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FSchonbek-Bocina-Crystal-Table-Lamp__56879.html" target="new">Schonbek Bocina Crystal Table Lamp $834.91</a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">', '<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FSchonbek-Bocina-Crystal-Table-Lamp__56879.html" target="new"><img alt="icon" border="0" src="http://images.lampsplus.com/images/56879.fpx?cell=245,245&qlt=75&cvt=jpeg"></a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">'),
								new LinkImage('<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FSchonbek-Jasmine-Topaz-Accent-Crystal-Table-Lamp__42833.html" target="new">Schonbek Jasmine Topaz Accent Crystal Table Lamp $699.91</a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">','<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FSchonbek-Jasmine-Topaz-Accent-Crystal-Table-Lamp__42833.html" target="new"><img alt="icon" border="0" src="http://images.lampsplus.com/images/42833.fpx?cell=245,245&qlt=75&cvt=jpeg"></a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">'),
								new LinkImage('<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FSchonbek-Dynasty-Antique-Silver-Finish-Crystal-Table-Lamp__64827.html" target="new">Schonbek Dynasty Antique Silver Finish Crystal Table Lamp $469.91</a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">','<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FSchonbek-Dynasty-Antique-Silver-Finish-Crystal-Table-Lamp__64827.html" target="new"><img alt="icon" border="0" src="http://images.lampsplus.com/images/64827.fpx?cell=245,245&qlt=75&cvt=jpeg"></a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">'),
								new LinkImage('<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FSchonbek-Jasmine-Black-Crystal-Table-Lamp__64724.html" target="new">Schonbek Jasmine Black Crystal Table Lamp $699.91</a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">','<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FSchonbek-Jasmine-Black-Crystal-Table-Lamp__64724.html" target="new"><img alt="icon" border="0" src="http://images.lampsplus.com/images/64724.fpx?cell=245,245&qlt=75&cvt=jpeg"></a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">')];		
		
		
							
	var	quoizelLinks = [    new LinkImage('<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FQuoizel-Indus-Tiffany-Table-Lamp__53500.html" target="new">Quoizel Indus Tiffany Table Lamp Sale: $214.95</a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">','<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FQuoizel-Indus-Tiffany-Table-Lamp__53500.html" target="new"><img alt="icon" border="0" src="http://images.lampsplus.com/images/53500.fpx?cell=245,245&qlt=75&cvt=jpeg"></a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">'),
							  new LinkImage('<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FQuoizel-Chastain-Tiffany-Style-Table-Lamp__F6420.html" target="new">Quoizel Chastain Tiffany-Style Table Lamp Sale: $250.95</a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">' ,'<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FQuoizel-Chastain-Tiffany-Style-Table-Lamp__F6420.html" target="new"><img alt="icon" border="0" src="http://images.lampsplus.com/images/F6420.fpx?cell=245,245&qlt=75&cvt=jpeg"></a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">'),
							  new LinkImage('<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FAmericana-Green-Mica-Carved-Table-Lamp__21306.html" target="new">Americana Green Mica Carved Table Lamp Sale: $261.95</a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">','<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FAmericana-Green-Mica-Carved-Table-Lamp__21306.html" target="new"><img alt="icon" border="0" src="http://images.lampsplus.com/images/21306.fpx?cell=245,245&qlt=75&cvt=jpeg"></a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">'),
							  new LinkImage( '<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FQuoizel-Gotham-Antique-Bronze-Tiffany-Style-Table-Lamp__05314.html" target="new">Quoizel Gotham Antique Bronze Tiffany Style Table Lamp $259.91</a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">', '<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FQuoizel-Gotham-Antique-Bronze-Tiffany-Style-Table-Lamp__05314.html" target="new"><img alt="icon" border="0" src="http://images.lampsplus.com/images/05314.fpx?cell=245,245&qlt=75&cvt=jpeg"></a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">'),
							  new LinkImage( '<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FQuoizel-Ophelia-Tiffany-Table-Lamp__F6412.html" target="new">Quoizel Ophelia Tiffany Table Lamp Sale: $315.95</a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">','<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FQuoizel-Ophelia-Tiffany-Table-Lamp__F6412.html" target="new"><img alt="icon" border="0" src="http://images.lampsplus.com/images/F6412.fpx?cell=245,245&qlt=75&cvt=jpeg"></a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">')];
		
	
		
	var	kichlerLinks = [ 	  new LinkImage('<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FChampagne-Water-Glass-Column-Table-Lamp__J1495.html" target="new">Champagne Water Glass Column Table Lamp $199.91</a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">','<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FChampagne-Water-Glass-Column-Table-Lamp__J1495.html" target="new"><img alt="icon" border="0" src="http://images.lampsplus.com/images/J1495.fpx?cell=245,245&qlt=75&cvt=jpeg"></a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">'),
							  new LinkImage( '<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FKichler-Hand-Painted-Aged-Red-Table-Lamp__J1498.html" target="new">Kichler Hand-Painted Aged Red Table Lamp $239.91</a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">' ,'<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FKichler-Hand-Painted-Aged-Red-Table-Lamp__J1498.html" target="new"><img alt="icon" border="0" src="http://images.lampsplus.com/images/J1498.fpx?cell=245,245&qlt=75&cvt=jpeg"></a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">'),
							  new LinkImage('<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FRaindrops-Double-Accent-Table-Lamp__82766.html" target="new">Raindrops Double Accent Table Lamp $189.91</a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">','<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FRaindrops-Double-Accent-Table-Lamp__82766.html" target="new"><img alt="icon" border="0" src="http://images.lampsplus.com/images/82766.fpx?cell=245,245&qlt=75&cvt=jpeg"></a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">'),
							  new LinkImage('<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FCoconut-Grove-Bronzed-Silver-Crackle-Table-Lamp__82852.html" target="new">Coconut Grove Bronzed Silver Crackle Table Lamp $259.91</a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">','<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FCoconut-Grove-Bronzed-Silver-Crackle-Table-Lamp__82852.html" target="new"><img alt="icon" border="0" src="http://images.lampsplus.com/images/82852.fpx?cell=245,245&qlt=75&cvt=jpeg"></a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">'),
							  new LinkImage('<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FWoodlands-Table-Lamp-with-Illuminated-Lantern__83047.html" target="new">Woodlands Table Lamp with Illuminated Lantern $179.91</a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">','<a href="http://click.linksynergy.com/fs-bin/click?id=ymqsHDn2nO8&subid=&offerid=118789.1&type=10&tmpid=2656&RD_PARM1=http%3A%2F%2Fwww.lampsplus.com%2FProducts%2FWoodlands-Table-Lamp-with-Illuminated-Lantern__83047.html" target="new"><img alt="icon" border="0" src="http://images.lampsplus.com/images/83047.fpx?cell=245,245&qlt=75&cvt=jpeg"></a><img alt="icon" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=ymqsHDn2nO8&bids=118789.1&type=10">')];
		
	
	
	
	//compare the case to see which array was selected 
		switch(brandMfg){
		
		case 0:
		brandMfg = schonbekLinks;
		break;
		
		case 1:
		brandMfg = quoizelLinks;
		break;
		
		case 2:
		brandMfg = kichlerLinks;
		break;
			
		
		
				}
		
		//alert(brandMfg.image);
		
	//determine what element trigered the event
			if(this.id == "pre"){
	//alert(this.id);
			return previousImg(brandMfg);
			
			}
			
			if(this.id =="nxt" || initWidget){ 
	//alert(this);
			return nextImg(brandMfg);
			}
			
		}
	
		
		
		
		
	//Global varirable for keeping the increment in place
		var currentLink = 0;
	//----------------------------
		
	//this will cycle forward through the images
		function nextImg(brandMfg){
	       //var currentLink = 0;
		   
			
			if(currentLink == brandMfg.length -1){
			
			       currentLink = 0;
				 }else{
				   currentLink++;
			
				}
		//	alert(brandMfg.LinkImage.image);
			
			
			 return addContent(brandMfg, currentLink);	
		}
		
		
		
		
	
		
	
	//this function will cycle backward through the array
	function previousImg(brandMfg){
		//alert("inside the previous function");
		
		if(currentLink == 0){
		//alert("conditional statement is working");
          currentLink = brandMfg.length-1;
				}else{
				currentLink--;
			}
		   
           return addContent(brandMfg,currentLink);			
		}
	
	
	
	
	//this function adds and removes the images and links dynamically 
	function addContent(brandMfg,currentLink){
	    //    alert(brandMfg[currentLink].image);
	
	var displayImage = document.getElementById("imagespot");
	var displayLink = document.getElementById("links");
		
	var elem = brandMfg[currentLink].image;
	var elem2 = brandMfg[currentLink].link;
	//var qEL = displayLink.parentNode;
		//alert(qEL);

		displayImage.innerHTML = elem;
		displayLink.innerHTML = elem2;
		//Make sure afflinks have no follow attribute//
		addNoFollow();
		}
	
	//----------------------Dynamic link function-----------------------------------------------------------//
	//demo for next code document.getElementById("someElem" + i);
			function isItNull(){
				//Some pages use these links and others don't so we have to catch the exception 
				try{
			var i = 1;
			var dynaLink = document.getElementById("dynalink" + i);
			var elemValue = dynaLink.firstChild;
			if(elemValue == null && dynaLink != null){ //working on this code August 6th 2009 to debug
			//  alert(dynaLink);
			return disclosureLink(dynaLink); ;
			  }else{
			 //alert("empty/element does not exsist");
			  return false; 
			  }
			 
			  }
			 catch(e){/*do nothing*/}; 
			}
			var checkthisElem = document.getElementById("myID");
			//alert(checkthisElem);
			
			
			function disclosureLink(dynaLink){
				
				var getElem;  
			for(i = 1; i <= 3; i++){
			dynaLink = document.getElementById("dynalink" + i);
			var elem = document.createElement("a");
				elem.setAttribute("href","disclosure.html");
				elem.setAttribute("rel","nofollow");
				elem.setAttribute("name","internalLnk");
				//elem.setAttribute("target","blank");
			var txt = document.createTextNode("Please read the disclosure statement before acting on links");   
			
						  //style the link//
						 dynaLink.style.fontWeight = "bold";
						 dynaLink.style.fontSize = "10pt";
						 dynaLink.style.fontStyle= "italic";
						 dynaLink.style.textAlign = "center";
						
						  //append elements and attributes to the document//
						 elem.appendChild(txt);
						 dynaLink.appendChild(elem);
					}
				}

				//This function will add the nofollow attribute to "a" tags that meet the criteria //
				// It will also omit links that are designated internal//	
							function addNoFollow(){
							
						var myAnchors = document.getElementsByTagName("a");						
					//I updated the conditional statement to add the target attribute to affiliate links	
					//	var isAttr = myAnchors.getAttribute("rel");
						var i;
							for(i = 0; i < myAnchors.length; i++){
							 //alert(myAnchors[i].name);
					if(myAnchors[i].name != "internalLnk" && myAnchors[i].getAttribute("rel") != "nofollow" ){
								myAnchors[i].setAttribute("rel","nofollow");
								myAnchors[i].setAttribute("target", "new");
									}
								}			
							return;
							}

					
					
					
					  
					  
						  
					  
					  
					  
					  
					  
					  
					  
					  
					
					
			
			
			
			
			
	
	
	