function tryStretch() {
	maxHeight=-1;
	if (typeof(cnt)=='undefined') {
		dtext = document.getElementById('detailtext');
		dimg = document.getElementById('detailimg');
	
		if (dtext!=null && dimg!=null) {
			textHeight = dtext.offsetHeight;
			imgHeight = dimg.offsetHeight;
			maxHeight = (textHeight > imgHeight) ? textHeight : imgHeight;
		}
	} else if (cnt > 1) {
		idx = cnt-1;
		if (idx<=6)
			elm = 'feature2'+idx;
		else
			elm = 'feature3block';
		feature = document.getElementById(elm);
		maxHeight = feature.offsetHeight  + feature.offsetTop;
	}
	if (maxHeight > 500) stretch(maxHeight);
}



function stretch(offset) {
	footTM = getStyle('footer', 'marginTop');
	if (footTM=='' || footTM==null) footTM = getStyle('footer', 'margin-top');

	idx = footTM.indexOf('p');
	footTM = footTM.substring(0,idx);

	cloudimg = document.getElementById('cloudimg');	
	cloudimg.style.height = offset +250+'px';
	
	foot = document.getElementById('footer');
	newMargin = offset + footTM/1;		
	foot.style.marginTop =  newMargin + 'px';
}

	
	//alert(textHeight+' ' + imgHeight + ' '+ maxHeight);
	
	//relativeOffset = 0;//582;
	//topOffset = 0; //155;
	
	//image offset 245
	//bottom image height 385
	//top image height 381
	//text position in relation to the top of the cloud image ~ 200
	//if max is greater than 580, use stretch
	
	//crHeight = maxHeight - relativeOffset + topOffset;


function getStyle(el,styleProp)
{
	x = document.getElementById(el);
	if (x.currentStyle) {
		y = x.currentStyle[styleProp];
	} else if (document.defaultView && document.defaultView.getComputedStyle) {
		y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
	}	
	return y;
}

function showPlayerClick() {
	showPlayer();
	return false;
}

function showPlayer() {
	document.getElementById('player').style.display = 'block';
	document.getElementById('playlink').style.display = 'none';
	
}

window.onload = function(){
	tryStretch();
	pl = document.getElementById('playlink');
	if (pl!==null) pl.onclick = showPlayerClick;
}
