function createRequest(){ var request; try { request = new XMLHttpRequest(); } catch (e) { try { request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { request = false; }}} return request; } function getNextStory(curStory,RSS,sname){ var currentStoryID = curStory; // This is the Current Story ID from the referring page. use 213579 to test for last index. var rssID = RSS; // Which RSS feed to load. // var pageType = pageType; //Pagetype: STORY link or WIRES. 'this is no longer needed. var sectionName = sname; // Determines which is the main section index page. var req = createRequest(); //alert("/xmlfeed/rss/0,4313," + RSS + ",00.rss"); //DEBUG CODE //req.open("GET","/xmlfeed/rss/test.rss",true); //DEBUG CODE req.open("GET","/xmlfeed/rss/0,4313," + RSS + ",00.rss",true); //Get RSS feed based on Section ID req.onreadystatechange = function(){ if(req.readyState == 4){ if(req.status == 200){ var doc = req.responseXML; var linkArray = doc.getElementsByTagName("link"); var xmlLinks = "||"; var getStoryID; var nextStoryLink; var bisCurrentMatch; var newsSection = "story"; var bRSSdataReady; if(linkArray.length <= 0) { //Validates if RSS data is live and available. bRSSdataReady = false; nextStoryLink = parseSectionName(sectionName); } else { bRSSdataReady = true; } if(bRSSdataReady != false){ for(var i=0; i 0){ //Validate nextStoryLink = xmlLinks[j]; break; } //navigateStory(parseSectionName(sectionName)); //Return to the Main Section Front page. //break; } /////////////////////////////////////////////////////////////////////////////////////////// //alert("start over link is=" + nextStoryLink); //DEBUG CODE navigateStory(nextStoryLink); } } } } req.send(null); } function navigateStory(link){ window.location = link; } function parseSectionName(str) { var input = str.toLowerCase(); var baseURL = "http://www.foxnews.com"; switch(input) { case "u.s.": input = "us"; break case "tech" : input = "technology" break } return baseURL + "/" + input + "/index.html"; }