jQuery(document).ready(function(){
		
	jQuery('.homepage-slider')
	.after ('<div class="gallery-nav">')
	.cycle({
		fx: 'scrollHorz',
		speed: 500,
		pager: '.gallery-nav',
		timeout: 0
	});

		
	jQuery('.news-slider')
	.after ('<div class="gallery-news-nav">')
	.cycle({ 
	   fx: 'scrollHorz', 
	    speed: 500,
		pager: '.gallery-news-nav',
		timeout: 0 
	 });

		
	jQuery.fn.cleardefault = function() {
		return this.focus(function() {
			if( this.value == this.defaultValue ) {
				this.value = "";
			}
		}).blur(function() {
			if( !this.value.length ) {
				this.value = this.defaultValue;
			}
		});
	};
		
	jQuery(".clearit input, .clearit textarea").cleardefault();
	
	jQuery(window).resize(function() {
	//Left bar
	var w = Math.max((jQuery(document).width()-1000)/2, 0);
   	jQuery("#leftbg").width(w);
   })

   	var w = Math.max((jQuery(document).width()-1000)/2, 0);
   	jQuery("#leftbg").width(w);
   
   	jQuery("img").removeAttr("title");
   	
   	jQuery('#project-description').columnize({
   		width : 306,
   		lastNeverTallest: true,
   	});

});

jQuery(window).load(function(){
	// equal columns
	var currentTallest = 0,
	currentRowStart = 0,
	rowDivs,
	jQueryel,
	topPosition = 0;
	
	jQuery('.page-id-9 .column').each(function() {
		jQueryel = jQuery(this);
		topPosition = jQueryel.offset().top;
		if (currentRowStart != topPosition) {
			// we just came to a new row, set all the heights on the completed row
			if (rowDivs) { rowDivs.height(currentTallest); }
			// set the variables for the new row
			rowDivs = jQueryel; // start new row
			currentRowStart = topPosition;
			currentTallest = jQueryel.innerHeight();
		} else {
			// another div on the current row, add it to the list and check if it's taller
			rowDivs = rowDivs.add(jQueryel);
			currentTallest = Math.max(currentTallest, jQueryel.innerHeight());
		}
		// do the last row
		if (rowDivs) { rowDivs.height(currentTallest); }
	});
	

});

jQuery(window).load(function(){
	// equal columns
	var currentTallest = 0,
	currentRowStart = 0,
	rowDivs,
	jQueryel,
	topPosition = 0;
	
	jQuery('.news-item').each(function() {
		jQueryel = jQuery(this);
		topPosition = jQueryel.offset().top;
		if (currentRowStart != topPosition) {
			// we just came to a new row, set all the heights on the completed row
			if (rowDivs) { rowDivs.height(currentTallest); }
			// set the variables for the new row
			rowDivs = jQueryel; // start new row
			currentRowStart = topPosition;
			currentTallest = Math.max(currentTallest, jQueryel.innerHeight());
		} else {
			// another div on the current row, add it to the list and check if it's taller
			rowDivs = rowDivs.add(jQueryel);
			currentTallest = Math.max(currentTallest, jQueryel.innerHeight());
		}
		// do the last row
		if (rowDivs) { rowDivs.height(currentTallest); }
	});
	

});


