////
// XMLHttpRequestオブジェクト生成
//
// @sample        oj = createHttpRequest()
// @return        XMLHttpRequestオブジェクト(インスタンス)
//
function createHttpRequest()
{
    if(window.XMLHttpRequest){
         //Win Mac Linux m1,f1,o8 Mac s1 Linux k3 & Win e7用
        return new XMLHttpRequest() ;
    } else if(window.ActiveXObject){
         //Win e4,e5,e6用
        try {
            return new ActiveXObject('Msxml2.XMLHTTP') ;
        } catch (e) {
            try {
                return new ActiveXObject('Microsoft.XMLHTTP') ;
            } catch (e2) {
                return null ;
            }
        }
    } else  {
        return null ;
    }
}

////
// リファラ削除
// http://programming-magic.com/?id=143
//
function setNoReferer(a){
    var url = a.href;
    var IE = /*@cc_on!@*/false;
    if(IE){ //IE専用
        a.href = 'javascript: (function(){location.href = "'+url+'";})();';
        //フレーム内のページは新しいウィンドウで開かないとリファラが消えないようなので強制的に新しいウィンドウで開く
        if(window.parent != window.self) {
            a.target = '_blank';
        }
        a.setAttribute("onclick", new Function("return confirm('リファラを削除して移動します。');"));

    } else {   //Firefox、Opera、Safari
        var html = '<html><head><script type="text/javascript"><!--\n'
                        + 'document.write(\'<meta http-equiv="refresh" content="0;url='+url+'">\');'
                        + '// --><'+'/script></head><body></body></html>';
        a.href = 'data:text/html;charset=utf-8,'+encodeURIComponent(html);
        a.setAttribute("onclick", "return confirm('リファラを削除して移動します。');");

    }
}


////
// コメントフォームを開く
//
function openCommentForm(id){

    var target = './comment/' + id + '/';

    var commentWindow = window.open(target, 'comment_form', 'scrollbars=yes,resizable=yes,width=430,height=675');
    commentWindow.focus();
}

