$(document).ready(function() {

		//SHADOWBOX	
	 	Shadowbox.init({
					   
	flashVars: {
    backcolor: '0xC0C0C0',
	frontcolor:'00000000',
	lightcolor:'000',
	logo: 'webimages/logoTV.png'
	},

     	players:  ['img', 'html', 'iframe', 'qt', 'wmp', 'swf', 'flv']
		
				
				});						  
		
		//liens externes
		$('a[rel=externe]').attr('target','_blank');

		////////////////////////////
		//Ouverture dans une nouvelle fenêtre de tous les liens externes
		$('a').click(function() {
		var href = $(this).attr('href');
		if (href.indexOf('http://') != -1 || href.indexOf('https://') != -1) {
			var host = href.substr(href.indexOf(':')+3);
			if (host.indexOf('/') != -1) {
				host = host.substring(0, host.indexOf('/'));
			}
			if (host != window.location.host) {
				window.open(href);
				return false;
			}
		}
		});
		//////////////////////////// 
		//Customisation formulaires
		$('input[type="text"],textarea').addClass("idleField");
		  $('input[type="text"],textarea').focus(function() {
			  $(this).removeClass("idleField").addClass("focusField");
			  if (this.value == this.defaultValue){ 
				  this.value = '';
			  }
			  if(this.value != this.defaultValue){
				  this.select();
			  }
		  });
		  $('input[type="text"],textarea').blur(function() {
			  $(this).removeClass("focusField").addClass("idleField");
			  if ($.trim(this.value) == ''){
				  this.value = (this.defaultValue ? this.defaultValue : '');
			  }
		  });
		  
		 ///VISUELS VIDEOS 
		  $('span.video').hover(function() {
			var fade = $('> span', this);
			if (fade.is(':animated')) {
			  fade.stop().fadeTo(700, 1);
			} else {
			  fade.fadeIn(700);
			}
		  }, function () {
			var fade = $('> span', this);
			if (fade.is(':animated')) {
			  fade.stop().fadeTo(700, 0);
			} else {
			  fade.fadeOut(700);
			}
		  });
		
});


////////////////////////////
//Defilement partenaires////
////////////////////////////
function clip() {
	var contWidth = 145;
 	var contHeight = 370;
 	var id1 = document.getElementById('slideA');
 	var id2 = document.getElementById('slideB');
 	var height = id1.offsetHeight;
 	id1.style.top = parseInt(id1.style.top)-1 + 'px';//vitesse
 	document.getElementById('slideCont').style.height = contHeight + "px";
 	document.getElementById('slideCont').style.clip = 'rect(auto,'+ contWidth +'px,' + contHeight +'px,auto)';
 	id2.style.display = '';
 	if(parseFloat(id1.style.top) == -(height/2)) {
  		id1.style.top = '0px';
 	}
 	setTimeout(clip,50)
}
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}
addLoadEvent(function() {
  clip();
});
