/* popup windows */
function popitup(url,w,h) {
	var width = w || 600;
	var height = h || 750;
	newwindow=window.open(url,'name','height='+height+',width='+width+',resizable=no');
	if (window.focus) {newwindow.focus()}
	return false;
}

function loadVodkas() {
	//only load flash once
	if(!loadedAboutVodkas) {
		var flashvars = {};
		var params = {
			allowScriptAccess: "sameDomain",
			wmode: "transparent"
		};
		var attributes = {};
		swfobject.embedSWF("swf/preloader.swf", "about_vodkas_flash", "985", "470", "9.0.0", "swf/expressInstall.swf", flashvars, params, attributes);
		
		loadedAboutVodkas = true;
	}
}
var builderSplash;
function loadBotSplash(){
	if(!loadedBotSplash){
		var flashvars = {bot_url:"builder",
						 ani_url:"swf/bot_animations.swf"};
		var params = {
			allowScriptAccess: "sameDomain",
			wmode: "transparent"
		};
		var attributes = { id:"builderSplash"};
		swfobject.embedSWF("swf/bot_builder_splash.swf", "bot_builder_splash_flash", "965", "600", "9.0.0", "swf/expressInstall.swf", flashvars, params, attributes);
		loadedBotSplash = true;
	} else {
		document.getElementById("builderSplash").show();
	}
}

function onLeaveBotSplash(){
	document.getElementById("builderSplash").hide();
}

function loadEvents()
{
	$.ajax(
	{
		type: "GET",
//		url: "xml/events.php?callback=?",
//		url: "http://sansumbrella.com/things/events.php?callback=?",
//		url: "http://svedka.politeinpublic.com/xml/events.xml",
		
		url: "http://www.svedkaphotos.com/feeds/events.json",
      	dataType: "jsonp",
        success: function(data)
		{
			var i = 1;
			var j = 1;
			var titles="";
			for(var id in data['events'])
			{
				//titles+=data['events'][i]['title'] + " ";
				var ev = data['events'][id];
				if(ev['type']=="upcoming")
				{
					var theid = "#ue_" + i; //the ID of the list element it goes in 
					var outputHTML = "";
					outputHTML += "<h3>" + ev["title"] + "</h3>";
					outputHTML += "<h4>" + ev["citystate"] + "<br />";
					outputHTML += ev["venue"] + "<br />";
					outputHTML += ev["date"] + "</h4>";
					outputHTML += '<h5><a href="' + ev["galleryurl"] + '">More info &raquo;</a></h5>';

					$(theid).append(outputHTML);
					i++;
				}else if((ev['type'] == "previous") && (j < 4))
				{
					var theid = "#pe_" + j;
					var outputHTML = "";
					outputHTML += "<h3>" + ev["title"] + "</h3>";
					outputHTML += "<h4>" + ev["citystate"] + "<br />";
					outputHTML += ev["venue"] + "<br />";
					outputHTML += ev["date"] + "</h4>";
					outputHTML += '<h5><a href="' + ev["galleryurl"] + '">More info &raquo;</a></h5>';

					$(theid).append(outputHTML);
					j++;
				}
			}
		}//success
    });//ajax
}