function changeSortOfItems()
{
    location.href = document.getElementById('SortOfItems').value + ".html";
}

function changeSortOfItemsBySearch()
{
    var vars = getUrlVars();
    var params = '';

    vars['sid'] = document.getElementById('SortOfItems').value;

    for (var keyString in vars)
    {
        if(keyString != 'page')
        {
            if(params) params = params + "&";
            params = params + keyString + "=" + vars[keyString];
        }
    }

    location.href = location.pathname + "?" + params;
}

function getUrlVars()
{
    var vars = [], hash; 
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); 
    for(var i = 0; i < hashes.length; i++) { 
        hash = hashes[i].split('='); 
        vars[hash[0]] = hash[1]; 
    } 
    return vars;
}

/*---------------------------------

target="_blank" rel="external nofollow"

---------------------------------*/
$(function() {
    if (!document.getElementsByTagName) return;
    var anchors = document.getElementsByTagName("a");
    for (var i=0; i<anchors.length; i++) {
    var anchor = anchors[i];
    if (anchor.getAttribute("href") &&
    ((anchor.getAttribute("rel") == "external nofollow") || (anchor.getAttribute("rel") == "nofollow external") || (anchor.getAttribute("rel") == "external")))
    anchor.target = "_blank";
    }
});

/*---------------------------------

外部リンクをブランク表示

---------------------------------*/
$(function() {
    $("a.blank").attr("target","_blank");
});

/*---------------------------------

フォーム関連

---------------------------------*/

$(function() {
                     
    //テキスト　高さ初期化
    $(":text").addClass("text");
    
    //ボタン
    $(".btn:button").hover(
    function () {
        $(this).addClass("ov");
    }, 
    function () {
        $(this).removeClass("ov");
    });
    
    //submit
    $(".btn:submit").hover(
    function () {
        $(this).addClass("ov");
    }, 
    function () {
        $(this).removeClass("ov");
    });
    
    
    $(":text")
    .focus(function(){
        $(this).addClass("txt_focus");
    })
    .blur(function(){
        $(this).removeClass("txt_focus");
    })
    
    $("select")
    .focus(function(){
        $(this).addClass("txt_focus");
    })
    .blur(function(){
        $(this).removeClass("txt_focus");
    })
    $("select").addClass("sel_style");
    
});



/*---------------------------------

カーソール表示

---------------------------------*/
$(function() {
    $(".local_navi img").mouseover(function () {
        $(this).css({"cursor":"pointer"});
    });
    $(".data img").mouseover(function () {
        $(this).css({"cursor":"pointer"});
    });
});

/*---------------------------------

画像マウスオーバー

---------------------------------*/
$(function(){
    $(".local_navi img").hover(
    function () {
        imgSrc = $(this).attr("src");
        imgSrc = imgSrc.replace("_off.", "_on.");
        $(this).attr("src",imgSrc);
    }, 
    function () {
        imgSrc = $(this).attr("src");
        imgSrc = imgSrc.replace("_on.", "_off.");
        $(this).attr("src",imgSrc);
    });
});

$(function(){
    $(".data img").hover(
    function () {
        imgSrc = $(this).attr("src");
        imgSrc = imgSrc.replace("_off.", "_on.");
        $(this).attr("src",imgSrc);
    }, 
    function () {
        imgSrc = $(this).attr("src");
        imgSrc = imgSrc.replace("_on.", "_off.");
        $(this).attr("src",imgSrc);
    });
});
