Hóesés 8
2013.12.12. 20:59
<script language="javascript">
ns6 = document.getElementById;
ns = document.layers;
ie = document.all;
/*******************[AccessCSS]***********************************/
function accessCSS(layerID) { //
if(ns6){ return document.getElementById(layerID).style;} //
else if(ie){ return document.all[layerID].style; } //
else if(ns){ return document.layers[layerID]; } //
}/***********************************************************/
/**************************[move Layer]*************************************/
function move(layer,x,y) { accessCSS(layer).left=x; accessCSS(layer).top = y; }
function browserBredde() {
if (window.innerWidth) return window.innerWidth;
else if (document.body.clientWidth) return document.body.clientWidth;
else return 1024;
}
function browserHoyde() {
if (window.innerHeight) return window.innerHeight;
else if (document.body.clientHeight) return document.body.clientHeight;
else return 800;
}
function makeDiv(objName,parentDiv,w,h,content,x,y,overfl,positionType)
{
// positionType could be 'absolute' or 'relative'
if (parentDiv==null) parentDiv='body';
var oDiv = document.createElement ("DIV");
oDiv.id = objName;
if (w) oDiv.style.width = w;
if (h) oDiv.style.height= h;
if (content) oDiv.innerHTML=content;
if (positionType==null) positionType="absolute";
oDiv.style.position = positionType;
if (x) oDiv.style.left=x; else oDiv.style.left=-2000;
if (y) oDiv.style.top=y; else oDiv.style.top=-2000;
if (overfl) oDiv.style.overflow=overfl; else oDiv.style.overflow="hidden";
eval(' document.'+parentDiv+'.appendChild (oDiv); ');
delete oDiv;
}
var snowC=0;
var x = new Array();
var y = new Array();
var speed = new Array();
var t=0;
var cC = new Array();
var ra = new Array();
function makeSnow() {
x[snowC] = Math.round(Math.random()*(browserBredde()-60));
y[snowC] = 10;
speed[snowC] = Math.round(Math.random()*8)+1;
var bilde="//frank.gportal.hu/portal/frank/image/gallery/1386878585_23.gif";
if (speed[snowC]<3) bilde="//frank.gportal.hu/portal/frank/image/gallery/1386878584_09.gif";
else if (speed[snowC]<6) bilde="//frank.gportal.hu/portal/frank/image/gallery/1386878584_11.gif";
else if (speed[snowC]<8) bilde="//frank.gportal.hu/portal/frank/image/gallery/1386878584_73.gif";
makeDiv("snow"+snowC,"body",24,24,'<img src="'+bilde+'">');
cC[snowC]=Math.random()*10;
ra[snowC] = Math.random()*7;
snowC++;
}
function moveSnow() {
var r = Math.round(Math.random()*100);
if (r>70 && snowC<30) makeSnow();
for (t=0;t<snowC;t++) {
y[t]+=speed[t];move("snow"+t,x[t],y[t]);
if (y[t]>browserHoyde()-50) {y[t] = 10;x[t] = Math.round(Math.random()*(browserBredde()-60));}
cC[t]+=0.01;
x[t]+=Math.cos(cC[t]*ra[t]);
}
setTimeout('moveSnow()',20);
}
//========================[Sound variables - checking for sound] ===================================//
var NSsound = navigator.plugins && navigator.plugins["LiveAudio"];
var IEsound = navigator.plugins && document.all;
var audioEnabled = NSsound || IEsound;
function newContent(layernm,content) {
if (ns6) document.getElementById(layernm).innerHTML=content;
else if (ie) document.all[layernm].innerHTML=content;
else if (ns) {
eval(' document.layers["'+layernm+'"].document.open();');
eval(" document.layers['"+layernm+"'].document.write('"+content+"');");
eval(' document.layers["'+layernm+'"].document.close();');
}
}
//========[crossbrowser init sound]==============//
function makeSoundDiv(soundname,newInnerHTML) {
var oDiv = document.createElement ("DIV");
oDiv.id = soundname;
oDiv.style.position = "absolute";
oDiv.style.left=-2000;
oDiv.innerHTML=newInnerHTML;
document.body.appendChild (oDiv);
delete oDiv; }
//==================================[crossbrowser init sound]========================================//
function init(soundfile,autostart,loopit) {
soundname=soundfile;
var buff='';
if (loopit==null) loopit=false;
if (audioEnabled) {
if (autostart==null) autostart=false;
buff+='<embed name="obj_'+soundname+'" src='+soundfile+' autoplay="'+autostart+'" AUTOSTART="'+autostart+'" loop="'+loopit+'" hidden="true" volume="80%" > ';
buff+='<NOEMBED><BGSOUND src='+soundfile+'></NOEMBED>';
buff+='</embed> ';
}
else { // try something else
if (autostart==true) autostart=1; else autostart=0;
if (loopit==true) loopit=1; else loopit=0;
buff+='<object type="application/x-mplayer2" ';
buff+=' pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" ';
buff+=' Name="obj_'+soundname+'" src='+soundfile+' AutoStart='+autostart+' ShowStatusBar=1 volume=-1 loop='+loopit+' >';
buff+=' </object> ';
}
makeSoundDiv(soundname,"");
makeSoundDiv(soundname+"_buffer",buff);
}
function play(soundname,loopit) {
if (document.getElementById(soundname)) newContent(soundname,document.getElementById(soundname+"_buffer").innerHTML);
else init(soundname,true,loopit);
}
play("jul.mid",true);
moveSnow();
</script>
|