// manipulate DOM for iPhone and mobile platforms

function showSummaries() {
	// hide all paragraphs
	var allP = XPath.selectNodes('//div[@class="entry"]/*', document.body);
	for (var i = 0; i < allP.length; i++) {
	   if (allP[i].style) allP[i].style.display = "none";
	}

	// reveal first paragraphs
	allP = XPath.selectNodes('//div[@class="entry"]/p[1]', document.body);
	for (var i = 0; i < allP.length; i++) {
	   if (allP[i].style) allP[i].style.display = "block";
	}
}

function showComplete() {
	var allP = XPath.selectNodes('//div[@class="entry"]/*', document.body);
	for (var i = 0; i < allP.length; i++) {
	   if (allP[i].style) allP[i].style.display = "block";
	}
}

function enlargeImages(x) {
	var allP = XPath.selectNodes('//div[@class="entry"]/img', document.body);
	for (var i = 0; i < allP.length; i++) {
	   if (allP[i].width) allP[i].width = x*allP[i].width;
	   if (allP[i].height) allP[i].height = x*allP[i].height;
	}		
}

function postClick(url) {
	if (screen.width <= 480) {
		window.location = url;
	}
}

// iPhone only gets summaries
if (screen.width <= 480) {
	showSummaries();
} else {
	// remove post click events 
	allP = XPath.selectNodes('//div[@class="entry"]', document.body);
	for (var i = 0; i < allP.length; i++) {
	   allP[i].onclick = null;	
	}	
}