(function($) {
	$.fn.equalHeights = function(minHeight, maxHeight) {
		tallest = (minHeight) ? minHeight : 0;
		this.each(function() {
			if($(this).height() > tallest) {
				tallest = $(this).height();
			}
		});
		if((maxHeight) && tallest > maxHeight) tallest = maxHeight;
		return this.each(function() {
			$(this).height(tallest).css("overflow","auto");
		});
	}
})(jQuery);

$(document).ready(function(){
$("a.jQueryBookmark").click(function(e){

	e.preventDefault(); // this will prevent the anchor tag from going the user off to the link
	var bookmarkUrl = this.href;
	var bookmarkTitle = this.title;

	if (window.sidebar) { // For Mozilla Firefox Bookmark
		window.sidebar.addPanel(bookmarkTitle, bookmarkUrl,"");
	} else if( window.external || document.all) { // For IE Favorite
		window.external.AddFavorite( bookmarkUrl, bookmarkTitle);
	} else if(window.opera) { // For Opera Browsers
		$("a.jQueryBookmark").attr("href",bookmarkUrl);
		$("a.jQueryBookmark").attr("title",bookmarkTitle);
		$("a.jQueryBookmark").attr("rel","sidebar");
	} else { // for other browsers which does not support
		 alert('Your browser does not support this bookmark action.');
		 return false;
	}
});
});

$(document).ready(function(){
	$(".columns").equalHeights(750);
	$("a#click-pagemanager").bind('click', function(){
		$("#pagemanager").openPopup({fadeSpeed:1, followSpeed:1, opacity:0.8});
		return false;
	}); 
	$('.paypal-submit').click(function() {
		$('#paypal').submit();
	});

});

function ShowLetter(letter) {
	
	divs = document.getElementsByTagName("div");
			
	for (i=0; i<divs.length; i++) {
				
		cdiv = document.getElementsByTagName("div").item(i);
		
		if (strpos(cdiv.id, "letter_") !== false) {
			
			cdiv.style.display = (cdiv.id==letter || letter=="reset") ? "block" : "none";
			
		}
			
	}
		
	return false;
	
}

function strpos (haystack, needle, offset) {
    var i = (haystack+'').indexOf(needle, (offset ? offset : 0));
    return i === -1 ? false : i;
}
