OK, the title is a tad misleading.

I have this script :

Main.js
PHP Code:
// wave sub objects
function WSubObj(numimgobjectiwidthiheight){
    
this.num;
    var 
document.createElement("span");
    
o.style.overflow "hidden";
    
o.style.width iwidth "px";
    
o.style.height iheight "px";
    
o.style.top = (num-1) + "px";
    var 
oI document.createElement("img");
    
oI.src img.src;
    
oI.style.left "0px";
    
oI.style.top = (-iheight num) + "px";
    
oI.style.width iwidth "px";
    
oI.style.height iheight "px";
    
o.appendChild(oI);
    
document.getElementById("wave_zone").appendChild(o);
    
this.spa o.style;
    
this.ddx 0
    this
.PX  0
    this
.x   0
    
if (num 0this.prev object[num 1];
}

WSubObj.prototype.main = function(power){
    var 
x0 = (this.== 0) ? Math.random() * power this.prev.x;
    
this.this.PX += (this.ddx += ( (x0 this.PX this.ddx) * ) / 2.8) / 1.4;
    
this.spa.left Math.round(this.x) + "px";
}

// wave effect object
var weff = {
    
// variables
    
power 2.2,

    
// inner variables
    
object : new Array(),
    
simg null,
    
iwidth  0,
    
iheight  0,

    
// initialization function
    
init : function() {
        for (var 
0this.iheighti++)
            
this.object[i] = new WSubObj(ithis.simgthis.objectthis.iwidththis.iheight);
    },

    
// main loop function of water effect
    
run : function() {
        var 
0o;
        while (
weff.object[i++]) o.main(weff.power);
        
setTimeout(weff.run100);
    }
};

// on page load
window.onload = function() {
    
weff.simg document.getElementById("source_img");
    
weff.iwidth weff.simg.width;
    
weff.iheight weff.simg.height;

    
// set necessary width and height for wave zone element
    
var css document.getElementById("wave_zone").style;
    
css.height weff.iheight "px"//(weff.iheight/4 - 1) + "px";
    
css.width  weff.iwidth "px";

    
weff.init();
    
weff.run();

With this CSS file :

Main.css
PHP Code:
#main_object {
    
positionrelative;
}
#main_object img {
    
displayblock;
}
#main_object #wave_zone img {
    
position:absolute;
    
left:-9999px;
}
#main_object span {
    
position:absolute;
    
font-size:0px;
}
#main_object #wave_zone {
    
position:relative;
    
display:block;
    
overflow:hidden;
    
background-color:#000;

Together they give a nice watery, wavy effect for one of my pictures. Problem is: The picture got flipped upside down. I have tried to play around with the script to see if I can identify the flipping part. I am unable to.

Can anyone help identify the part where the picture gets flipped upside down?