/**
 * jQuery.placeholder - Placeholder plugin for input fields
 * Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
 * Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
 * Date: 2008/10/14
 *
 * @author Blair Mitchelmore
 * @version 1.0.1
 *
 **/
(function($){
    $.fn.placeholder = function(settings) {
        settings 		= settings || {};
        var key			= settings.dataKey			|| 'placeholderValue';
        var attr 		= settings.attr 			|| 'alt';
        var className	= settings.className 		|| 'placeholder';
        var values		= settings.values 			|| [];
        var block 		= settings.blockSubmit 		|| false;
        var blank 		= settings.blankSubmit 		|| false;
        var submit 		= settings.onSubmit 		|| false;
        var value		= settings.value 			|| "";
        var position	= settings.cursor_position	|| 0;
        return this.filter(':input').each(function(index) { 
            $.data(this, key, values[index] || $(this).attr(attr)); 
        }).each(function() {
            if ($.trim($(this).val()) === '')
                $(this).addClass(className).val($.data(this, key));
        }).focus(function() {
            if ($.trim($(this).val()) === $.data(this, key)) 
                $(this).removeClass(className).val(value)
                if ($.fn.setCursorPosition) {
                  $(this).setCursorPosition(position);
                }
        }).blur(function() {
            if ($.trim($(this).val()) === value)
                $(this).addClass(className).val($.data(this, key));
        }).each(function(index, elem) {
            if (block)
                new function(e) {
                    $(e.form).submit(function() {
                        return $.trim($(e).val()) != $.data(e, key)
                    });
                }(elem);
            else if (blank)
                new function(e) {
                    $(e.form).submit(function() {
                        if ($.trim($(e).val()) == $.data(e, key)) 
                            $(e).removeClass(className).val('');
                        return true;
                    });
                }(elem);
            else if (submit)
                new function(e) { $(e.form).submit(submit); }(elem);
        });
    };
})(jQuery);

jQuery (function($) {
	
	$('img').each(function() {
		$(this).removeAttr('width');
		$(this).removeAttr('height');
	});
				 
	$('a').each(function() {
		var url = $(this).attr('href');
		var extension = url.substr((url.lastIndexOf('.')+1));
		if (extension == 'flv') {		 
			var url = $(this).attr('href');
			var lib = $(this).text();
			$(this).after('<div class="player">'+
			'<object width="480" height="360" data="swf/player_flv.swf" type="application/x-shockwave-flash">'+
			'<param value="swf/player_flv.swf" name="movie" />'+
			'<param value="true" name="allowFullScreen" />'+
			'<param value="flv='+url+'&width=480&height=360&margin=1&bgcolor=008386&bgcolor1=008386&bgcolor2=008386&showstop=1&showvolume=1&showtime=2&showfullscreen=1&playercolor=FFFFFF&loadingcolor=e3004f&buttoncolor=008386&buttonovercolor=e3004f&slidercolor1=008386&slidercolor2=008386&sliderovercolor=e3004f&buffermessage=&buffercolor=&bufferbgcolor=&buffershowbg=0&showiconplay=1" name="flashVars" />'+
			'<p><a href="http://www.adobe.com/go/getflashplayer" rel="external"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>'+
			'</object><p>'+lib+'</p></div>');		
			$(this).remove();
		}
	});

	$('#search_word').placeholder();

	$('.text').find('br, img').each(function() { 
		$(this).remove();
	});

	$('.resum').equalHeights();
	$('.list-box').equalHeights();
});

// -----------------------------------------------------------------------------------
// Equal height //////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------------
(function($) {
	$.fn.equalHeights = function(minHeight, maxHeight) {
		$(this).css('height','');
		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);
		});
	}
})(jQuery);

