var xmlhttp; function sortitem(){ var li = jQuery('#tohyo li'), inverse = true; li.sort(function(a, b){ a = $(a).find("span").text(); b = $(b).find("span").text(); return (isNaN(a) || isNaN(b) ? a > b : +a > +b ) ? inverse ? -1 : 1 : inverse ? 1 : -1; }); /* アイテムコメントの表示*/ jQuery(function($) { $('#c04').find('.item').hover( function () { $(this).find('p').show(); }, function () { $(this).find('p').hide(); } ); }); } function onVote($no) { var cookiestr = document.cookie; //現在の日付データを取得 today = new Date(); //1日後の日付データを作成 today.setTime(today.getTime() + 24*60*60*1000); //GMT形式に変換して変数deldayに格納する delday = today.toGMTString(); if(cookiestr.indexOf('vote_flg=1')>0){ alert('投票はおひとり様1票までです。'); }else{ alert('ご投票ありがとうございます!'); getVote( $no ); document.cookie = 'vote_flg=1;expires='+ delday +';path=/'; } return false; } function onView() { getVote( -2 ); return false; } function onBack() { getVote( -1 ); return false; } function getVote( int ) { xmlhttp=GetXmlHttpObject(); if ( xmlhttp == null ) { alert ("Browser does not support HTTP Request"); return; } var url = "http://www.lupicia.co.jp/kokodeshika/poll.php"; url = url + "?vote=" + int url = url + "&sid=" + Math.random(); xmlhttp.onreadystatechange = stateChanged; xmlhttp.open( "GET", url, true ); xmlhttp.send( null ); } function stateChanged() { if ( xmlhttp.readyState == 4 ) { document.getElementById( "poll" ).innerHTML = xmlhttp.responseText; var max_idx = 284; for( var i = 1; i <= max_idx; i++ ) { var bar = $( '#poll_bar_' + i ); var w = bar.css( 'width' ); bar.css( 'width', 0 ); bar.show(); bar.animate({ width: w }, 1000 ); } } sortitem(); } function GetXmlHttpObject() { var objXMLHttp=null; if ( window.XMLHttpRequest ) { objXMLHttp = new XMLHttpRequest(); } else if ( window.ActiveXObject ) { objXMLHttp = new ActiveXObject( "Microsoft.XMLHTTP" ); } return objXMLHttp; } $(document).ready( function() { getVote( -1 ); });