function equalHeight(cols) {
	tallest = 0;
	cols.each(function() {
		thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	cols.height(tallest);
}

function doClear(theText) {
	if (theText.value == theText.defaultValue) {
		theText.value = ""
	}
}

/* AJAX 
------------------------------------*/
var loadedobjects=""
var rootdomain="http://"+window.location.hostname

function makeRequest(url, containerid) {
	var httpRequest;
	if (window.XMLHttpRequest) { // Mozilla, Safari, ...
		httpRequest = new XMLHttpRequest();
		if (httpRequest.overrideMimeType) {
			httpRequest.overrideMimeType('text/xml');
			// See note below about this line
		}
	} 
	else if (window.ActiveXObject) { // IE
		try {
			httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) {
			try {
				httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e) {}
		}
	}

	if (!httpRequest) {
		alert('Cannot create an XMLHTTP instance');
		return false;
	}
	httpRequest.onreadystatechange = function() { 
//		alertContents(httpRequest);
		loadpage(httpRequest, containerid)
	};
	httpRequest.open('GET', url, true);
	httpRequest.send('');

}

function loadpage(httpRequest, containerid){
	try {
		
		if(httpRequest.readyState < 4){
			document.getElementById("status").innerHTML = "<div id='loading' style='display:block;'>Loading...<br /><img src='/images/loading-01.gif' /></div>";
		} 
		else if(httpRequest.readyState == 4 && httpRequest.status == 200){
			document.getElementById("status").innerHTML = "<div id='loading' style='display:none;'>Loading...<br /><img src='/images/loading-01.gif' /></div>";
			document.getElementById(containerid).innerHTML = httpRequest.responseText;
		}
		else {
			alert('Problem with the request: \n' + httpRequest.statusText);
		}		
	}
	catch(e) {
		alert('Caught Exception: ' + e);
	}
}




/* jQuery 
---------------------------------------- */
$(document).ready(function(){
		
	/* Zebra stripes
	-----------------------------------------
	just add the class ".zebra" to any element (<table>, <ul>, <div> etc) to automatically stripe it's contents 
	*/
	$(".zebra tr:odd").addClass("odd");
	$(".zebra li:odd").addClass("odd");


	/* Highlight rows on mouseOver
	----------------------------------------- */
	$(".zebra tr").mouseover(function() { 
		$(this).addClass("over");
	})
	.mouseout(function() {
		$(this).removeClass("over");
	});


	/* Animate top menu	
	----------------------------------------- */
	$('.nav ul li').hover(function() { //mouse in
		$(this).stop().animate({ paddingTop: '15px', marginTop: '25px' }, 200);											
	}, function() { //mouse out
		$(this).stop().animate({ paddingTop: '0', paddingBottom: '0', marginTop: '0', marginBottom: '0'  }, 100);
	 });
	
	
	/* Tabs
	----------------------------------------- */
	$(function () {
		var tabContainers = $('div.tabContent > div');
		tabContainers.hide().filter(':first').show();
		
		$('ul.tabNavigation a').click(function () {
			tabContainers.hide();
			tabContainers.filter(this.hash).show();
			$('ul.tabNavigation a').removeClass('selected');
			$(this).addClass('selected');
			return false;			
		}).filter(':first').click();
		
		
		/* books */
		var tabContainersBooks = $('div.tabContentBooks > div');
		tabContainersBooks.hide().filter(':first').show();
		
		$('ul.tabNavBooks a').click(function () {
			tabContainersBooks.hide();
			tabContainersBooks.filter(this.hash).show();
			$('ul.tabNavBooks a').removeClass('selected');
			$(this).addClass('selected');
			return false;			
		}).filter(':first').click();
		
	});
	
	
	
	/* Switch Thumbnail/List view
	----------------------------------------- */
	$("a.switch_view").toggle(function(){
		$(this).addClass("swap"); 
		$("ul.display").fadeOut("fast", function() {
			$(this).fadeIn("fast").addClass("list_view"); 
		});
	}, 
	function () {
		$(this).removeClass("swap");		
		$("ul.display").fadeOut("fast", function() {
			$(this).fadeIn("fast").removeClass("list_view");
		});
	}); 	
	
	
	/* Load iFrame
	----------------------------------------- */
	function callIframe(url, callback) {
		$(document.body).append('<iframe id="myId" height="650" width="650" frameborder="0"></iframe>');
		$('iframe#myId').attr('src', url);
	
		$('iframe#myId').load(function() {
			callback(this);
		});
	}
	
	
	
	
	
	/* Initialize plugins/functions that require activation 
	----------------------------------------- */
	equalHeight($(".eqheight"));

	
});	

 	

