
function ds(e){
e = e || window.event;
var itm = e.target != null ? e.target : e.srcElement;
if(itm.tagName.toLowerCase()!='input' && itm.tagName.toLowerCase()!='textarea'){ return false; }
}

function ra(){return true;}

document.oncontextmenu=new Function("return false;");
document.onselectstart=new Function("return false;");
document.ondragstart=new Function("return false;");
document.onmousedown=ds;
document.onclick=ra;

function show_box_img(x){
var img_box = new Image();
img_box.src = x;
document.getElementById('img_box').src=img_box.src;
}

function show_box(x){
document.getElementById('full').style.display="block";
document.getElementById('box').style.display="block";
var img_box = new Image();
img_box.src = x;

document.getElementById('img_box').src=img_box.src;
fade(0,77,2,'full');
setTimeout("fade(0,100,5,'img_box');",200);
setTimeout("document.getElementById('d_gallery').style.display='block'",200)
}

function hide_box(){
fade(100,0,1,'img_box');

setTimeout("document.getElementById('img_box').src='load.gif';",200);
setTimeout("fade(77,0,2,'full');",200);

setTimeout("hide_div()",400);
}


function hide_div(){
document.getElementById('d_gallery').style.display="none";
document.getElementById('full').style.display="none";
document.getElementById('box').style.display="none";
}


function fade(x1,x2,d,ob){
var timer = 0;
if(x1<x2){
for(i = x1; i <= x2; i++) { setTimeout("changeOpac(" + i + ",'"+ob+"')",(timer * d)); timer++; }
}
else {
for(i = x1; i >= x2; i--) { setTimeout("changeOpac(" + i + ",'"+ob+"')",(timer * d)); timer++; }
}
}

var dimages=new Array();
var ddimages=new Array();
var numImages=5;

var curImage=-1;

for(i = 0; i < 5; i++) {var j = i+1; dimages[i] = new Image(); dimages[i].src = "img/image_0" + j + ".jpg";}

for(i = 0; i < 5; i++) {var j = i+1; ddimages[i] = new Image(); ddimages[i].src = "img/dunga_0" + j + ".png";}

function blendimage(imagefile,dfile) {
    var timer = 0;
    changeOpac(0, 'chph');
    document.getElementById("chph").src = imagefile;
	document.getElementById("move").src = dfile;

    for(i = 0; i <= 100; i++) { setTimeout("changeOpac(" + i + ",'chph')",(timer * 20)); timer++; }
}

function loadDiv() {document.getElementById("dchph").style.background = "url('" +  document.getElementById("chph").src + "') no-repeat";}

function swapPicture()
{
  if (document.images)
  {
    var nextImage=curImage+1;
    if (nextImage>=numImages)
      nextImage=0;
    if (dimages[nextImage] && dimages[nextImage].complete)
    {
      var target=0;
      if (document.images.chph)
        target=document.images.chph;
      if (document.all && document.getElementById("chph"))
        target=document.getElementById("chph");

      if (target)
      {
				blendimage(dimages[nextImage].src,ddimages[nextImage].src)
	document.getElementById("move").src = ddimages[nextImage].src;
	setTimeout("movem()", 1000);
				setTimeout("loadDiv()",3000);
        curImage=nextImage;
      }
      setTimeout("swapPicture()", 5000);
    }
    else { setTimeout("swapPicture()", 500); }
  }
}

setTimeout("swapPicture()", 5000);


function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function blendimage(imagefile) {
    var timer = 0;
    changeOpac(0, 'chph');
    document.getElementById("chph").src = imagefile;
    for(i = 0; i <= 100; i++) { setTimeout("changeOpac(" + i + ",'chph')",(timer * 20)); timer++; }
}

function loadDiv() {document.getElementById("dchph").style.background = "url('" +  document.getElementById("chph").src + "') no-repeat";}

var xOpac = 0;
var t;

function fading(io) {
var timer = 0;
if ( io == "in" ) {
for(i = 0; i <= 50; i++) { setTimeout("changeOpac(" + i + ",'move')",(timer * 30)); timer++; }
xOpac=50;
} else {
for(i = 50; i >= 0; i--) { setTimeout("changeOpac(" + i + ",'move')",(timer * 30)); timer++; }
xOpac=0;
}
}

function movem(){
if (xOpac==0) fading('in');
var timer1 = 0;
for(i = 190; i >= 90; i--) { setTimeout("document.getElementById('move').style.top = '" + i+ "px';", (timer1*30)); timer1++;}
setTimeout("fading('out')", 2000);
//setTimeout("movem()", 10000);
}

function movedungi(id,y1,y2,t){
var timer = 0;
changeOpac(t,id);
if (y1<y2) {
for(i = y1; i <= y2; i++) { setTimeout("document.getElementById('"+id+"').style.top = '" + i+ "px';", (timer*t*5)); timer++;}
} else {
for(i = y1; i >= y2; i--) { setTimeout("document.getElementById('"+id+"').style.top = '" + i+ "px';", (timer*t*5)); timer++;}
}
setTimeout("movedungi('"+id+"',"+y2+","+y1+","+t+")", timer*t*5);
}

setTimeout("movem()", 2000);
setTimeout("movedungi('move_01',30,250,20)", 2000);
setTimeout("movedungi('move_02',230,20,15)", 2000);
setTimeout("movedungi('move_03',50,220,15)", 2000);
setTimeout("movedungi('move_04',40,210,10)", 2000);

