<!--


function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function SetNoFlash() {
  createCookie('noFlash','noFlash',7);
  document.location.href = document.location.href;
}
function SetShowFlash() {
  eraseCookie('noFlash');
  document.location.href = document.location.href;
}

function WriteGallery(swffile,w,h,page) {
  
  var query = document.location.search;
  if(readCookie('noFlash')=='noFlash') {
    document.body.innerHTML = document.body.innerHTML + '<div style="text-align:center;"><a href="javascript:SetShowFlash();">Flash Version</a></div>';
    return false; 
  }
  
  // Version check based upon the values entered above in "Globals"
  var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
  
  // Check to see if the version meets the requirements for playback
  if (hasReqestedVersion) {  // if we've detected an acceptable version

    var oeGallerytag = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
    + 'width="'+w+'" height="'+h+'"'
    + 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
    + '<param name="movie" value="'+swffile+'"><param name="quality" value="high"><param name="bgcolor" value="#fff" />'
    + '<param name="FlashVars" value="href='+page+'">'
    + '<param name="allowFullScreen" value="true">'
    + '<embed src="'+swffile+'" quality="high" bgcolor="#fff" '
    + 'width="'+w+'" height="'+h+'" name="detectiontest" aligh="middle"'
    + 'play="true"'
    + 'loop="true"'
    + 'quality="high"'
    + 'FlashVars="href='+page+'"'
    + 'allowFullScreen="true"'
    + 'allowScriptAccess="sameDomain"'
    + 'type="application/x-shockwave-flash"'
    + 'pluginspage="http://www.macromedia.com/go/getflashplayer">'
    + '</embed>'
    + '</object>';
    
    document.body.innerHTML = oeGallerytag;   
    
    // embed the Flash Content SWF when all tests are passed

  } else {  // flash is too old or we can't detect the plugin
    document.body.innerHTML = '<div class="get-flash"><h2>Welcome to Distil Ennui</h2><p>Distil Ennui is a collection of photographs and films by Alexander James that attempt to present the beguiling beauty of our everyday  confinements, re-proposing the forgotten. Images whose essence is derived from the ordinary, displaced and the overlooked. </p><p>Please either visit the BLOG http://blog.distilennui.com/ or the STOCK LIBRARY www.AlexanderJamesStockPhotography.com</p><p>Before we can start here you will need to get the latest <a href="http://get.adobe.com/flashplayer/" target="_blank" title="Download Flash Player">Adobe Flash Player</a>.</div>'+document.body.innerHTML
  }

}
// -->
