<!--
////////////////////////クッキーによる投票制限をする///////////////////////////////
//URLを設定
var flg;
var win;

//windowを開く
function openWin(){
	win=window.open("","newgraf","width=456,height=572");
}

//投票の際の処理
function vote(){
	selectcheck();
	if (flg==0){
	    alert("投票する項目を選択してください！");
	}else{
			if (getCookie('path') == document.vote_form.action){
				alert("すでに投票されています。");
			}else{
				document.cookie='path=' + document.vote_form.action + ';expires=Fri, 31-Dec-2030 23:59:59; ';
				openWin();
				document.vote_form.submit();
				window.win.focus();
			}
	}
}

//指定クッキーの取得
function getCookie(key,  tmp1, tmp2, xx1, xx2, xx3) {
    tmp1 = " " + document.cookie + ";";
    xx1 = xx2 = 0;
    len = tmp1.length;
    while (xx1 < len) {
        xx2 = tmp1.indexOf(";", xx1);
        tmp2 = tmp1.substring(xx1 + 1, xx2);
        xx3 = tmp2.indexOf("=");
        if (tmp2.substring(0, xx3) == key) {
            return(unescape(tmp2.substring(xx3 + 1, xx2 - xx1 - 1)));
        }
        xx1 = xx2 + 1;
    }
    return("");
}

//投票せずに結果を見る
function viewgraf(){
	openWin();
	delcheck();
	document.vote_form.submit();
	window.win.focus();
}

//選択取り消し
function delcheck() {
    var i;
	flg=0;
    if (document.vote_form.selectvote.length) {
        for (i = 0; i < document.vote_form.selectvote.length; i++) {
            document.vote_form.selectvote[i].checked=false;
        }
    } else {
        document.vote_form.selectvote.checked=false;
    }
}

//選択されているかチェック
function selectcheck() {
    var i;
	flg=0;
    if (document.vote_form.selectvote.length) {
        for (i = 0; i < document.vote_form.selectvote.length; i++) {
            if (document.vote_form.selectvote[i].checked) {
                flg=1;
            }
        }
    } else {
        if (document.vote_form.selectvote.checked) {
            flg=1;
        }
    }
}
// -->