var $j=  jQuery.noConflict();
$j(document).ready(function(){

	/* Alignement Image Map */
	$j("h6").each(function(){
		if($j(this).next("img[usemap]").size()>0){
			$j(this).parent("div").addClass($j(this).attr("class"));
		}
	});

	$j("div#content img").each(function(){
		if($j("input.submitbutton").val() != undefined){
			if(!$j(this).hasClass("tx-srfreecap-pi2-image")){
				$j(this).addClass("rounded");
			}
		}else if($j("input").hasClass("tx-indexedsearch-searchbox-button")){
			if(!$j(this).parent("span.tx-indexedsearch-icon")){
				$j(this).addClass("rounded");
			}
		}else{
				$j(this).addClass("rounded");
		}
	});
	
	/*****  Tooltip ***/
		if($j('.wrapper').size()>0){
			$j(".wrapper a.lien2").each(function(){
				$j(this).attr("onclick","targetToTup(this);");
			});
			
			$j('area').qtip({
				content: "",
				show: 'mouseover',
				hide: { when: 'inactive', delay: 1500 },
				style: { 
					border: {
						width: 3,
						radius: 8,
						color: '#6699CC'
					},
					width: 250,
					tip: 'bottomRight'
				},
				position: {
					corner: {
						target: 'topRight',
						tooltip: 'bottomRight'
					}
				}
			});
		}
	/*****  Fin Tooltip ***/
		
		
		
	var j = 0;
	$j(".wrapper area").each(function(j){
		$j(this).attr("rel",j)
	});
	
	$j('.wrapper area').click(function(){
		return false;
	});
	
	$j("div#bckContainerCenter img").each(function(){	
		if($j(this).parent().parent("div.linkArchive").html()==null && !$j(this).parent("div.imageNewsList")){
			$j(this).addClass("rounded");
		}
	});
	

	$j("div#contentAltr img").each(function(){
			$j(this).addClass("rounded");
		});


	$j("span.vide").each(function(){
		$j(this).parent().remove();
	});

		
	/*$j("img.rounded").load( function () {
		var img = $j(this);
		
		// build wrapper
		var wrapper = $j('<div class="rounded_wrapper"></div>');
		wrapper.width(img.width());
		wrapper.height(img.height());
		
		// move CSS properties from img to wrapper
		wrapper.css('float', img.css('float'));
		img.css('float', 'none')
		
		wrapper.css('margin-right', img.css('margin-right'));
		img.css('margin-right', '0')

		wrapper.css('margin-left', img.css('margin-left'));
		img.css('margin-left', '0')

		wrapper.css('margin-bottom', img.css('margin-bottom'));
		img.css('margin-bottom', '0')

		wrapper.css('margin-top', img.css('margin-top'));
		img.css('margin-top', '0')

		wrapper.css('display', 'block');
		img.css('display', 'block')

		// wrap image
		img.wrap(wrapper);
		
		// add rounded corners
		img.after('<div class="tl"></div>');
		img.after('<div class="tr"></div>');
		img.after('<div class="bl"></div>');
		img.after('<div class="br"></div>');
	});
	*/
	
	$j("#nav li.menuparentFirstElement,#nav li.menuparent,#nav li.menuparentLast,#nav li.menuparent_act,#nav li.menuparent_actLast").hover(
		function(){
			$j(this).addClass("menuHover");
			$j(this).find("ul").css("left","auto");
		},
		function(){
			$j(this).removeClass("menuHover");
			$j(this).find("ul").css("left","-999px");
		}
	);
			
			
	$j('.flexme1').flexigrid({height: "auto"
	// 									 colModel : [ {width : 40, sortable : true, align: 'center'},
	// 									 ]
	// 			$('.flexme1').dataTable({
	// 			  "aoColumns": [
	// 							  /* Browser */  null,
	// 							  /* Browser */  null,
	// 									/* Platform */ null,
	// 									/* Version */  { "bVisible": true },
	// 									/* Grade */    { "sClass": "center" }
	// 									],
	// 			 "bLengthChange": false
 	} );
	
});

function targetToTup(link){
	parent.document.location.href = link.href;
}

/*function maparea(){	var map = "<area href=\"index.php\" coords=\"154,179,239,250\" alt=\"St Leonard\" title=\"St Leonard\" shape=\"rect\"><area href=\"#\" coords=\"12,100,108,166\" alt=\"La Chassotte\" title=\"La Chassotte\" shape=\"rect\"><area href=\"#\" coords=\"57,183,146,250\" alt=\"Le Guintzet\" title=\"Le Guintzet\" shape=\"rect\"><area href=\"#\" coords=\"187,108,284,176\" alt=\"Heitera\" title=\"Heitera\" shape=\"rect\"><area href=\"#\" coords=\"155,31,232,86\" alt=\"Corbaroche\" title=\"Corbaroche\" shape=\"rect\"><area href=\"#\" coords=\"70,26,142,96\" alt=\"La Grange\" title=\"La Grange\" shape=\"rect\"><area href=\"#\" coords=\"70,26,142,96\" alt=\"Rose\" title=\"Rose\" shape=\"rect\">";	$j("map#mobilite").prepend(map);	alert(map)}*/
