window.onload = function () {
	// Fix PNG for Ie 6
	if ( (/MSIE 6\.0/).test(navigator.userAgent) && !(/MSIE 7\.0/).test(navigator.userAgent) && !(/MSIE 8\.0/).test(navigator.userAgent) ) {	
		DD_belatedPNG.fix(".fixPng");
	}
};



/**** Fix bug Thomas VAN HORDE DFO - 07/09/10  ***/
jQuery(document).ready(function() {
    jQuery('.roundedImg2').each(function (index, domEle) {
        elem = jQuery(domEle);
		big_conteneur = elem.parents('.bd');
		conteneur_txt = big_conteneur.find('.unit.lastUnit.txtBlueD');
		conteneur_txt_height = conteneur_txt.height();
        img = elem.find('img');

		img_height = img.height();
		img_width = img.width();
        elem.height(img_height);
        elem.width(img_width);
		
		if(conteneur_txt_height < img_height)
			conteneur_txt_new_height = parseInt(img_height) + 5;
		else
			conteneur_txt_new_height = parseInt(conteneur_txt_height) + 5;
		
		/*Pkoi faire ??? : corrige le jira 1319 sous IE7 ???
		conteneur_txt.height(conteneur_txt_new_height);	
		big_conteneur.height(conteneur_txt_new_height);	
		//alert('test3');
		*/
		
		
		// BUG SI PAS D'IMAGE
		test = big_conteneur.parent().parents('.inner');
		if(test.length > 0) {
			big_conteneur.parent().height(parseInt(conteneur_txt_new_height) + 50);
			big_conteneur.parent().find('.hd').height(33);
			
			// Fix IE7 ONLY - Arrondie qui descend trop bas.
			if( !(/MSIE 6\.0/).test(navigator.userAgent) && (/MSIE 7\.0/).test(navigator.userAgent) && !(/MSIE 8\.0/).test(navigator.userAgent) ) 
				elem.find('.bottom').height(elem.find('.bottom b').height()).css('margin-top', '-2px');
				
		}
			
    })
})




$(document).ready(function(){
	//File Browse
	if($(".FileBrowse").length > 0) {
		new FileBrowseUIGroup("FileBrowse", {
			browseButtonPos: "right", 						//left/right: default = right + 
															//top/bottom: default = bottom
															//top/bottom: relative to the textbox
			browseButtonClassName: "BrowseBtnStyle",		//use for Styling,
															//default = "DefaultBrowseBtn"
			browseTextBoxClassName: "BrowseTextBoxStyle",	//use for Styling,
															//default = "DefaultBrowseBtn"
			browseButtonText: "> "+f6_main_fileBrowse_parcourir,						//use for Styling,
															//default = "Browse"
			browseTextBoxValue: ""
		});
		$(".BrowseTextBoxStyle").attr("readonly", true);
	}
	
	$("input[type='submit']").bind("mouseover", function (){
		$(this).addClass('hover')
	});
	$("input[type='submit']").bind("mouseout", function (){
		$(this).removeClass('hover')
	});
	
	
	// Cufon (Special Fonts)
	Cufon.replace(".fontExtra", { fontFamily: 'CenturyGothic' });
	Cufon.replace(".fontExtraBold", { fontFamily: 'CenturyGothicBold' });
	
	// Navigation
	$(".nav > ol > li").each(function() {
		var li = $(this);
		li.bind("mouseover",function(evt) {
			$(".nav > ol > li").removeClass("acitveNav");
			$(this).addClass("acitveNav");
			evt.stopPropagation();
		});
		$(document).bind("mouseover",function() {
			li.removeClass("acitveNav");
		});
	});
	
	// Create tabs
	if($(".applyTabBox").length > 0) {
		$(".applyTabBox").tabs({
			show: function (){
				console.log(arguments);
			}
		});
	}
	
	$( ".applyTabBox" ).bind( "tabsshow", function(event, ui) {
			var id  = ui.tab.href.split("#")[1];
			var as = $(".modTool a");
			addTabToLink(as.eq(1), id)
			addTabToLink(as.eq(2), id)
	});
	
	function addTabToLink(a, id){
		var href = a.attr("href");
		if(/\?/.test(href)){
			a.attr("href", href.replace(/&?tab=.*&?/, "") + "&tab=" + id)
		}
		else {
			a.attr("href", href + "?tab=" + id)
		}
	//	a.attr("href", href.replace(/\?&/, "?"))
	}
	
	// Lightbox
	if($(".OpenPopup1").length > 0) {
		$(".OpenPopup1").bind("click", function () {
			var href = jQuery(this).attr("href");
			
			$lightbox.openPopup({
                href: href,
                closeBtnText: f6_main_fileBrowse_close,
                themeClass: "OpenPopup1Theme",
                id: 'sliderPopup'
            });		
			
			 return false;
		});											 
	}
	
	//Create Special ComboBox
	$(".SelectUI").addSelectUI({
		//before_action: callback,
		scrollbarWidth: 12, //default is 10
		maxDropListHeight : 200,
		after_action: function(){
			
			if($selectDroplist_Manager.activeName != null){
				
				$("select[name='"+$selectDroplist_Manager.activeName+"']").trigger("change");
				$("select[name='"+$selectDroplist_Manager.activeName+"']").trigger("focusout");
			}else{
				
				$("select[name='"+$selectDroplist_Manager.oldActiveName+"']").trigger("change");
				$("select[name='"+$selectDroplist_Manager.oldActiveName+"']").trigger("focusout");
			}
		}
	});
	
	$(".textarea1").focus(function() {
		if($(this).val() == f6_main_textarea) {
			$(this).val("");
		}
	});
	$(".textarea1").blur(function() {
		if($(this).val() == "") {
			$(this).val(f6_main_textarea);
		}
	});
	
	if($(".CheckBoxUI").length > 0) {
		$(".CheckBoxUI").addCheckBoxUI();
	}
	if($(".CheckBoxExtraUI").length > 0) {
		$(".CheckBoxExtraUI").addCheckBoxExtraUI();
	}
	if($(".CheckUI").length > 0) {
		$(".CheckUI").addCheckBoxUI();
	}
	

});

function showHide(obj) {
	//var thisObj = $("#"+obj);
	if($("."+obj).hasClass("blk")) {
		$("."+obj).removeClass("blk");
	} else {
		$("."+obj).addClass("blk");
	}
}

//omniture tracking pour video popin
function videoClick(videoName) {
	if( typeof(chemin) != 'undefined') { // On ne track pas quand on est connecté Admin (pb var undefined)
		var s=s_gi(s_account); 
		s.trackingServer='sc.disneylandparis-business.com';
		s.trackingServerSecure='ssc.disneylandparis-business.com';
		s.linkTrackVars='prop1'; 
		s.prop1=chemin +':'+ videoName; 
		s.tl(this,'o','Video'); 
	}
}

