function gup(name){
	var regexS="[\\?&]"+name+"=([^&#]*)";
	var regex=new RegExp(regexS);
	var tmpURL=window.location.href;
	var results=regex.exec(tmpURL);
	if(results===null){
		return""
	}
	else{
		return results[1]
	}
}
/*
	Script Name: "Get latest news"
	Required Params:
		1. "OUTPUTSTYLE" = "headlines" (only headlines), "paragraph" (headline, first paragraph), "fullstory" (headline, full story)
		2. "PARAM" = search parameters
		3. "WRITEBLOCK" = Block element where results are inserted via .html()
		4. "COUNT" = how many news items should be displayed
*/
function getNews(OUTPUTSTYLE, PARAM, WRITEBLOCK, COUNT) {
	$.ajax({
	    type: "GET",
	    url: "http://www.utah.gov/whatsnew/rss.xml", 
	    contentType: "text/xml; charset=utf-8",
	    data: PARAM,
	    dataType: "application/xml",
	    error: function(req, status, errorThrown){
	        //console.log("Error: " + status + ", " + errorThrown);
	    },
	    success: function (xml, status){
	        var xmlDoc;
	        try{
	            var domParser = new DOMParser();
	            xmlDoc = domParser.parseFromString(xml,'application/xml');
	        }
	        catch(err) {
	            xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
	            xmlDoc.async="false";
	            xmlDoc.loadXML(xml);
	        }
	       	$(xmlDoc).find('item').each(function(index){
				// loop through and output non-featured news stories
				$(".ajaxloader").remove();
				var title = $(this).find('title').text();
				var url = $(this).find('link').text();
				var description = $(this).find('description').text();
				var guid = $(this).find('guid').text();
				var date = dateFormat($(this).find('pubDate').text(), "fullDate");
				var category = $(this).find('category').text();
				switch(OUTPUTSTYLE){
					case "headlines":
						$("#"+WRITEBLOCK).append('<li><a href="'+url+'">'+title+'</a> ('+date+')</li>');
					break;
					case "paragraph":
						$("#"+WRITEBLOCK).append('<h4><a href="'+url+'">'+title+'</a></h4>'+description);
					break;
					case "fullstory":
						$("#"+WRITEBLOCK).append('<h4><a href="'+url+'">'+title+'</a></h4>'+description);
					break;
				}
				if (index>=COUNT) {
					return false;
				};
			});
    	}
	});
}