function main(play) {
	this.tumblr = tumblr;
	this.matchHeights = matchHeights;
	this.rollOver = rollOver;
	this.rollOut = rollOut;
	this.showLightBox = showLightBox;
	this.openKnit = openKnit;
	this.checkOS = checkOS;
	this.addContact = addContact;
	
	var windows = false;
	var ie = -1;
	
	
	
	if (play && document.images) {
  			var img_c = new Array();
			var img_g = new Array();
			var image = new Array();
			var text = new Array();
			
			img_c[1]= new Image(); 
  			img_c[1].src="thm/play/papercherryblossoms.jpg"; 
			img_g[1]= new Image(); 
  			img_g[1].src="thm/play/papercherryblossoms_g.jpg";
			image[1]= new Image();
			image[1].src="images/play/papercherryblossoms.jpg";
			text[1]= '<p class="lblue">Table decorations. 2007.</p><p>Made from mulberry paper, wire, card, and florist tape.</p>';
			
			img_c[2]= new Image(); 
  			img_c[2].src="thm/play/whales.jpg";
			img_g[2]= new Image(); 
  			img_g[2].src="thm/play/whales_g.jpg";
			image[2]= new Image();
			image[2].src="images/play/whales.jpg";
			text[2]= '<p class="lblue">Earrings. 2008.</p><p>Made from shrink plastic and colored pencil.</p>';
			
			img_c[3]= new Image(); 
  			img_c[3].src="thm/play/joel.jpg";
			img_g[3]= new Image(); 
  			img_g[3].src="thm/play/joel_g.jpg";
			image[3]= new Image();
			image[3].src="images/play/joel.jpg";
			text[3]= '<p class="lblue">Children\'s book. 2007.</p><p>An original hand-drawn picture book created to celebrate the birth of a friend\'s son.</p>';
			
			img_c[4]= new Image(); 
  			img_c[4].src="thm/play/swallows.jpg";
			img_g[4]= new Image(); 
  			img_g[4].src="thm/play/swallows_g.jpg";
			image[4]= new Image();
			image[4].src="images/play/swallows.jpg";
			text[4]= '<p class="lblue">Earrings. 2008.</p><p>Made from shrink plastic and colored pencil.</p>';
			
			img_c[5]= new Image(); 
  			img_c[5].src="thm/play/cherryblossoms.jpg";
			img_g[5]= new Image(); 
  			img_g[5].src="thm/play/cherryblossoms_g.jpg";
			image[5]= new Image();
			image[5].src="images/play/cherryblossoms.jpg";
			text[5]= '<p class="lblue">Earrings. 2007.</p><p>Made from shrink plastic and acrylics.</p>';
			
			img_c[6]= new Image(); 
  			img_c[6].src="thm/play/nook.jpg";
			img_g[6]= new Image(); 
  			img_g[6].src="thm/play/nook_g.jpg";
			image[6]= new Image();
			image[6].src="images/play/nook.jpg";
			text[6]= '<p class="lblue">E-reader cover. 2010.</p>';
			
			img_c[7]= new Image(); 
  			img_c[7].src="thm/play/blanket.jpg";
			img_g[7]= new Image(); 
  			img_g[7].src="thm/play/blanket_g.jpg";
			image[7]= new Image();
			image[7].src="images/play/blanket.jpg";
			text[7]= '<p class="lblue">Baby blanket. 2010.</p><p>Made in celebration of the birth of a friend\'s daughter. Original design.</p>';
			
			img_c[8]= new Image(); 
  			img_c[8].src="thm/play/thomas_front.jpg";
			img_g[8]= new Image();
			img_g[8].src="thm/play/thomas_front_g.jpg"; 
  			image[8]= new Image();
			image[8].src="images/play/thomas_front.jpg";
			text[8]= '<p class="lblue">Child\'s sweater. 2011.</p><p>Commissioned for a friend\'s son.</p>';
			
			img_c[9] = new Image(); 
  			img_c[9].src="thm/play/rose_mittens.jpg";
			img_g[9] = new Image(); 
  			img_g[9].src="thm/play/rose_mittens_g.jpg";
			image[9]= new Image();
			image[9].src="images/play/rose_mittens.jpg";
			text[9]= '<p class="lblue">Mittens. 2010.</p><p>Original design.</p>';
			
			img_c[10] = new Image(); 
  			img_c[10].src="thm/play/leaf_scarf.jpg";
			img_g[10] = new Image(); 
  			img_g[10].src="thm/play/leaf_scarf_g.jpg";
			image[10]= new Image();
			image[10].src="images/play/leaf_scarf.jpg";
			text[10]= '<p class="lblue">Scarf. 2010.</p><p>Original design.</p>';
		}
	
	function matchHeights(box1, box2) {
		var height1 = document.getElementById(box1).offsetHeight
		var height2 = document.getElementById(box2).offsetHeight
		if (height1 > height2) {
			$("#" + box2).css({"height":height1 + "px"});
		} else if (height2 > height1) {
			$("#" + box1).css({"height":height2 + "px"});
		}
		//alert(document.getElementById('vpa_img').parentNode.parentNode.offsetHeight - document.getElementById('vpa_img').offsetHeight + "px");
		$("#vpa_img").parent().parent().css({"position":"relative"});
		$("#vpa_img").css({"position":"absolute","bottom":"0"});//document.getElementById('vpa_img').parentNode.parentNode.offsetHeight - document.getElementById('vpa_img').offsetHeight + "px"});
		
	}
	
	function tumblr(pageNum, scrll) {
		if (scrll) {
			$("#blog").animate({scrollTop: 0}, 'slow');
		}
		//determine number of posts
		var totalPosts = tumblr_api_read['posts'].length;
		var totalPages = Math.ceil(totalPosts/5);
		var h = "<a class='past' name='Blog'>Blog</a><p></p>";
		var vidArr = new Array();
		var startNum = (pageNum - 1) * 5;
		var endPost = startNum + 5;
		if (pageNum == totalPages) {
			endPost = totalPosts;
		}
		for (var i = startNum; i < endPost; i++) {
			h += "<div class='date'>" + tumblr_api_read['posts'][i]['date'] + "</div>";
			if (tumblr_api_read['posts'][i]['type'] == "regular") {
				if (tumblr_api_read['posts'][i]['regular-title'] != "" && tumblr_api_read['posts'][i]['regular-title'] != null && tumblr_api_read['posts'][i]['regular-title'] != "null") {
					h += "<a class='past'>" + tumblr_api_read['posts'][i]['regular-title'] + "</a>";
				}
				h += tumblr_api_read['posts'][i]['regular-body'] + "<hr>";
			} else if (tumblr_api_read['posts'][i]['type'] == "photo") {
				h += "<p><img src='" + tumblr_api_read['posts'][i]['photo-url-250']  + "'/></p>";
				h += tumblr_api_read['posts'][i]['photo-caption'] + "<hr>";
			} else if (tumblr_api_read['posts'][i]['type'] == "link") {
				h += "<p><a class='project' href='" + tumblr_api_read['posts'][i]['link-url'] + "' target='_blank'>" + tumblr_api_read['posts'][i]['link-text'] + "</a><p>" + tumblr_api_read['posts'][i]['link-description'] + "</p><hr>";
			} else if (tumblr_api_read['posts'][i]['type'] == "video") {
				var vidId = "vid" + i;
				h += "<br/><div class='video'id='" + vidId + "'>" + tumblr_api_read['posts'][i]['video-player'] + "</div><p>" + tumblr_api_read['posts'][i]['video-caption'] + "</p><hr>";
				vidArr.push(vidId);
			} else {
				h += "<p>" + i + " post is " + tumblr_api_read['posts'][i]['type'] + "</p><hr>";
			}
		}
		h += "<div class='date'><em>Pages:";
		for (var pages = 1; pages <= totalPages; pages++) {
			if (pages != pageNum) {
				h += "   <a href='javascript:getFunctions.tumblr(" + pages + ", true)'>" + pages + "</a>";
			} else {
				h += "   <b>" + pages + "</b>";
			}
		}
		h += "</em></p></div>";
		$("#blog").html(h);
		for (var count = 0; count < vidArr.length; count++) {
			var video_width = $("#" + vidArr[count] + " > object").width();
			var video_height = $("#" + vidArr[count] + " > object").height();
			var ratio = video_height/video_width;
			var new_height = (460 * ratio) + "px";
			$("#" + vidArr[count] + " > object").css({"max-width":"460px","max-height":new_height});
		}
		$(".blockquote").prepend("<p><em>Reblogged...</em></p>");
		//$(".bottom_bar").css({"bottom":$("html").height() + "px"});
		$("#blog p img").each(function (index) {
			this.onload = function () {
				if ($(this).width() >= 445) {
					var img_width = $(this).width();
					var img_height = $(this).height();
					var ratio = img_height/img_width;
					var new_height = (445 * ratio) + "px";
					$(this).css({"width":"445px","height":new_height});
				}
			}
		});
	}
	
	function rollOver(num) {
		document.images["img" + num].src = img_c[num].src;
	}
	
	function rollOut(num) {
		document.images["img" + num].src = img_g[num].src;
	}
	
	function showLightBox(id) {
		var newId = id;
		//var posTop = $(window).scrollTop() + 25;
		var lrg_img = image[id].src;
		$(document.body).append('<div id="fjp_overlay"></div>')
		.append('<div id="fjp_lightbox"><a class"backBtn" id="back" href="#">back</a><a class="nextBtn" id="next" href="#">next</a><div id="replace" style="margin:0;padding:0;"><img src="' + lrg_img + '" /></div><div id="textBack"><div id="replaceText">' + text[id] + '</div><p style="text-align:center;"><a href="#" id="fjp_light_close">Close</a></p><br/></div></div>');
		$('#fjp_light_close').hover(function(){$('#fjp_light_close').css({'color':'#9e0b0f','border-bottom':'#9e0b0f 5px solid'});},function(){$('#fjp_light_close').css({'color':'#85a9cd','border-bottom':'#85a9cd 5px solid'});});
		$('#fjp_lightbox').css('top', '25px');
		$('#fjp_overlay').fadeTo(500, 0.75, function(){
			$('#fjp_lightbox').fadeTo(250, 1, function() {
				moveBtns();
			});
		});
		$('#fjp_light_close').click(function(e){
			e.preventDefault();
			$('#fjp_lightbox').fadeTo(100, 0, function(){
				$(this).remove();
				$('#fjp_overlay').fadeTo(250, 0, function(){
					$(this).remove();
					allGray();
				});
			});
		});
		$('#next').click(function(e){
			e.preventDefault();
			$("#back").fadeTo(250, 1);
			$("#textBack").fadeTo(250, 1);
			$("#next").fadeTo(250, 1, function(){
				if (newId > 1) {
					newId--;
				} else {
					newId = 10;
				}
				lrg_img = image[newId].src;
				$("#replace").html('<div id="replace" style="margin:0;padding0;"><img src="' + lrg_img + '" /></div>');
				$("#replaceText").html(text[newId]);
				moveBtns();
			});
		});	
		$('#back').click(function(e){
			e.preventDefault();
			$("#back").fadeTo(250, 1);
			$("#textBack").fadeTo(250, 1);
			$("#next").fadeTo(250, 1, function(){
				if (newId < 10) {
					newId++;
				} else {
					newId = 1;
				}
				lrg_img = image[newId].src;
				$("#replace").html('<div id="replace" style="margin:0;padding0;"><img src="' + lrg_img + '" /></div>');
				$("#replaceText").html(text[newId]);
				moveBtns();
			});
		});
	}
	
	function moveBtns() {
		$("#back").css({"left": $("#replace img").offset().left, "top":"50px"});
		$("#next").css({"right": $("#replace img").offset().left, "top":"50px"});
		$("#textBack").css({"width":($("#replace img").width()+30)+"px"});
		$("#textBack").css({"left":($("#replace img").offset().left)+"px"});
		if (ie > -1) {
			$("#textBack").css({"top":(30 + $("#replace img").height()) + "px"});
		} else {
			$("#textBack").css({"top":(40 + $("#replace img").height()) + "px"});
		}
		$("#fjp_lightbox").css({"min-height":($("#replace img").height()+$("#textBack").height()+45) + "px"});
		$("#back").fadeTo(250, 1);
		$("#textBack").fadeTo(250, 1);
		$("#next").fadeTo(250, 1);
		
	}
	
	function openKnit() {
		//$('.knit').popupWindow({height:800,width:1000,windowURL:'test/knit.html'});
		newwindow=window.open("test/knit.html","","height=700,width=1000");
		//if (window.focus) {newwindow.focus()}
			//return false;
	}
	
	function allGray() {
		for (var i = 1; i < 11; i++) {
			document.images["img" + i].src = img_g[i].src;
		}
	}
	
	function checkOS() {
		if (navigator.appVersion.indexOf("Win")!=-1) {
			windows = true;
			$("ul.menu li").css({"padding":"0.15em 0em 0em 0em"});
			ie = getInternetExplorerVersion();
			if (ie > -1) {
				//$("ul.menu li").css({"margin":"0.33em 0em 0em 0em"});
			}
		}
	}
	
	function getInternetExplorerVersion()
	// Returns the version of Internet Explorer or a -1
	// (indicating the use of another browser).
	{
	  var rv = -1; // Return value assumes failure.
	  if (navigator.appName == 'Microsoft Internet Explorer')
	  {
		var ua = navigator.userAgent;
		var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
		if (re.exec(ua) != null)
		  rv = parseFloat( RegExp.$1 );
	  }
	  return rv;
	}
	
	function addContact() {
		$(".content").append('<p class="contact">&copy; 2011 { abi at abievans dot com }</p><br/>');
	}

}
