/*
	Basic JS library.
*/

// private variables
var _NOSCROLL_POPUP_FEATURES = 'location=0,statusbar=0,menubar=0,resizable=no,scrollbars=no,top=100,left=100,screenX=100,screenY=100';
var _SCROLL_POPUP_FEATURES = 'location=0,statusbar=1,menubar=0,resizable=yes,scrollbars=yes,top=100,left=100,screenX=100,screenY=100';
var PATH = window.location.pathname;
var SCRIPT_NAME = PATH.substring(PATH.lastIndexOf('/') + 1);
if (!window.console) console = {log: function() {}};

function raw_popup(url, target, can_scroll, w_width, w_height) 
{
	// define base set depending on whether the window can scroll or not
	var features = _SCROLL_POPUP_FEATURES;
	if (can_scroll==false) features = _NOSCROLL_POPUP_FEATURES;
	// define target attr
	if (typeof(target)=='undefined') target = '_blank';
	// add width and height to features
	if (typeof(w_width)=='undefined') w_width = 400;
	if (typeof(w_height)=='undefined') w_height = 300;
	features += ',width='+w_width+',height='+w_height;
	// call the window
	var theWindow = window.open(url, target, features);
	// setTimeout('theWindow.focus();',250);
	return theWindow;
}

function link_popup(src, can_scroll, w_width, w_height) 
{
	return raw_popup(src.getAttribute('href'), src.getAttribute('target') || '_blank', can_scroll, w_width, w_height);
}

// DOMLoaded init script
var DomLoaded =
{
	onload: [],
	loaded: function()
	{
		if (arguments.callee.done) return;
		arguments.callee.done = true;
		for (i = 0;i < DomLoaded.onload.length;i++) DomLoaded.onload[i]();
	},
	load: function(fireThis)
	{
		this.onload.push(fireThis);
		if (document.addEventListener) 
			document.addEventListener("DOMContentLoaded", DomLoaded.loaded, null);
		if (/KHTML|WebKit/i.test(navigator.userAgent))
		{ 
			var _timer = setInterval(function()
			{
				if (/loaded|complete/.test(document.readyState))
				{
					clearInterval(_timer);
					delete _timer;
					DomLoaded.loaded();
				}
			}, 10);
		}
		/*@cc_on @*/
		/*@if (@_win32)
		var proto = "src='javascript:void(0)'";
		if (location.protocol == "https:") proto = "src=//0";
		document.write("<scr"+"ipt id=__ie_onload defer " + proto + "><\/scr"+"ipt>");
		var script = document.getElementById("__ie_onload");
		script.onreadystatechange = function() {
			if (this.readyState == "complete") {
				DomLoaded.loaded();
			}
		};
		/*@end @*/
	   window.onload = DomLoaded.loaded;
	}
};


function window_init()
{
	/*
		Add your loading code in here, e.g. the exact same stuff which you would normally put
		inline in the HTML.  This function will get run once the page structure is loaded.
	*/
	flashContentDiv = document.getElementById( 'flashcontent' );	
	if (flashContentDiv)
	{	
		var fo = new SWFObject("viewer.swf", "viewer", "880", "360", "7", "#181818");	
		fo.addVariable("preloaderColor", "0xffffff");
		fo.addVariable("xmlDataPath", "flickrViewer.php");
		fo.addParam('wmode', 'transparent');
		fo.write("flashcontent");
	}
}

DomLoaded.load( window_init );
