// --------------------------------------- /// SWF URL var FlashPlaceURLPath = 'http://www.mini.jp/missing/blogparts/'; /// RSS URL var RssURL = 'http://www.rsssuite.jp/newmini/f4324/index.rdf'; // --------------------------------------- var ie = ! ! document.all; var n4 = ! ! document.layers; var w3c = ! ! document.getElementById; var mac45 = navigator.userAgent.indexOf( 'MSIE 4.5; Mac_PowerPC' ) >= 0; var opr = ! ! window.opera; var ffox = navigator.userAgent.indexOf( "Firefox" ) >= 0; if( mac45 ) ie = false; if( ffox ) ie = false; if( opr ) ie = false; // alert( navigator.userAgent ); // alert( "ie:" + ie + "\nn4:" + n4 + "\nw3c:" + w3c + "\nopr:" + opr + "\nffox" + ffox ); var CarObjectID = 'xxxxCarObject'; var LogoObjectID = 'xxxxLogoObject'; var PopObjectID = 'xxxxPopObject'; var LayerNum = 200; window.LogoLock = false; var LogoWidth = 65 + 20; // --------------------------------------- function MakeLayerHtml(){ var str = '\n'; str = str + '
\n' ; str = str + '
\n' ; str = str + '
\n' ; return str; } // --------------------------------------- function SetupObject(){ var o1 = MakeObjectLayer( CarObjectID, LayerNum ); var o2 = MakeObjectLayer( LogoObjectID, LayerNum + 1 ); var o3 = MakeObjectLayer( PopObjectID, LayerNum + 2 ); document.body.appendChild( o1 ); document.body.appendChild( o2 ); document.body.appendChild( o3 ); } // --------------------------------------- function MakeObjectLayer( id, layerIndex ){ var objc = document.createElement( 'div' ); objc.setAttribute( 'id', id ); objc.style.clear = "both"; objc.style.position = 'absolute'; objc.style.left = '0px'; objc.style.top = '0px'; objc.style.overflow = 'hidden'; objc.style.zIndex = layerIndex+''; return objc; } // --------------------------------------- /* * EVENT */ function Event_CarMoveEnd(){ CarHide(); MakePopRSS(); } // --------------------------------------- // function Event_ClickLogo(){ if( ! window.LogoLock ){ MakeCarMoving(); } } // --------------------------------------- // function Event_PopClose(){ window.LogoLock = false; DisplaySet( PopObjectID, false ); } // --------------------------------------- // function Event_NewTitleFind(){ MakeCarMoving(); } // --------------------------------------- // function MakeLogo(){ // InitObject(); if( ie )LogoWidth = 65; DisplaySet( LogoObjectID, false ); var foLogo = new FlashObject( FlashPlaceURLPath + "winopen.swf", "mini_logo", 65, 65, "8", "#ffffff" ); foLogo.addParam( "wmode", "transparent" ); foLogo.addParam( "allowScriptAccess", "always" ); foLogo.addParam( "menu", "false" ); foLogo.addVariable( "RssURL", RssURL ); foLogo.write( LogoObjectID ); LayerFixed_logo(); DisplaySet( LogoObjectID, true ); } // --------------------------------------- function MakeCarMoving(){ LogoLock = true; DisplaySet( CarObjectID, false ); var foCar = new FlashObject( FlashPlaceURLPath + "mini_car.swf", "mini_car", GetWindowWidth() - 50, 500, "8", "#ffffff" ); foCar.addParam( "wmode", "transparent" ); foCar.addParam( "menu", "false" ); foCar.addParam( "allowScriptAccess", "always" ); foCar.write( CarObjectID ); LayerFixed_car(); DisplaySet( CarObjectID, true ); } // --------------------------------------- function MakePopRSS(){ DisplaySet( PopObjectID, false ); var foPop = new FlashObject( FlashPlaceURLPath + "window.swf", "pop", 560, 540, "8", "#ffffff" ); foPop.addParam( "wmode", "transparent" ); foPop.addParam( "menu", "false" ); foPop.addParam( "allowScriptAccess", "always" ); foPop.addParam( "lcid", "mc" + ''+(Math.floor(Math.random() * 1000000)) ); foPop.addVariable( "RssURL", RssURL ); foPop.write( PopObjectID ); LayerFixed_pop(); DisplaySet( PopObjectID, true ); } // --------------------------------------- function CarHide(){ DisplaySet( CarObjectID, false ); } // --------------------------------------- // function PopHide(){ DisplaySet( PopObjectID, false ); } // --------------------------------------- function DisplaySet( id, sts ){ var obj = __GetControlObject( id ); if( obj != null ){ if( sts ){ obj.style.visibility="visible"; obj.style.display = ""; }else{ obj.style.visibility="hidden"; obj.style.display = "none"; } } } // --------------------------------------- function __GetControlObject( id ){ var obj = document.getElementById( id ); return obj; } // --------------------------------------- function FixedObject(){ LayerFixed_logo(); LayerFixed_car(); LayerFixed_pop(); } // --------------------------------------- function LayerFixed_logo(){ LayerFixed( LogoObjectID, 'rightTop', LogoWidth * - 1, 6 ) } // --------------------------------------- function LayerFixed_car(){ LayerFixed( CarObjectID, 'leftMiddle', 5, - 250 ) } // --------------------------------------- function LayerFixed_pop(){ LayerFixed( PopObjectID, 'center', - 280, - 270 ) } // --------------------------------------- function LayerFixed( id, alignCode, offSetX, offSetY ){ offSetX = parseInt( offSetX, 10 ); offSetY = parseInt( offSetY, 10 ); var offLeft; var offTop; var WinWidth = GetWindowWidth(); var WinHeight = GetWindowHeight(); if( alignCode == 'rightTop' ){ offLeft = WinWidth + offSetX; offTop = offSetY; } else if( alignCode == 'rightBottom' ){ offLeft = WinWidth + offSetX offTop = WinHeight + offSetY } else if( alignCode == 'leftBottom' ){ offLeft = offSetX offTop = WinHeight + offSetY } else if( alignCode == 'centerTop' ){ offLeft = WinWidth / 2 + offSetX; offTop = offSetY; } else if( alignCode == 'center' ){ offLeft = WinWidth / 2 + offSetX; offTop = WinHeight / 2 + offSetY; } else if( alignCode == 'leftMiddle' ){ offLeft = offSetX; offTop = WinHeight / 2 + offSetY; } else { offLeft = offSetX; offTop = offSetY; } // SetTextToObject( "mmmm", "x:" + document.body.clientWidth ); offLeft = parseInt( offLeft ); offTop = parseInt( offTop ); mx = parseInt( GetScrollX() + offLeft ); my = parseInt( GetScrollY() + offTop ); LayerPosSet( id, mx, my ); // WinIE opera n4 if( ! ( ie || ffox || opr ) ){ clearTimeout( LayerFixed[id] ) LayerFixed[id] = setTimeout( "LayerFixed('"+id+"','"+alignCode+"','" +offSetX+"','"+offSetY+"')", 50 ); } } // --------------------------------------- function SetTextToObject( id, val ){ var obj = __GetControlObject( id ); if( obj != null ){ obj.innerHTML = val; } } // --------------------------------------- function LayerPosSet( id, x, y ){ /* if( document.layers ){ id.moveTo( x, y ); return; } // NN4 // IE5 + , Mozilla, Opera 7 if( typeof id.style.left != "undefined" && typeof id.style.left == "string" ){ id.style.left = x + 'px'; id.style.top = y + 'px'; } else if( typeof id.style.pixelLeft != "undefined" ){ // IE, Opera 6 id.style.pixelLeft = x; id.style.pixelTop = y; } return; */ if( document.getElementById ){ document.getElementById( id ).style.left = x + "px"; document.getElementById( id ).style.top = y + "px"; } else if( document.all ){ document.all( id ).style.pixelLeft = x; document.all( id ).style.pixelTop = y; } else if( document.layers ){ document.layers[id].moveTo( x, y ); // NN4 } } // --------------------------------------- function GetScrollX(){ if( window.scrollX ) return window.scrollX; // Moziila if( window.pageXOffset ) return window.pageXOffset; // Opera, NN4 if( document.documentElement && document.documentElement.scrollLeft ){ // IE return document.documentElement.scrollLeft; } else if( document.body && document.body.scrollLeft ){ return document.body.scrollLeft; } return 0; } // --------------------------------------- function GetScrollY(){ if( window.scrollY ) return window.scrollY; // Mozilla if( window.pageYOffset ) return window.pageYOffset; // Opera, NN4 if( document.documentElement && document.documentElement.scrollTop ){ // IE return document.documentElement.scrollTop; } else if( document.body && document.body.scrollTop ){ return document.body.scrollTop; } return 0; } // --------------------------------------- function GetWindowWidth(){ var xwidth = 0; if( window.innerWidth ){ xwidth = window.innerWidth; // Mozilla, Opera, NN4 } else if( document.documentElement && document.documentElement.clientWidth ){ // IE xwidth = document.documentElement.clientWidth; } else if( document.body && document.body.clientWidth ){ xwidth = document.body.clientWidth; } return xwidth; } // --------------------------------------- function GetWindowHeight(){ if( window.innerHeight ) return window.innerHeight; // Mozilla, Opera, NN4 if( document.documentElement && document.documentElement.clientHeight ){ // IE return document.documentElement.clientHeight; } else if( document.body && document.body.clientHeight ){ return document.body.clientHeight; } return 0; } // --------------------------------------- function __body_onload () { xxxxInit(); //setTimeout( "xxxxInit()", 300 ); } // --------------------------------------- function xxxxInit () { SetupObject(); MakeLogo(); FixedObject(); if( ie ){ window.onresize = FixedObject; window.onscroll = FixedObject; } else if( w3c ){ window.addEventListener( 'resize', FixedObject , false ); window.addEventListener( 'scroll', FixedObject, false ); } } // --------------------------------------- ( function(){ if( typeof window.onload == "function" ){ var oldonload = window.onload; window.onload = function(){ __body_onload(); oldonload(); }; }else{ window.onload = __body_onload; } /* if( ie ){ document.body.onload = __body_onload; } else if( w3c ){ window.addEventListener( 'load', __body_onload , false ); } else{ setTimeout( "__body_onload()", 1000 ); }*/ }() ); // str = '
xxxxx
' ; // document.write( str );