var getpage="http://www.gbnightlife.com/green-bay-events/widget.php";
if(bandpage == true){
	var senddata = "band="+bandid;
}
else{
	var senddata = "place="+placeid;
}
$(document).ready(function(){
var gbnl_verify=0;
if(window.location.hostname=="www.gbnightlife.com"){
	gbnl_verify=1;
}else{
	if($("a[href*='gbnightlife.com']").length>0){
		var gbnl_isvisible=0;
		for(i=0;i<$("a[href^='http://www.gbnightlife.com']").length;i++){
			if($("a[href^='http://www.gbnightlife.com']:eq("+i+")").is(":visible")){
				gbnl_isvisible+=1;
			}
		}
		if(gbnl_isvisible>0){
			gbnl_verify=1;
		}
	}
}
if(gbnl_verify){
	$.ajax({
		url:getpage,
		dataType:'jsonp',
		data:senddata+"&fu="+(new Date().getTime()),
		jsonp: 'gu_callback',
		success:function(json){
			for (var i = 0; i < json.events.length; i++) {
				if(bandpage == true){
					$('#widget-events ul').append('<li><span class="time">' + json.events[i].time + '</span><span class="details-link"><a href="' + json.events[i].durl + '">Details</a></span><span class="date">' + json.events[i].date + '</span> <span class="title"><a href="' + json.events[i].lurl + '">' + json.events[i].location + '</a></span> <span class="cb"></span></li>');
				}
				else{
					$('#widget-events ul').append('<li><span class="time">' + json.events[i].time + '</span><span class="details-link"><a href="' + json.events[i].durl + '">Details</a></span><span class="date">' + json.events[i].date + '</span> <span class="title"><a href="' + json.events[i].burl + '">' + json.events[i].title + '</a></span> <span class="cb"></span></li>');
				}
			}
		},
		error:function(XMLHttpRequest,textStatus,errorThrown){
			//alert("Poorly formed JSON response.")
		}
	});
}
});