//var REQUEST_URI = 'http://www.us-lighthouse.com/telephone_api';
//var AREA = (window.location.hostname == "www.lighthousesd.net") ? 'SD' : 'LA';
//var MAP_AREA =( window.location.hostname == "www.lighthousesd.net") ? '&maparea_id=' : '&maparea_id=2';
var fcName = " ";
//初期設定
$(document).ready(
    function()
    {
        //document.onkeydown = checkCSRKey;
        
        //タウン情報取得
        //http://www.us-lighthouse.com/telephone_api/shopmaster/json_api_top?jsoncallback=?limit=10&page=1&shop_area=LA&maparea_id=2
        /*
        $.ajax({
            url: REQUEST_URI + "/newshopmaster/json_api_top?jsoncallback=?", 
            data: 'limit=10&page=1&shop_area=' + AREA+ MAP_AREA,  
            dataType: "jsonp",
            success: function(data){
                if(data.items.length > 0){
                    $.each(data.items, function(i,item){ 
                        var shopName = item.shopmaster.shop_name_ja; 
                        alert(shopName);
                    });  
                }
            } 
        });    
        */
        
        $.ImageBox.init(
            {
                loaderSRC: '/images/imagebox/loading.gif',
                textImage: 'Showing image',
                textImageFrom: 'from',
                fadeDuration: 400,
                closeHTML: '<img src="/images/imagebox/close.jpg" border=0 />'
            }
        );
        
        $('#windowOpen').bind(
            'click',
            function()
            {
                thickbox('window');
            }
        );
        
        $('#windowClose').bind(
            'click',
            function()
            {
                TB_remove('window');
            }
        );
    }
);

function submit_confirm(frm){
    if(confirm('本当に終了しますか？')){
        frm.submit();
    }
}

//ユーザー登録項目表示／非表示
function user_regist_column(mode){
    if(mode == 1){
        $('#User_us_nicknam').hide();
        $('#User_us_passwd_confirm').hide();
        $('#Individual_iv_zip').hide();
        $('#kiyaku').hide();  
    }else{
        $('#User_us_nicknam').show();
        $('#User_us_passwd_confirm').show();
        $('#Individual_iv_zip').show();
        $('#kiyaku').show();   
    }
}


function action_to(id,to){
    $('#'+id).attr('action',to)
}


//ポップアップ
function showPopup(action,width,height){
    var fileName = action;
    width = 500;
    //window.open(fileName, "wiondow", "scrollbars=yes,width="+width+",height="+height);
    window.open(fileName, "wiondow", "scrollbars=yes,width="+width+",height="+height); 
    return false;
}

function make_newwin(f) {
　　f.target = window.name + "_ko";
　　var w = window.open("about:blank", f.target, "scrollbars=yes");
　　f.action = "/newsletter/mailinglistconfirm" ; 　　
w.focus();
　　f.submit();
　　f.action = "/newsletter/mailinglistcomplete" ; 
  　　f.target = ""; 
/*
window.open("", "ATMARK") ;
 window.document.inform.action = "/newsletter/mailinglistconfirm" ;
 window.document.inform.target = "ATMARK" ;
 window.document.inform.method = "POST" ;
 window.document.inform.submit() ;
 window.document.inform.target = "" ; 
 */ 
}

function submit_form($obj){
    $('#form').attr('action','');
    $obj.form.submit();
}

//Enter押下時処理
function checkCSRKey(e){
    try {
        if( !e ) { 
            if( window.event ) { 
            //DOM 
                e = window.event; 
            } else { 
                //TOTAL FAILURE, WE HAVE NO WAY OF REFERENCING THE EVENT 
                return; 
            } 
        } 
        if( typeof( e.which ) == 'number' ) { 
            //NS 4, NS 6+, Mozilla 0.9+, Opera 
            e = e.which; 

        } else if( typeof( e.keyCode ) == 'number' ) { 
            //IE, NS 6+, Mozilla 0.9+ 
            e = e.keyCode; 

        } else if( typeof( e.charCode ) == 'number' ) { 
            //also NS 6+, Mozilla 0.9+ 
            e = e.charCode; 

        } else { 
            //TOTAL FAILURE, WE HAVE NO WAY OF OBTAINING THE KEY CODE 
            return; 
        }
        
           
        if(fcName=='Input' && e=='13'){
           alert(fcName);
        //    show_search(document.getElementById('id_search').value,1,document.getElementById('lr2').checked);
        }
    } catch(e) {
        alert( e );
    }
}