var ajax = new Array(); function rate_it(item_id, rating, which_one, image_path){ eval( "document.rating_form" + which_one + ".output_" + which_one + ".value = '' " ); var index = ajax.length; ajax[index] = new sack(); //ajax[index].requestFile = 'ajax_save_rating.cfm?item_id='+countryCode + '&rating=' + rating; // Specifying which file to get ajax[index].requestFile = 'http://www.blipwire.com/assets/ajax_save_rating.cfm?item_id=' + item_id + '&rating=' + rating + '&which_one=' + which_one; // Specify function that will be executed after file has been found ajax[index].onCompletion = function(){ eval( "document.rating_form" + which_one + ".output_" + which_one + ".value = 'saved' " ); lock_stars(rating, item_id, image_path ); }; ajax[index].runAJAX(); // Execute AJAX function } // JavaScript Document // this is for the "Rate This Item" box function swap_stars(which_star, image_path) { document.getElementById(which_star).src = image_path + "images/star.gif"; } function un_swap_stars(which_star, image_path) { if ( eval(which_star + '_clicked') == "no" ) { document.getElementById(which_star).src = image_path + "images/star-off.gif"; } } function lock_stars(rating, item_id, image_path ) { if ( rating == "1" ) { document.getElementById("star1_" + item_id).src = image_path + "images/star.gif"; document.getElementById("star2_" + item_id).src = image_path + "images/star-off.gif"; document.getElementById("star3_" + item_id).src = image_path + "images/star-off.gif"; document.getElementById("star4_" + item_id).src = image_path + "images/star-off.gif"; document.getElementById("star5_" + item_id).src = image_path + "images/star-off.gif"; eval( "star1_" + item_id + "_clicked = 'yes' "); eval( "star2_" + item_id + "_clicked = 'no' "); eval( "star3_" + item_id + "_clicked = 'no' "); eval( "star4_" + item_id + "_clicked = 'no' "); eval( "star5_" + item_id + "_clicked = 'no' "); }else if ( rating == "2" ) { document.getElementById("star1_" + item_id).src = image_path + "images/star.gif"; document.getElementById("star2_" + item_id).src = image_path + "images/star.gif"; document.getElementById("star3_" + item_id).src = image_path + "images/star-off.gif"; document.getElementById("star4_" + item_id).src = image_path + "images/star-off.gif"; document.getElementById("star5_" + item_id).src = image_path + "images/star-off.gif"; eval( "star1_" + item_id + "_clicked = 'yes' "); eval( "star2_" + item_id + "_clicked = 'yes' "); eval( "star3_" + item_id + "_clicked = 'no' "); eval( "star4_" + item_id + "_clicked = 'no' "); eval( "star5_" + item_id + "_clicked = 'no' "); }else if ( rating == "3" ) { document.getElementById("star1_" + item_id).src = image_path + "images/star.gif"; document.getElementById("star2_" + item_id).src = image_path + "images/star.gif"; document.getElementById("star3_" + item_id).src = image_path + "images/star.gif"; document.getElementById("star4_" + item_id).src = image_path + "images/star-off.gif"; document.getElementById("star5_" + item_id).src = image_path + "images/star-off.gif"; eval( "star1_" + item_id + "_clicked = 'yes' "); eval( "star2_" + item_id + "_clicked = 'yes' "); eval( "star3_" + item_id + "_clicked = 'yes' "); eval( "star4_" + item_id + "_clicked = 'no' "); eval( "star5_" + item_id + "_clicked = 'no' "); }else if ( rating == "4" ) { document.getElementById("star1_" + item_id).src = image_path + "images/star.gif"; document.getElementById("star2_" + item_id).src = image_path + "images/star.gif"; document.getElementById("star3_" + item_id).src = image_path + "images/star.gif"; document.getElementById("star4_" + item_id).src = image_path + "images/star.gif"; document.getElementById("star5_" + item_id).src = image_path + "images/star-off.gif"; eval( "star1_" + item_id + "_clicked = 'yes' "); eval( "star2_" + item_id + "_clicked = 'yes' "); eval( "star3_" + item_id + "_clicked = 'yes' "); eval( "star4_" + item_id + "_clicked = 'yes' "); eval( "star5_" + item_id + "_clicked = 'no' "); }else { document.getElementById("star1_" + item_id).src = image_path + "images/star.gif"; document.getElementById("star2_" + item_id).src = image_path + "images/star.gif"; document.getElementById("star3_" + item_id).src = image_path + "images/star.gif"; document.getElementById("star4_" + item_id).src = image_path + "images/star.gif"; document.getElementById("star5_" + item_id).src = image_path + "images/star.gif"; eval( "star1_" + item_id + "_clicked = 'yes' "); eval( "star2_" + item_id + "_clicked = 'yes' "); eval( "star3_" + item_id + "_clicked = 'yes' "); eval( "star4_" + item_id + "_clicked = 'yes' "); eval( "star5_" + item_id + "_clicked = 'yes' "); } }