
/*
* jQuery emptyonclick plugin
*
* Created by Andreas Creten (andreas@madewithlove.be) on 2008-06-06.
* Copyright (c) 2008 madewithlove. All rights reserved.
*/
jQuery.fn.extend({
    emptyonclick: function(options) {
        return this.each(function() {
            new jQuery.EmptyOnClick(this, options);
        });
    }
});

jQuery.EmptyOnClick = function(element, options) {
    var defaultValue = $(element).val();
    $(element)
    .bind("focus", function(e) {
        if(defaultValue == $(this).val())
            $(this).val("");

    })
    .bind("blur", function(e) {
        if(!$(this).val()) {
            $(this).val(defaultValue);
        }
    });
    $("form:has(#"+element.id+")")
    .bind("reset", function(e) {
        $(element).val(defaultValue);
        $(element).removeClass(options.changeClass);
    }) 
    .bind("submit", function(e) {
        if($(element).val() == defaultValue)
            $(element).val("");
    });
};
/*-------------------------------------------------------------------- 
 * Equal Heights
 * by HoS
--------------------------------------------------------------------*/
$.fn.equalheight = function() {
	tallest = 0;
	this.each(function() {
		thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	this.height(tallest);
}
// Onload
$(document).ready(function(){
	// Emptyonclick
	$(".emptyonclick").emptyonclick();
	// Equalheight
	$(".wrapitem").equalheight();
	// Add CSS selectors to certain modules on load
	$("#nav li:first-child").addClass("navfirst");
	$(".tgrid td:first-child").addClass("tgridcolfirst");
	$(".tgrid td:last-child").addClass("tgridcollast");
	$(".blinks li:last-child").addClass("blinkslast");
	$(".pipes li:first-child").addClass("pipesfirst");
	$(".pipes li:last-child").addClass("pipeslast");
	$(".checkout li:first-child").addClass("checkoutfirst");
	$(".checkout li:last-child").addClass("checkoutlast");
	$(".dgrid tbody tr:odd").addClass("odd");
	$(".dgrid tbody tr:even").addClass("even");
	$(".dlist tbody tr:odd").addClass("odd");
	$(".dlist tbody tr:even").addClass("even");
	$(".fgrid tbody tr:odd").addClass("odd");
	$(".fgrid tbody tr:even").addClass("even");
	// Add nested construction layers to rounded components
	$(".box").wrapInner("<div class='boxw0'><div class='boxw1'><div class='boxw2'><div class='boxw3'><div class='boxw4'><div class='boxw5'></div></div></div></div></div></div>").css("border","0");
});

