/* 	jQuery alternating row colors (zebra-stripe-tables) 
	adds a 'odd' or 'even' classnames on all tables which have a classname of 'p80jq_zebraTable'
============================================================= */

$(document).ready(function(){										// body.onload()
	$("table.p80jQzebraTable tbody tr").each(function(index) {		// to all tr-tags
		$(this).addClass(index % 2 == 0 ? "odd" : "even");			// add an 'odd' or 'even' classname
	});
});

/* 	jQuery rollovers on elements with a src-attribute
	on rollover: 'button.gif' becomes 'button_hover.gif' onmouseover
============================================================= */

$(document).ready(function(){													// body.onload()
	$(".p80jQsrcHover").hover(function() { 										// classname to trigger
		$(this).attr("src", $(this).attr("src").split(".").join("_hover."));	// mouse-over: add the filename suffix
	}, function() {
		$(this).attr("src", $(this).attr("src").split("_hover.").join("."));	// mouse-out: restore, remove filename suffix
	});
});

/* 	jQuery FAQ like expanding list
============================================================= */

$(document).ready(function(){									// body.onload()
	var aExpandingList = "dl.p80jQexpandingList"; 				// dl-tag classname to trigger
	$(aExpandingList+" dt").click(function () { 				// add click function to dt-tags
		if($(this).hasClass('open')) {							// check to see if item is already open
			$(this).removeClass('open'); 						// remove the classname 'open' on all dt-tags
			$(this).next('dd').slideUp('fast');					// animate the dd-tag when clicked
		} else {
			$(aExpandingList+" dd:visible").slideUp('fast'); 	// hide the dd-tag
			$(aExpandingList+" dt").removeClass('open'); 		// remove the classname 'open' on all dt-tags
			$(this).toggleClass('open'); 						// toggle the classname 'open' on dt-tags
			$(this).next('dd').slideDown('fast'); 				// animate the dd-tag when clicked
		}
	});
});

/*	Restore defaultValue on form elements onblur
============================================================= */

$(document).ready(function() {
	$("input:text.p80jQelementRestoreValue, textarea.p80jQelementRestoreValue").each(function() {
		$(this).attr('p80orgFormvalue', $(this).val());
		$(this).addClass('p80FormLabelDefaultValue');
	})
	.focus(function () {
		if($(this).val() != '' && $(this).val() == $(this).attr('p80orgFormvalue')) {
			$(this).val('');
			$(this).removeClass('p80FormLabelDefaultValue');
		}					
	 })
	.blur(function() {
		if($(this).val() == '') {
			$(this).val($(this).attr('p80orgFormvalue'));
			$(this).addClass('p80FormLabelDefaultValue');
		}
	});
}); 

/*	Thumbnail list
============================================================= */

function p80jq_toggle_thumbs(){
	$("img.p80indexThumb").each(function() {			// img-tags with 'index-thumb' classnames
		$(this).toggleClass("p80indexThumb_show"); 			// toggle the classname
	});
}

/*	Unobtrusive Flash embedding using jQuery and SWFObject
============================================================= */
/*
$(document).ready(function(){
	var flashvars = {
		name1: "hello",
		name2: "world",
		name3: "foobar"
	};
	
	var params = {
		wmode: "transparent",
		menu: "false"		
	};
	
	var attributes = {
		id: "myDynamicContent",
		name: "myDynamicContent"
	};
	swfobject.embedSWF("/path/to/movie.swf", "theDivID", "300", "120", "8.0.0","/swf/expressInstall.swf", flashvars, params, attributes);
});
*/

/*	Return a key/value array of the URL query-string
============================================================= */

function p80_get_query_string() {
	var querystring = new Array; 
	// parse current url into an array with the keys/values
	var q = String (document.location).split ('?')[1];
	// return if there is no url query string
	if (!q) return false;
	q = q.split ('&');	
	for (var i = 0 ; i < q.length; i++)	{
		// for each key/value, split them at the '='
		// and add them to the qerystring array
		var o = q[i].split('=');		
		// create the array and url decode the string
		querystring[o[0]] = unescape(o[1]);
	}	
	// return the querystring array
	return querystring;
}

/*	CSS EqualHeight (http://blog.brenelz.com/2008/12/08/jquery-custom-plug-in-equal-height-columns/)
============================================================= */
(function($){
	$.fn.equalHeight = function() {
		tallest = 0;
		this.each(function(){
			thisHeight = $(this).height();
			if( thisHeight > tallest)
				tallest = thisHeight;

		});
		this.each(function(){
			$(this).height(tallest);
		});
	}
})(jQuery);


$(document).ready(function(){													
	$(function(){ 
    	$('.p80jQcolumnEqualHeight').equalHeight();
    }); 
});

/*	partner logo's
============================================================= */
$(document).ready(function(){	
	$(".partner-logos ul li:last-child").addClass("last");
});
    