function clearText(field){
	if (field.defaultValue == field.value) field.value = '';
	else if (field.value == '') field.value = field.defaultValue;
}

function setPagination(postID) {
	oMask 	= $('content');
	maskH 	= 600;
	// ---	get the content height and y position of the scrolling layer
	oScroll 	= $('post-' + postID);
	scrollY 	= Number ( oScroll.style.top.replace ( 'px', '' ) );
	
	pages = $('content').getElementsBySelector('div.page');
	scrollH 	= (pages.length * 640);
	
	init = $('pageInit');
	next = $('pageNext');
	prev = $('pagePrev');
	
	
	prev.onclick = function() {
		var scrollY = Number ( oScroll.style.top.replace ( 'px', '' ) );
		if ((scrollY + 600) <= 0) {
			if (status == 0) {
				new Effect.Move(('post-' + postID), { 
												y: 640, 
												duration: .7, 
												beforeStart: function() { status = 1; }, 
												afterFinish: function() { status = 0; } 
				});
			}
			return false;
		} 
	};


	if (init) {
		init.onclick = function() {
			new Effect.Move(('post-' + postID), { 
												y: -640, 
												duration: .7, 
												beforeStart: function() { status = 1; }, 
												afterFinish: function() { status = 0; }  
			});
			scrollY = Number ( oScroll.style.top.replace ( 'px', '' ) );
			return false;
		}
	}

	next.onclick = function() {
		scrollY = Number ( oScroll.style.top.replace ( 'px', '' ) );
		if ((scrollY - 640) > (0 - scrollH)) {
			if (status == 0) {
 				new Effect.Move(('post-' + postID), {
					 							y: -640, 
												duration: .7, 
												beforeStart: function() { status = 1; }, 
												afterFinish: function() { status = 0; }  
				});
				scrollY = Number ( oScroll.style.top.replace ( 'px', '' ) );
			}
			return false;
		}
	};

}

function showScrim(el) {
	alert(el);
	new Effect.Appear(el, { duration: .325 });
}

function captionToggle() {
	var captions = $('content').getElementsBySelector('div.wp-caption');
	var captionGraphs = $('content').getElementsBySelector('div.wp-caption p');
	
	for (var i=0;i<captions.length;i++) {
		$(captionGraphs[i]).wrap('div', { 'class': 'caption-wrapper' });
	}	
	
	var captionWrappers = $('content').getElementsBySelector('div.caption-wrapper');
	
	for (var i=0;i<captionWrappers.length;i++) {
		//new Effect.Fade(captionWrappers[i]);
		captions[i].onmouseover = function() {
			this.down('.caption-wrapper').appear( { duration: 0.325 } );
		};
		//captions[i].onmouseout = function() {
			//this.down('.caption-wrapper').fade( { duration: 0.325 } );
		//};
	}
}


function setHorizontalScroll(state, postID) {
	var mask = $(postID);
	var pages = mask.getElementsBySelector('.page');
	
	var fullWidth = 0;
	for (var i=0;i<pages.length;i++) {
		var fullWidth = fullWidth + pages[i].offsetWidth;
	}
//	
	
	mask.style.width = fullWidth + 'px';
	
	if (state == 'init') {
		scrollDivLeft('content',30);
	} 
}

function getRid() {
	new Effect.Fade('wrap', { afterFinish: function() {
		new Effect.DropOut('scrim');
	} 
	});
}