jQuery('#mail_tab_button').live('click',function() {
if(jQuery('#code_puzz_contact_form_inner').css('display')=='none'){
jQuery('#code_puzz_contact_form_inner').fadeIn();
}
else{
jQuery('#code_puzz_contact_form_inner').css({'display':'none'});
}

});

function submit_form(){
var int1= parseInt(jQuery('#label_1').html());
var int2= parseInt(jQuery('#label_4').html());
var answer= parseInt(jQuery('#contact_answer').val());

if(int1+int2==answer){


var email=jQuery('#cemail').val();
var name=jQuery('#cname').val();
var url=jQuery('#curl').val();
var message=jQuery('#ccomment').val();

jQuery.post(
    
    MyAjax.ajaxurl,
    {
        
        action : 'send_contact_form',
        email:email,
        name:name,
        url:url,
        message:message
        
    },
    function( response ) {
    var response_string='<h3 class="contact_form_response">';
    response_string+=response;
    response_string+='</h3>';
        
        jQuery('#code_puzzle_email_response').html(response_string);
        jQuery('#code_puzzle_email_response').fadeIn('slow', function() {
        
        jQuery('#code_puzzle_email_response').delay(3000).fadeOut('slow');
        jQuery('#code_puzz_contact_form_inner').delay(3000).fadeOut('slow', function() {
        	jQuery('#code_puzzle_email_response').html('');
        	jQuery('#cemail').val('');
			jQuery('#cname').val('');	
			jQuery('#curl').val('');
			jQuery('#ccomment').val('');
			jQuery('#contact_answer').css({'border':'1px dotted silver'});
jQuery('#answer_incorrect').html('');

jQuery('#contact_answer').val('');
      	});
        
        
        
        });
        
      
        
        
    }
);

}//end of sum check
else{
jQuery('#contact_answer').css({'border':'1px solid red'});
jQuery('#answer_incorrect').html('Invalid Answer');
}
}


jQuery('#code_puzzle_cancel_mail').live('click',function() {
jQuery('#code_puzz_contact_form_inner').css({'display':'none'});

});


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

$j('.view_film_list').live('click', function() {
var ID=$j(this).attr('id');
ID=ID.substring(15, ID.length);

if($j('#view_film_list_con_'+ID).css('display')=='none'){
$j('#view_film_list_con_'+ID).fadeIn();
}
else
{
$j('#view_film_list_con_'+ID).fadeOut();
}


});





$j('.v_f_by_venue').live('click', function() {

/*$j('.ven_films_list_con').fadeOut();
var ID=$j(this).attr('id');
var myID=$j(this).attr('id');

ID=ID.substring(13, ID.length);

$j.post(
    // see tip #1 for how we declare global javascript variables
    MyAjax.ajaxurl,
    {
        // here we declare the parameters to send along with the request
        // this means the following action hooks will be fired:
        // wp_ajax_nopriv_myajax-submit and wp_ajax_myajax-submit
        action : 'list_films_in_ven',
        ID:ID,
        // other parameters can be added along with "action"
        postID : MyAjax.postID
    },
    function( response ) {
  
      $j('#v_f_by_venue_con_'+ID).append(response); 
      
          
    }
    	
);
$j('#v_f_by_venue_con_'+ID).fadeIn();

*/


});

$j('.v_f_by_director').live('click', function() {

var ID=$j(this).attr('id');
var myID=$j(this).attr('id');

ID=ID.substring(13, ID.length);

$j.post(
    // see tip #1 for how we declare global javascript variables
    MyAjax.ajaxurl,
    {
        // here we declare the parameters to send along with the request
        // this means the following action hooks will be fired:
        // wp_ajax_nopriv_myajax-submit and wp_ajax_myajax-submit
        action : 'list_films_by_dir',
        ID:ID,
        // other parameters can be added along with "action"
        postID : MyAjax.postID
    },
    function( response ) {
    
      //$j('#v_f_by_venue_con_'+ID).html(response);     
    $j('#primary').append(response);
    
    }
);




});








$j('.gloss_programme_videos_link').live('click', function() {

var ID=$j(this).attr('id');
var baseurl=$j('#gloss_blog_url').val();

ID=ID.substring(27, ID.length);
var vid_elm='gloss_programme_video_con_'+ID;
var vid_url=$j('#gloss_programme_hidden_video_url_'+ID).val();
var image_url=$j('#gloss_programme_hidden_image_url_'+ID).val();
if(vid_url!='none'){

$j('#'+vid_elm).html('<a class="gloss_close_vid">X</a><div class="gloss_vid_con"><div id="gloss_flash_container_'+ID+'">Loading the player ...</div></div>'
+'<script type="text/javascript"> jwplayer("gloss_flash_container_'+ID+'").setup({'
+'flashplayer: "'+baseurl+'flash_player/player.swf", file: "'+vid_url+'", height: 395, width: 700,'
+"'controlbar': 'bottom'"
+'});'
+'</script>');
}

$j('#'+vid_elm).fadeIn('slow');
 

});

$j('.gloss_cust_nav').live('click', function() {
var ID=$j(this).attr('id');
var myID=$j(this).attr('id');
$j('#gloss_cust_nav_1').css({'color':'#555'});
    $j('#gloss_cust_nav_2').css({'color':'#555'});
    $j('#gloss_cust_nav_3').css({'color':'#555'});
    $j('#'+myID).css({'color':'red'});
ID=ID.substring(15, ID.length);
$j('#primary').fadeOut('fast');
$j.post(
    // see tip #1 for how we declare global javascript variables
    MyAjax.ajaxurl,
    {
        // here we declare the parameters to send along with the request
        // this means the following action hooks will be fired:
        // wp_ajax_nopriv_myajax-submit and wp_ajax_myajax-submit
        action : 'change_films_list',
        ID:ID,
        // other parameters can be added along with "action"
        postID : MyAjax.postID
    },
    function( response ) {
    $j('#primary').html('');
    
    
    
    $j('#primary').html(response);
    $j('#primary').fadeIn('fast');              
    }
);


});


$j('.gloss_close_vid').live('click', function() {
$j(this).parent().html('');

});
$j('#s').focus(function (){

$j(this).attr('value','');
});

$j('#s').blur(function (){

$j(this).attr('value','Search..');
});

$j('#gloss_event_slider_navigation_right').click(function(){


$j('.gloss_nav_slide_con').each(function(index) {

if($j(this).css('display')=='block'){
var ID=$j(this).attr('id');
ID=ID.substring(20, ID.length);

if(ID<$j('.gloss_nav_slide_con').length){
ID=parseInt(ID);
$j('#gloss_nav_slide_con_'+ID).fadeOut(function() {
    
  $j('#gloss_nav_slide_con_'+(ID+1)).fadeIn();
});
}
}

});


});


$j('#gloss_event_slider_navigation_left').click(function(){



$j('.gloss_nav_slide_con').each(function(index) {

if($j(this).css('display')=='block'){
var ID=$j(this).attr('id');
ID=ID.substring(20, ID.length);
if(ID>1){
ID=parseInt(ID);
$j('#gloss_nav_slide_con_'+ID).fadeOut(function() {
    
  $j('#gloss_nav_slide_con_'+(ID-1)).fadeIn();
});
}
}

});


});

});//end of document.ready
