(function(){
        // iframe化することで他のCSSの影響を逃れることができる
        var o = new Overlay('form_attention_overlay');
        o.set_content({
                width:800,
                height:420,
                content_elem: $('form_attention')
        })
        var ifr = $('form_attention');
        iframe_extension(ifr);
        ifr.width = 800;
        ifr.height = 420;
        ifr.set_body($('form_attention_src').innerHTML,{
                afterFinish: function(){
                        Element.setStyle(ifr.get_body_elem(),{
                                'margin':'0px',
                                'padding':'0px',
                                'background-color':'transparent'
                        });

                        var t = new Tab(ifr.$('form_attention_tab'),{style:{'height':(navigator.userAgent.match(/MSIE/) ? 390 : 400)}})
                        var default_css = {
                                privacy:{
                                        'font-size':'13px',
                                        'height': '18px',
                                        'background-color':'#fff',
                                        'border': '0px none',
                                        'padding-bottom': '0px',
                                        'color': '#9cc'
                                },
                                tokushouhou:{
                                        'font-size':'13px',
                                        'height': '18px',
                                        'background-color':'#fff',
                                        'border': '0px none',
                                        'padding-bottom': '0px',
                                        'color': '#f93'
                                },
                                henpin:{
                                        'font-size':'13px',
                                        'height': '18px',
                                        'background-color':'#fff',
                                        'border': '0px none',
                                        'padding-bottom': '0px',
                                        'color': '#ff6666'
                                }
                        };
                        if(t.tab['privacy']){
                                Element.setStyle(t.tab['privacy']['tab'],default_css['privacy']);
                                t.set_callback('privacy',function(){
                                        if(this.opened){
                                                Element.setStyle(this.tab[this.opened]['tab'],default_css[this.opened]);
                                        }
                                        Element.setStyle(this.tab['privacy']['tab'],{
                                                'font-size':'13px',
                                                'background-color':'#9cc',
                                                'border':'2px outset #9cc',
                                                'border-bottom': '0px none',
                                                'padding-bottom': '3px',
                                                'color': '#fff'
                                        })
                                });
                                Event.observe(ifr.$('pp_off'),'click',o.off.bindAsEventListener(o),true);
                        }
                        if(t.tab['tokushouhou']){
                                Element.setStyle(t.tab['tokushouhou']['tab'],default_css['tokushouhou']);
                                t.set_callback('tokushouhou',function(){
                                        if(this.opened){
                                                Element.setStyle(this.tab[this.opened]['tab'],default_css[this.opened]);
                                        }
                                        Element.setStyle(this.tab['tokushouhou']['tab'],{
                                                'font-size':'13px',
                                                'background-color':'#f93',
                                                'border': '2px outset #f93',
                                                'border-bottom': '0px none',
                                                'padding-bottom': '3px',
                                                'color': '#fff'
                                        })
                                });
                                Event.observe(ifr.$('ts_off'),'click',o.off.bindAsEventListener(o),true);
                        }
                        if(t.tab['henpin']){
                                Element.setStyle(t.tab['henpin']['tab'],default_css['henpin']);
                                t.set_callback('henpin',function(){
                                        if(this.opened){
                                                Element.setStyle(this.tab[this.opened]['tab'],default_css[this.opened]);
                                        }
                                        Element.setStyle(this.tab['henpin']['tab'],{
                                                'font-size':'13px',
                                                'background-color':'#ff6666',
                                                'border': '2px outset #ff6666',
                                                'border-bottom': '0px none',
                                                'padding-bottom': '3px',
                                                'color': '#fff'
                                        })
                                });
                                Event.observe(ifr.$('hp_off'),'click',o.off.bindAsEventListener(o),true);
                        }


/*
                        Event.observe($('attention_switch'),'click',function(){
                                o.on();
                                if(Element.hasClassName(this,'privacy')){
                                        t.open('privacy');
                                }else if(Element.hasClassName(this,'tokushouhou')){
                                        t.open('tokushouhou');
                                }
                        }.bind($('attention_switch')),true);
*/

                        if($('privacy_button') != null) Event.observe($('privacy_button'),'click',function(){
                                o.on();
                                t.open('privacy');
                        }.bind($('privacy_button')),true);

                        if($('tokushouhou_button') != null) Event.observe($('tokushouhou_button'),'click',function(){
                                o.on();
                                t.open('tokushouhou');
                        }.bind($('tokushouhou_button')),true);

                        if($('henpin_button') != null) Event.observe($('henpin_button'),'click',function(){
                                o.on();
                                t.open('henpin');
                        }.bind($('henpin_button')),true);

						
//                         var sw = $('form_attention_parts');
//                         iframe_extension(sw);
//                         sw.width = 300;
//                         sw.height = 30;
//                         sw.set_body($('form_attention_parts_src').innerHTML,{
//                                 afterFinish:function(){
//                                         Element.setStyle(sw.$('attention_switch'),{
//                                                 'text-decoration':'none',
//                                                 'font-size':'10px',
//                                                 'color':'black',
//                                                 'margin':'0px',
// //                                                 'background-color':'white',
//                                                 'border':'0px none',
//                                                 'padding':'0px',
//                                                 'margin':'0px'
//                                         });
// //                                         Element.setOpacity(sw.$('attention_switch'),0.3);
//                                         Event.observe(sw.$('attention_switch'),'click',function(){
//                                                 o.on();
//                                                 if(Element.hasClassName(this,'privacy')){
//                                                         t.open('privacy');
//                                                 }else if(Element.hasClassName(this,'tokushouhou')){
//                                                         t.open('tokushouhou');
//                                                 }
//                                         }.bind(sw.$('attention_switch')),true);
//
//                                         Element.setStyle(sw.get_body_elem(),{
//                                                 'margin':'0px',
//                                                 'padding':'1px',
//                                                 'background-color':'transparent'
//                                         });
//                                         Element.show(sw);
//                                 }
//                         });
                }
        });
})()


