function uncache( url ){ var d = new Date(); var time = d.getTime(); return url + "&uncache=" + time; } function create_http_request(){ var http = false; //Use IE's ActiveX items to load the file. if(typeof ActiveXObject != 'undefined') { try {http = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) { try {http = new ActiveXObject("Microsoft.XMLHTTP");} catch (E) {http = false;} } //If ActiveX is not available, use the XMLHttpRequest of Firefox/Mozilla etc. to load the document. } else if (XMLHttpRequest) { try {http = new XMLHttpRequest();} catch (e) {http = false;} } return http; } //forum_vote var forum_vote_http_request = create_http_request(); var global_topic_id; function forum_vote( action, topic_id ) { var ajax_url_base = "/ajax_forum_vote.php"; var ajax_url_value = "topic_id=" + topic_id + "&action=" + action; var url = ajax_url_base + "?" + ajax_url_value; global_topic_id = topic_id; ajax_forum_vote_GET( uncache( url ) ); } function ajax_forum_vote_GET( url ){ forum_vote_http_request.open( 'GET', url, true ); forum_vote_http_request.onreadystatechange = ajax_forum_vote_GET_onreadystatechange; forum_vote_http_request.send( null ); } function ajax_forum_vote_GET_onreadystatechange(){ if( forum_vote_http_request.readyState == 4 ){ document.getElementById( "forum_vote_box_" + global_topic_id ).innerHTML = forum_vote_http_request.responseText; } } //vote_up var vote_up_http_request = create_http_request(); function vote_up( i ){ var sum_cnt = parseInt( document.getElementById( "sum_cnt_" + i ).getAttribute("sum_cnt") ); var now_cnt = parseInt( document.getElementById( "sum_cnt_" + i ).innerHTML ); if( sum_cnt >= now_cnt ){ sum_cnt = sum_cnt + 1; document.getElementById( "sum_cnt_" + i ).innerHTML = sum_cnt; document.getElementById( "sum_cnt_" + i ).style.color='#ff8c61'; document.getElementById( "vote_up_" + i ).style.backgroundPosition='-63px -630px'; document.getElementById( "vote_down_" + i ).style.backgroundPosition='-101px -613px'; } else { document.getElementById( "sum_cnt_" + i ).innerHTML = sum_cnt; document.getElementById( "sum_cnt_" + i ).style.color='black'; document.getElementById( "vote_up_" + i ).style.backgroundPosition='-47px -630px'; } var ajax_url_base = "/ajax_vote_up.php"; var ajax_url_value = "i=" + i; var url = ajax_url_base + "?" + ajax_url_value; ajax_vote_up_GET( uncache( url ) ); } function ajax_vote_up_GET( url ){ vote_up_http_request.open( 'GET', url, true ); vote_up_http_request.onreadystatechange = ajax_vote_up_GET_onreadystatechange; vote_up_http_request.send( null ); } function ajax_vote_up_GET_onreadystatechange(){ if( vote_up_http_request.readyState == 4 ){ } } //vote_down var vote_down_http_request = create_http_request(); function vote_down( i ){ var sum_cnt = parseInt( document.getElementById( "sum_cnt_" + i ).getAttribute("sum_cnt") ); var now_cnt = parseInt( document.getElementById( "sum_cnt_" + i ).innerHTML ); if( sum_cnt <= now_cnt ){ sum_cnt = sum_cnt - 1; document.getElementById( "sum_cnt_" + i ).innerHTML = sum_cnt; document.getElementById( "sum_cnt_" + i ).style.color='#9494ff'; document.getElementById( "vote_down_" + i ).style.backgroundPosition='-31px -630px'; document.getElementById( "vote_up_" + i ).style.backgroundPosition='-47px -630px'; } else { document.getElementById( "sum_cnt_" + i ).innerHTML = sum_cnt; document.getElementById( "sum_cnt_" + i ).style.color='black'; document.getElementById( "vote_down_" + i ).style.backgroundPosition='-101px -613px'; } var ajax_url_base = "/ajax_vote_down.php"; var ajax_url_value = "i=" + i; var url = ajax_url_base + "?" + ajax_url_value; ajax_vote_down_GET( uncache( url ) ); } function ajax_vote_down_GET( url ){ vote_down_http_request.open( 'GET', url, true ); vote_down_http_request.onreadystatechange = ajax_vote_down_GET_onreadystatechange; vote_down_http_request.send( null ); } function ajax_vote_down_GET_onreadystatechange(){ if( vote_down_http_request.readyState == 4 ){ } } //set_fav var set_fav_http_request = create_http_request(); function set_fav( i ){ var set_fav = document.getElementsByClassName( "set_fav_" + i ); var set_fav_value = parseInt( set_fav[0].getAttribute( "set_fav" ) ); for( var x=0; x