// JavaScript Document
// resize images on page to 782px;
window.addEvent('domready', function() {
									 
									 
//scale function									 
function scaleSize(maxW, maxH, currW, currH){
    var ratio = currH/currW;
    if(currW >= maxW && ratio <= 1){
        currW = maxW;
        currH = currW * ratio;
    } else if(currH >= maxH){
        currH = maxH;
        currW = currH/ratio;
    }
    return [currW, currH];
}


//get images pertaining to posts only
var allImages = $('content').getElements('img');
var j = 1;
for (i=0; i<allImages.length; i++) {
if (allImages[i].getStyle('width').toInt() > 793) {
var theWidth = allImages[i].getStyle('width').toInt();
var theHeight = allImages[i].getStyle('height').toInt();
var newSize = scaleSize(794,794,theWidth,theHeight);
allImages[i].set('styles', {
    width: newSize[0],
    height: newSize[1]
});
}
//fix paragraph alignment
var allparagraphs = $('content').getElements('p');

for (k=0; k<allparagraphs.length; k++){
	allparagraphs[k].setStyle('text-align','left');
	}


}
//dom ready
});
