var facts_toggle = false; function toggle_facts() { facts_toggle = !facts_toggle; $("#fanscore_faq").slideToggle(1000); $("#topten_new").slideToggle(500); $("#fanscore_faq_link").toggle(); $("#new_release_legend").toggle(); $("#as_of_date").toggle(); $("#weekly_topten_link").toggle(); $("#fanscore_faq_title").toggle(); $("#back_link").toggle(); } function hide_facts() { $("#fanscore_faq").stop().hide(); $("#fanscore_faq_title").hide(); $("#back_link").hide(); facts_toggle = false; } function show_rate_it() { if (facts_toggle) { hide_facts(); } $("#rate_it_form").height($("#topten_new").height()); if ($("#rate_it_form").is(':visible')) { $('#fanscore_topten_header_new').removeClass('rate_it_new'); $("#as_of_date").show(); $("#weekly_topten_link").show(); $("#fanscore_faq_link").show(); $("#new_release_legend").show(); $("#rate_it_form").hide(); $("#topten_new").show(); } else { $('#fanscore_topten_header_new').addClass('rate_it_new'); $("#as_of_date").hide(); $("#weekly_topten_link").hide(); $("#fanscore_faq_link").hide(); $("#new_release_legend").hide(); $("#rate_it_form").show(); $("#topten_new").hide(); } } function process_rating_form(form) { var rate = getCheckedValue(form.elements['rate']); var recommend = getCheckedValue(form.elements['recommend']); var mid = form.elements['mid'].value; if (rate == '' || recommend == '') { var errorCSS = {'color' : 'red'}; var defaultCSS = {'color' : '#000066'}; $("#error").show(); if (rate == '') { $("#rate_question").css(errorCSS); } else { $("#rate_question").css(defaultCSS); } if (recommend == '') { $("#recommend_question").css(errorCSS); } else { $("#recommend_question").css(defaultCSS); } return false; } doSubmit(rate, recommend, mid); } function doSubmit(rate, recommend, mid) { $("#submit_div").hide(); submit_rating_info(mid, rate, recommend); //return false; } function submit_rating_info(mid, rate, recommend) { var xhr = createAJAXobject(); var rating; if (!xhr) { return true; } var url = '/lib/rating_process.php'; var params = 'mid=' + mid + '&rate=' + rate + '&recommend=' + recommend; xhr.open('GET', url + '?' + params, true); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { if (xhr.status == 200 || xhr.status == 304) { rating = xhr.responseText; process_rating(rating); } } }; xhr.send(null); return false; } function process_rating (rating) { $("#your_rating").html(rating); $('#fanscore_topten_header_new').removeClass('unrated'); $('#fanscore_topten_header_new').addClass('rated'); show_rate_it(); } function process_rating_noshow (rating) { $("#your_rating").html(rating); $('#fanscore_topten_header_new').removeClass('unrated'); $('#fanscore_topten_header_new').addClass('rated'); } function submit_form_info(params) { var xhr = createAJAXobject(); var output = 'WHAT'; if (!xhr) { return true; } var url = '/lib/sendfriend_process.php'; xhr.open('POST', url, true); xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhr.setRequestHeader("Content-length", params.length); xhr.setRequestHeader("Connection", "close"); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { if (xhr.status == 200 || xhr.status == 304) { output = xhr.responseText; process_sendfriend_output(output); } } }; xhr.send(params); return false; } function process_sendfriend_output(output) { if (output == '') { tb_remove(); displayFlashMessage('Message Sent'); } else { output = '' + output + ''; $("#error").html(output); } } var loc_toggle = 0; function change_loc_toggle() { if (loc_toggle) { $("#change_location").html('change location'); $("#loc_change").animate({ height: '0px'}, 500, function () { $("#loc_change").toggle() }); loc_toggle = 0; } else { $("#loc_change").toggle(); $("#change_location").html('close'); $("#loc_change").animate({ height: '76px'}, 500); loc_toggle = 1; } } function process_loc(form) { var zip = form.elements['zip'].value; $("#loc").html(zip); change_loc_toggle(); check_availability(zip); var xhr = createAJAXobject(); var out; if (!xhr) { return true; } var url = '/lib/loc_process.php'; var params = 'zip=' + zip; xhr.open('GET', url + '?' + params, true); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { if (xhr.status == 200 || xhr.status == 304) { out = xhr.responseText; } } }; xhr.send(null); return false; } function process_login(form, mid, mtitle) { var email = form.elements['email'].value; var password = form.elements['password'].value; submit_login_info(email, password, mid, mtitle); } function submit_login_info(email, password, mid, mtitle) { var xhr = createAJAXobject(); var output = ''; if (!xhr) { return true; } var url = '/users/login.php'; var params = 'form_id=login&silent=1&getrating=' + mid + '&email=' + email + '&password=' + password; xhr.open('POST', url, true); xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhr.setRequestHeader("Content-length", params.length); xhr.setRequestHeader("Connection", "close"); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { if (xhr.status == 200 || xhr.status == 304) { output = xhr.responseText; process_login_output(output, mid, mtitle); } } }; xhr.send(params); return false; } function process_login_output(output, mid, mtitle) { var out_array = output.split('|'); if (out_array[0] == 'SUCCESS') { //tb_show(mtitle, '/movies/vote.php?height=264&width=548&reload=1&uid=' + mid); tb_remove(); if (out_array[1]) { process_rating_noshow (out_array[1]); } else { show_rate_it(); } $("#login_info").load('/_inc/header_login_info.php'); $("#nav_sign_me_up").hide(); } else { $("#error").html(output); } }