var delete_id = 0; var report_id = 0; function register_popup() { var status = FB.Connect.get_status(); if( status.result == 1 ) { $('#popup_div').dialog( 'open' ); } else { FB.Connect.requireSession(); } } function tandc_popup() { $('#tandc_popup').dialog( 'open' ); } function form_submit() { var status = FB.Connect.get_status(); if( status.result != 1 ) { return FB.Connect.requireSession(); } var fname = document.getElementById( 'fname' ).value; if ( !fname ) { document.getElementById( 'fname_error' ).style.display = ''; } else { document.getElementById( 'fname_error' ).style.display = 'none'; } var lname = document.getElementById( 'lname' ).value; if ( !lname ) { document.getElementById( 'lname_error' ).style.display = ''; } else { document.getElementById( 'lname_error' ).style.display = 'none'; } var email = document.getElementById( 'email' ).value; if ( !email ) { document.getElementById( 'email_error' ).style.display = ''; } else { document.getElementById( 'email_error' ).style.display = 'none'; } var agree = document.getElementById( 'agree_box' ).checked; var country = document.getElementById( 'country' ).value; /* if ( !agree ) { document.getElementById( 'agree_error' ).style.display = ''; } else { document.getElementById( 'agree_error' ).style.display = 'none'; } */ var day = document.getElementById( 'day' ).value; var month = document.getElementById( 'month' ).value; var year = document.getElementById( 'year' ).value; var currentTime = new Date(); var currentYear = currentTime.getFullYear(); if ( year > ( parseInt( currentYear ) - 18 ) ) { document.getElementById( 'dob_error' ).style.display = ''; } else { document.getElementById( 'dob_error' ).style.display = 'none'; } if ( fname && lname && email && year <= ( parseInt( currentYear ) - 18 ) ) { var params = 'act=register&fname=' + fname + '&lname=' + lname + '&email=' + email + '&agree=' + agree + '&day=' + day + '&month=' + month + '&year' + year + '&country=' + country; $.ajax( { type: "POST", data: params, url: 'connect/?lang=' + lang, dataType: "html", success: function(msg) { $('#popup_div').dialog( 'close' ); $('#popup_div_success').dialog( 'open' ); }, error: function(msg) { alert( msg ); } } ); return true; } else { return false; } } function change_language( lang ) { $( '#entire_page' ).load( 'connect/?lang=' + lang, { 'act': 'language', 'lang': lang } ); } function check_comment_form() { var comment_text = document.getElementById( 'comment_text' ).value; var video = document.getElementById( 'video' ).value; if ( comment_text.length == 0 ) { $( '#ajax_buffer' ).load( 'connect/?lang=' + lang, { 'act': 'dialog', 'title': GENERAL_ERROR, 'text' : MESSAGE_EMPTY } ); return false; } else if ( comment_text.length >= 200 ) { $( '#ajax_buffer' ).load( 'connect/?lang=' + lang, { 'act': 'dialog', 'title': GENERAL_ERROR, 'text' : MESSAGE_LONG } ); return false; } else { document.getElementById( 'loading_bar' ).style.display = ''; $( '#actual_comments' ).load( 'connect/?lang=' + lang, { 'act': 'comment', 'video': video, 'comment' : comment_text, 'user_id': FB.Facebook.apiClient.get_session().uid }, function() { document.getElementById( 'loading_bar' ).style.display = 'none'; document.getElementById( 'comment_text' ).value = ''; } ); } return true; } function wall_pagination( video, start ) { document.getElementById( 'loading_bar_p' ).style.display = ''; $( '#actual_comments' ).load( 'connect/?lang=' + lang, { 'act': 'wall-pagination', 'video': video, 'start': start }, function() { document.getElementById( 'loading_bar_p' ).style.display = 'none'; } ); } function load_video( video ) { $( '#flash_video' ).load( 'connect/?lang=' + lang, { 'act': 'load-video', 'video': video } ); } function load_related_video( video ) { document.getElementById( 'loading_bar' ).style.display = ''; $( '#video_area' ).load( 'connect/?lang=' + lang, { 'act': 'load-related-video', 'video': video }, function() { document.getElementById( 'loading_bar' ).style.display = 'none'; } ); } function rate_video( video, rating ) { document.getElementById( 'rate_load' ).style.display = ''; $( '#rating_ajax_area' ).load( 'connect/?lang=' + lang, { 'act': 'rate', 'video': video, 'rating': rating, 'user_id': FB.Facebook.apiClient.get_session().uid }, function() { document.getElementById( 'rate_load' ).style.display = 'none'; } ); } function delete_msg( id ) { delete_id = id; $( '#delete_popup' ).dialog( 'open' ); } function report_msg( id ) { report_id = id; $( '#report_popup' ).dialog( 'open' ); }