function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_setTextOfLayer(objName,x,newText) { //v4.01
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


function MM_showHideBlocks() { //v1.0 ICU  creation
  var i,p,v,obj,args=MM_showHideBlocks.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style;  var d=(v=='show')?'block':'none'; 
					  v=(v=='show')?'visible':(v=='hide')?'hidden':v;
				}
    obj.visibility=v; 
    obj.display=d; }
}

function externalLinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && anchor.getAttribute("rel") && ( anchor.getAttribute("rel").match(/(^| )pdf( |$)/) || anchor.getAttribute("rel").match(/(^| )ipo( |$)/) ) ) 
    	anchor.target = "_blank"; 
 } 
}

function ipoPageInit() {
 externalLinks();
 initSid();
 // boingboing();
 }

if (! window.onload ) { window.onload = ipoPageInit};


function boingboing() {
	SetCookie("test","1","","/");
	//do we have cookie support
	if (GetCookie("test")) {
		SetCookie("test","closed",new Date(1),"/"); //delete
		if (!GetCookie("noboingboing") && !GetCookie("bl")) {
	    	var fileref=document.createElement("link")
			fileref.setAttribute("rel", "stylesheet")
        	fileref.setAttribute("type", "text/css")
        	fileref.setAttribute("href", "/boinboing.css")
			document.getElementsByTagName("head")[0].appendChild(fileref)


			var mytext=document.createElement("div");
			mytext.setAttribute('id','bottomnav');
			mytext.innerHTML='<div id="boingDiv"><a href="#" class="closeMe" onclick="return boingboingclose();"><span>X</span></a><div id="boingText"><a href="/survey.htm" rel="ipo" title="Tell us what you think..." class="surveyLink">Tell us what you think...</a><div id="boingTextSmall">(opens a new window)</div></div></div>';
			MM_findObj("page").appendChild(mytext);
			MM_findObj("bottomnav").style.position="fixed";
		}
	}
}
function boingboingclose() {
	SetCookie("noboingboing","closed","","/"); //session
	MM_findObj("bottomnav").style.visibility="hidden";
	return false; 
 }

 

function switchInner(objName,inner,preCheck) {
	if (preCheck) {
		if (MM_findObj(objName).innerHTML.replace(/^\s+|\s+$/g,"") != "") { 
			MM_findObj(objName).innerHTML=inner;
		}
	} else {
		MM_findObj(objName).innerHTML=inner;
	}
}


function injectSid() {
 var byesid=MM_findObj("byesid");
 byesid.innerHTML="<a href='#' onclick='hideSid();setSidCookie(); return false; '>Hide this</a>";
 byesid.style.visibility="visible";
}

function hideSid() {
         MM_showHideBlocks("sid","","hide");
         MM_showHideBlocks("sid2","","hide");

}
function setSidCookie() {
         var cookieDays=1000; // how many days is this cookie going to last for.
         var expdate = new Date ();
         FixCookieDate (expdate); // Correct for Mac date bug - call only once for given Date object!
         expdate.setTime (expdate.getTime() + (cookieDays * 24 * 60 * 60 * 1000)); // 1000 days from now
         SetCookie ("nomnom", "x", expdate, "/");
}

function initSid() {
if (MM_findObj("sid")) {
	 if (GetCookie("nomnom")) {
	   hideSid();
	} else {
	   injectSid();
	}
 }
}

//Cookie Functions Taken from Bill Dortch's Night of the Living cookie
//call GetCookie ...getCookieVal is internal
function FixCookieDate (date) {
  var base = new Date(0);
  var skew = base.getTime(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    date.setTime (date.getTime() - skew);
}
function SetCookie (name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=.uregina.ca" : "") +
    ((secure) ? "; secure" : "");
}

function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
  }
  return null;
}

function AddFlashObjectToElement(element, name, url, flashVersion, height, width, alternativeContent, background, windowMode) {
	if ((FlashDetect.installed) && (FlashDetect.major >= flashVersion)) {
		var scriptStr = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase="+document.location.protocol+"\"//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+flashVersion+",0,0,0\" width=\""+width+"\" height=\""+height+"\" id=\""+name+"\"><param name=\"movie\" value=\""+url+"\"/> <param name=\"menu\" value=\"false\"/><param name=\"WMode\" value=\""+windowMode+"\"/> <param name=\"quality\" value=\"high\"/> <param name=\"bgcolor\" value=\"" + background + "\"/> <embed src=\"" + url + "\" menu=\"false\" quality=\"high\" bgcolor=\""+background+"\" wmode=\""+windowMode+"\" width=\""+width+"\" height=\""+height+"\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"></embed></object>";
        document.getElementById(element).innerHTML = scriptStr;
	} else {
		document.getElementById(element).innerHTML = alternativeContent;
	}
}

/*
Copyright (c) Copyright (c) 2007, Carl S. Yestrau All rights reserved.
Code licensed under the BSD License: http://www.featureblend.com/license.txt
Version: 1.0.3
*/

var FlashDetect = new function(){
	var self = this;
	self.installed = false;
	self.raw = "";
	self.major = -1;
	self.minor = -1;
	self.revision = -1;
	self.revisionStr = "";
	var activeXDetectRules = [
		{
			"name":"ShockwaveFlash.ShockwaveFlash.7",
			"version":function(obj){
				return getActiveXVersion(obj);
			}
		},
		{
			"name":"ShockwaveFlash.ShockwaveFlash.6",
		    "version":function(obj){
		        var version = "6,0,21";
				try{
					obj.AllowScriptAccess = "always";
	                version = getActiveXVersion(obj);
				} catch(err){}
	            return version;
		}
	},
	{
		"name":"ShockwaveFlash.ShockwaveFlash",
	    "version":function(obj){
			return getActiveXVersion(obj);
		}
	}
	];
		var getActiveXVersion = function(activeXObj){
		var version = -1;
	    try{
			version = activeXObj.GetVariable("$version");
	    }catch(err){}
			return version;
	};
	var getActiveXObject = function(name){
		var obj = -1;
		try{
			obj = new ActiveXObject(name);
	    }catch(err){}
	    return obj;
	};
	var parseActiveXVersion = function(str){
	var versionArray = str.split(",");//replace with regex
		return {
			"raw":str,
			"major":parseInt(versionArray[0].split(" ")[1], 10),
			"minor":parseInt(versionArray[1], 10),
			"revision":parseInt(versionArray[2], 10),
			"revisionStr":versionArray[2]
		};
	};

		var parseStandardVersion = function(str){
		var descParts = str.split(/ +/);
		var majorMinor = descParts[2].split(/\./);
		var revisionStr = descParts[3];
		return {
			"raw":str,
			"major":parseInt(majorMinor[0], 10),
	        "minor":parseInt(majorMinor[1], 10), 
	        "revisionStr":revisionStr,
	        "revision":parseRevisionStrToInt(revisionStr)
		};
	};

	var parseRevisionStrToInt = function(str){
		return parseInt(str.replace(/[a-zA-Z]/g, ""), 10) || self.revision;
	};

	self.majorAtLeast = function(version){
		return self.major >= version;
	};

	self.FlashDetect = function(){
		if(navigator.plugins && navigator.plugins.length>0){
			var type = 'application/x-shockwave-flash';
			var mimeTypes = navigator.mimeTypes;
		    if(mimeTypes && mimeTypes[type] && mimeTypes[type].enabledPlugin && mimeTypes[type].enabledPlugin.description){
				var version = mimeTypes[type].enabledPlugin.description;
				var versionObj = parseStandardVersion(version);
				self.raw = versionObj.raw;
				self.major = versionObj.major;
				self.minor = versionObj.minor; 
				self.revisionStr = versionObj.revisionStr;
				self.revision = versionObj.revision;
				self.installed = true;
			}
		} else if(navigator.appVersion.indexOf("Mac")==-1 && window.execScript){
			var version = -1;
			for(var i=0; i<activeXDetectRules.length && version==-1; i++){
				var obj = getActiveXObject(activeXDetectRules[i].name);
				if(typeof obj == "object"){
					self.installed = true;
					version = activeXDetectRules[i].version(obj);
					if(version!=-1){
						var versionObj = parseActiveXVersion(version);
						self.raw = versionObj.raw;
						self.major = versionObj.major;
						self.minor = versionObj.minor; 
						self.revision = versionObj.revision;
						self.revisionStr = versionObj.revisionStr;
					}
				}
			}
		}
	}();
};
FlashDetect.release = "1.0.3";
function externalLinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
  for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   anchor.target="_top";
 }
 var anchors = document.getElementsByTagName("form"); 
  for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   anchor.target="_top";
 }
}
if (! window.onload ) { window.onload = externalLinks };