var RESIZE_MY_HEIGHT = false;

$().ready(function() 
{
	if (RESIZE_MY_HEIGHT)
	{
		var height = $('#bodycontent').height();
		$('#wcontent').height((height-32));
	}
});

function makePdf()
{
	var bodyElement = document.getElementsByTagName('body');
	bodyElement = bodyElement[0];
	
	var host = location.host;
	var protocol = location.protocol;
	var href = location.href;
	
	var url = protocol + '//' + host; 
	
	var action = href.substring(url.length + 1);
	
	if($e('pdfgen'))
	{
		$e('pdfgen').submit();
		return;
	}
	else
	{
		var pdfform = document.createElement('form');
		pdfform.name = 'pdfgen';
		pdfform.id = 'pdfgen';
		pdfform.action = '/'+action + '?pdf=1';
		pdfform.method = 'post';
		
		bodyElement.appendChild(pdfform);
		
		pdfform.submit();
	}
}

function randRange(minN,maxN) 
{
	var randomNum = Math.floor(Math.random()*(maxN - minN + 1))+minN;
	return randomNum;
}


jQuery.fn.fadeIn = function(speed, callback) { 
    return this.animate({opacity: 'show'}, speed, function() { 
        if (jQuery.browser.msie)  
            this.style.removeAttribute('filter');  
        if (jQuery.isFunction(callback)) 
            callback();  
    }); 
}; 
 
jQuery.fn.fadeOut = function(speed, callback) { 
    return this.animate({opacity: 'hide'}, speed, function() { 
        if (jQuery.browser.msie)  
            this.style.removeAttribute('filter');  
        if (jQuery.isFunction(callback)) 
            callback();  
    }); 
}; 

function rotatePhotos(momentPhoto, element) 
{
		if(element) nextElement = 0;
			   else nextElement = 1;
		$('#header-photo-'+nextElement).addClass('photos n'+momentPhoto);
		$('#header-photo-'+nextElement).css('position', 'absolute');
		$('#header-photo-'+element).fadeOut('fast');
		$('#header-photo-'+nextElement).fadeIn('fast')
		
		
    var maxPhotos = 4;
	if(momentPhoto == maxPhotos) { momentPhoto = 0; }
	momentPhoto++;
	setTimeout("rotatePhotos("+momentPhoto+", "+nextElement+")", 5000);
}