function process_form(form) { var rate = getCheckedValue(form.elements['rate']); var recommend = getCheckedValue(form.elements['recommend']); var mid = form.elements['mid'].value; var reload_page = form.elements['reload'].value; if (rate == '' || recommend == '') { var errorCSS = {'color' : 'red', 'font-weight' : 'bold'}; var defaultCSS = {'color' : 'black', 'font-weight' : 'normal'}; $("#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, reload_page); } function doSubmit(rate, recommend, mid, reload_page) { tb_remove(); submit_rating_info(mid, rate, recommend, reload_page); //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&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) { if (output == 'SUCCESS') { tb_show(mtitle, '/movies/vote.php?height=264&width=548&reload=1&uid=' + mid); } else { $("#error").html(output); } } var rating_array = new Array(); rating_array[1] = 'Poor'; rating_array[2] = 'Fair'; rating_array[3] = 'Good'; rating_array[4] = 'Very Good'; rating_array[5] = 'Excellent'; function submit_rating_info(mid, rate, recommend, reload_page) { var xhr = createAJAXobject(); var rating; process_rating(mid, rating_array[rate]); 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; if (reload_page) { window.location.reload(); } else { //process_rating(mid, rating); } } } }; xhr.send(null); return false; } function close_and_reload () { tb_remove(); window.location.reload(); } var current_subnav = ''; function subnav_toggle(id) { var link_id = "#" + id; var current_id = "#" + current_subnav; $(link_id).animate({opacity: 'show', height: 'show'}, 'slow'); if (current_subnav != '') { $(current_id).animate({opacity: 'hide', height: 'hide'}, 'slow'); } if (current_subnav == id) { toggle_subnav_class(id); current_subnav = ''; } else { toggle_subnav_class(id); if (current_subnav != '') { toggle_subnav_class(current_subnav); } current_subnav = id; } } function toggle_subnav_class(id) { var link_id = document.getElementById("fanscore_nav_link_" + id); if (link_id.className == 'selected') { link_id.className = ''; } else { link_id.className = 'selected'; } } function HideContent(d) { if(d.length < 1) { return; } document.getElementById(d).style.display = "none"; } function ShowContent(d) { if(d.length < 1) { return; } document.getElementById(d).style.display = "block"; } function ReverseContentDisplay(d) { if(d.length < 1) { return; } if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; } else { document.getElementById(d).style.display = "none"; } }