

function resizeFlashTitle(who,h)
{
	//alert(who+" : "+h);
	var obj = $(who);
	//alert(obj+":"+h);
	$('#'+who+' object').attr('height',h);
}
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}
/*
jQuery.fn.outerHTML = function() {
  return $( $('<p></p>').html(this.clone()) ).html();

} 
*/
(function($) {
 // Returns whether or not a result set has results in it
 $.fn.outerHTML = function() {
   return $('<p>').append( this.eq(0).clone() ).html();
 };
})(jQuery);

$(document).ready(function() {
   
   
   
   //return;
   var num = 0;
   
	
	$("p.H2Title, p.H3Title,p.H4Title, p.H5Title").each(function(){
		
		var classes = $(this).attr("class");
		$(this).removeClass();
		
		var poil = $(this);
		var str = innerXHTML(this);
		
		$(this).addClass(classes);			
		var out = '<span class="'+classes+'">'+str+'</span>';	
		$(this).attr("id", 'tinyTitle'+num);

		num++;
		
		out = ltrim(rtrim(out));
		out = out.replace(new RegExp("(<br></br>)", "g"), "\n");
		//out = out.replace(new RegExp("(&euro;)", "g"), "zag");
		//out = out.replace(new RegExp("(€)", "g"), "zag");
		//alert(out);
		$(this).flash({  
			// test_flashvars.swf is the flash document  			
			swf: 'swf/flashTitle.swf',
			width:'100%',
			menu:false,
			wmode:'transparent',
			height:3,
			// these arguments will be passed into the flash document   
			flashvars: {  
				id: $(this).attr('id'),  
				bodytext: escape(out),
				css : FlashCSS
				
			}  
		}); 
		
		$(this).css('margin-left','-3px');
		
	});
   
   
   num = 0;
   
   $(".flashTitle").each(function(){		
		//var str = $(this).outerHTML();
		var allClasses = $(this).attr("class");
		$(this).removeClass('flashTitle');
		var classes = $(this).attr("class");
		$(this).removeClass();
		
		//var str = $(this).html();	
		var poil = $(this);
		var str = innerXHTML(this);
		
		$(this).addClass(allClasses);			
		var tag = this.tagName; 
		
		var out = '<'+tag+'><span class="'+classes+'">'+str+'</span></'+tag+'>';
		
		$(this).attr("id", 'flashTitle'+num);

		num++;
		str = ltrim(rtrim(out));
		//alert(str);
		$(this).flash({  
			// test_flashvars.swf is the flash document  			
			swf: 'swf/flashTitle.swf',
			width:'100%',
			menu:false,
			wmode:'transparent',
			height:3,
			// these arguments will be passed into the flash document   
			flashvars: {  
				id: $(this).attr('id'),  
				bodytext: escape(str),
				css : FlashCSS
				
			}  
		}); 
		
		$(this).css('margin-left','-3px');
		
	});
   
   $("input,textarea").focus(function () {
         $(this).addClass("focus");
    });
   
   $("input,textarea").blur(function () {
         $(this).removeClass("focus");
    });
   
   
   $(".info_quality").hover(
      function () {
        $(this).append($("<span class='infoBulle'>"+$("#info_quality").html()+"</span>"));
      }, 
      function () {
        $(this).find("span:last").remove();
      }
    );
   
   $(".info_type").hover(
      function () {
        $(this).append($("<span class='infoBulle'>"+$("#info_type").html()+"</span>"));
      }, 
      function () {
        $(this).find("span:last").remove();
      }
    );

  
   
   
		
 });
