jQuery(document).ready(function(){

//loadFile('main_video',{file:'http://php.arte.tv/dev/temp/inde.mp4',javascriptid:'main_video_player',click_link:'',autostart:'true',width:'672',height:'369',volume:'80',usefullscreen:'true'});	
//loadFile('main_video',{file:'rtmp://flashstreaming.www.arte.tv/ondemand/flash/permanent/u1/inde2009/etape_1.mp4',javascriptid:'main_video_player',click_link:'',autostart:'true',width:'672',height:'369',volume:'80',usefullscreen:'true'});	


//hide video player when rollover on video
//jQuery('#main_nav ul li').bind("mouseover","",hide_video);
//jQuery('#main_nav ul li').bind("mouseout","",show_video);

//ie7 : unbind all child DOM elements to avoid flickering
jQuery('#main_nav ul li *').unbind();

//hide video player when rollover on video
jQuery('img.acheter').mouseover(function() {
jQuery(this).attr({src : "img/habillage/bt_acheter_on.png"});
});

jQuery('img.acheter').mouseout(function() {
jQuery(this).attr({src : "img/habillage/bt_acheter.png"});
});

jQuery('img.louer').mouseover(function() {
jQuery(this).attr({src : "img/habillage/bt_louer_on.png"});
});

jQuery('img.louer').mouseout(function() {
jQuery(this).attr({src : "img/habillage/bt_louer.png"});
});


//rollover on some button
jQuery('img.toute_collection').mouseover(function() {
jQuery(this).attr({src : "img/habillage/bt_collection_over.png"});
});

jQuery('img.toute_collection').mouseout(function() {
jQuery(this).attr({src : "img/habillage/bt_collection.png"});
});

jQuery('img.toute_serie').mouseover(function() {
jQuery(this).attr({src : "img/habillage/bt_serie_over.png"});
});

jQuery('img.toute_serie').mouseout(function() {
jQuery(this).attr({src : "img/habillage/bt_serie.png"});
});


//note
jQuery('#noter .first_box img').mouseover(function() {
jQuery(this).attr({src : "img/habillage/big_star_on.png"});
});

jQuery('#noter .first_box img').mouseout(function() {
jQuery(this).attr({src : "img/habillage/big_star_off.png"});
});

jQuery("#emailMandatory").hide();
jQuery("#done").hide();
	
	
//select all the a tag with name equal to modal  
jQuery('a[name=modal]').click(function(e) {  

    //Cancel the link behavior  
    e.preventDefault();  
    //Get the A tag  
   var id = jQuery(this).attr('href');  
 
   //Get the screen height and width  
   var maskHeight = jQuery(document).height();  
   var maskWidth = jQuery(window).width();  
 
   //Set height and width to mask to fill up the whole screen  
   jQuery('#mask').css({'width':maskWidth,'height':maskHeight});  
     
   //transition effect       
   jQuery('#mask').fadeIn(1000);      
   jQuery('#mask').fadeTo("slow",0.8);    
 
   //Get the window height and width  
   var winH = jQuery(window).height();  
   var winW = jQuery(window).width();  
           
   //Set the popup window to center  
   jQuery(id).css('top',  winH/2-jQuery(id).height()/2);  
   jQuery(id).css('left', winW/2-jQuery(id).width()/2);  
 
   //transition effect  
   jQuery(id).fadeIn(2000);  
   
   //write the url of the current webpage at the end of the text
   jQuery('#msg').empty();
   jQuery('#msg').append(jQuery('#messageDebut').attr("value"));
   jQuery('#msg').append(document.location.href);
   
   //show the form to send the email and not the "done" message
   jQuery('#done').hide();
   jQuery('#formDiv').show();
});  
 
//if close button is clicked  
jQuery('.window .close').click(function (e) {  
   //Cancel the link behavior  
   e.preventDefault();  
   jQuery('#mask, .window').hide();  
   
});       
 
//if mask is clicked  
jQuery('#mask').click(function () {  
   jQuery(this).hide();  
   jQuery('.window').hide();  
});

//if submit button is clicked  
jQuery('#submit').click(function () {          
 
 if (!validateSendFriend())
 	return false;
 
 //Get the data from all the fields  
 var firstName = jQuery('input[name=firstName]');
 var lastName = jQuery('input[name=lastName]'); 
 var email = jQuery('input[name=email]');  
 //var message = jQuery('input[name=message]');  
 var curText= jQuery("#msg").val(); 
 
 //organize the data properly  
 var data = 'firstName=' + encodeURIComponent(firstName.val()) + '&email=' + encodeURIComponent(email.val()) + '&lastName='  
 + lastName.val() + '&message='  + encodeURIComponent(curText);    
 
 //show the loading sign  
 jQuery('.loading').show();  
   
 //start the ajax  
 jQuery.ajax({  
     //this is the php file that processes the data and send mail  
     url: "SendFriend.html",   
       
     //GET method is used  
     type: "GET",  

     //pass the data           
     data: data,       
       
     //Do not cache the page  
     cache: false,  
       
     //success  
     success: function (html) {                
         //if process.php returned 1/true (send mail success)  
         
         //hide the form  
         jQuery('#formDiv').fadeOut('slow');                   
         
         jQuery("#emailMandatory").hide();
               
         //show the success message  
         jQuery('#done').fadeIn('slow');  
     }         
 });  
   
 //cancel the submit button default behaviours  
 return false;  
});  


});
