jQuery(function($) {
    if ($("#iphoneSel").length > 0) {
        if (navigator.userAgent.indexOf('iPhone') !== -1 || navigator.userAgent.indexOf('Android') !== -1) {
            $("#iphoneSel").append('<a href="/iphone/">iPhone版を表示 &raquo</a>');
            $('#iphoneSel').show();
        }
    }
    //
    //lazyload
//    $("img.models, .imageflow img, #IncludeBox img").lazyload({
//        placeholder: "./images/blank.gif",
//    //    effect : "fadeIn",
//        event: "sporty"
//    });

//$("#topimage").css("background", "url(/images/loading2.gif) center center no-repeat");

    $(window).load(function() {

        //
        //bookmarks
        scBk('bookmarks');

        //
        //lazyload
//        $("img.models, .imageflow img, #IncludeBox img").trigger("sporty");

        //
        //setTimeout
        //
        var timeout = setTimeout(function() {
            //
            //ImageFlow
            if ($("#topimage .imageflow").length > 0) {
                $("#topimage").css("background", "none");
                //top
                if ($("#instanz_top").length > 0) {
                    var InstanceIM = new ImageFlow();
//                    domReady(function () {
                      InstanceIM.init({
                        ImageFlowID: 'instanz_top',
                        imageCursor: 'pointer',
                        slider: false,
                        reflections: false,
                        reflectionP: 0,
                        opacity: true,
                        startID: 5,
                        startAnimation: true,
                        imagesHeight: 0.92,
                        imageFocusM: 2.4,
                        imageFocusMax: 4,
//                        onClick: function() { window.open(this.url); },
                        circular: true,
                        xStep: 300
                      }); 
//                    });
                }
                //sitemap
                if ($("#instanz_sitemap").length > 0) {
                    var InstanceIM = new ImageFlow();
//                    domReady(function () {
                      InstanceIM.init({
                        ImageFlowID: 'instanz_sitemap',
                        imageCursor: 'pointer',
                        slider: false,
                        reflections: false,
                        reflectionP: 0,
                        opacity: true,
                        startID: 5,
                        startAnimation: true,
                        imagesHeight: 0.92,
                        imageFocusM: 2.4,
                        imageFocusMax: 4,
//                        onClick: function() { window.open(this.url); },
                        circular: true,
                        xStep: 300
                      }); 
//                    });
                }
                //link
                if ($("#instanz_link").length > 0) {
                    var InstanceIM = new ImageFlow();
//                    domReady(function () {
                      InstanceIM.init({
                        ImageFlowID: 'instanz_link',
                        imageCursor: 'pointer',
                        slider: false,
                        reflections: false,
                        reflectionP: 0,
                        opacity: true,
                        startID: 5,
                        startAnimation: true,
                        imagesHeight: 0.92,
                        imageFocusM: 2.4,
                        imageFocusMax: 4,
                        onClick: function() { window.open(this.url); },
                        circular: true,
                        xStep: 300
                      }); 
//                    });
                }
            }
        }, 500);

    });     //end $(window).load(function() {

});


function winOpen(url)
{
    window.open(url, null);
}

/*
//検索時　form.actionにパラメータを追加
function castPostAction(formElm)
{
//var text = encodeURI(formElm.elements[0].value);
var text = encodeURIComponent(formElm.elements[0].value);
//var text = formElm.elements[0].value;
var action = formElm.action;
formElm.action = action + '?keyword=' + text;

return true;
}

//avfanでの検索を別ウィンドウで開く
function avfanSearch(formElm)
{
    var url = formElm.action + '?q=' + formElm.megane2.value;
    window.open(url);
}

//window.onLoad時のコンフリクト回避
function addEvent(obj, evType, fn){
  if (obj.addEventListener){ //IE以外
    obj.addEventListener(evType, fn, false);
    return true;
  } else if (obj.attachEvent){ //IE
    var r = obj.attachEvent("on"+evType, fn);
    return r;
  } else {
    return false;
  }
}
*/


