//-------------------------------------------------------------
// piclens.js -- binds window.piclens to document (version 8/08)
// (c) 2008 Cooliris Inc

(function() {
    if (window.piclens) {
        return;
    }
    var context = null;
    if (typeof PicLensContext != 'undefined') {
        // Firefox
        context = new PicLensContext();
    } else {
		try {
			// IE
			context = new ActiveXObject("PicLens.Context");
		} catch (e) {
			if (navigator.mimeTypes['application/x-cooliris']) {
				// Safari
				context = document.createElement('object');
				context.style.display = 'none';
				context.width = 0;
				context.height = 0;
				context.type = 'application/x-cooliris';
				document.documentElement.appendChild(context);
			}
		}
	}
	piclens = context;
})();

function piclensLaunchFeed(feedUrl, itemUid) {
	if (!itemUid)
		itemUid = '';
	if (piclens) {
		piclens.launch(feedUrl, (itemUid.length != 0) ? 'uid' : '', itemUid);
	} else {
		// direct user to install Cooliris
		window.location = 'http://www.cooliris.com/';
	}
}

//-------------------------------------------------------------
