﻿


jQuery(document).ready(function () {

    PEPS.rollover.init();

});



PEPS = {};

PEPS.rollover =
{
    init: function () {
        this.preload();

        jQuery(".ro").hover(
         function () { jQuery(this).attr('src', PEPS.rollover.newimage(jQuery(this).attr('src'))); },
         function () { jQuery(this).attr('src', PEPS.rollover.oldimage(jQuery(this).attr('src'))); }
      );
    },

    preload: function () {
        jQuery(window).bind('load', function () {
            jQuery('.ro').each(function (key, elm) { jQuery('<img>').attr('src', PEPS.rollover.newimage(jQuery(this).attr('src'))); });
        });
    },

    newimage: function (src) {
        return src.substring(0, src.search(/(\.[a-z]+)$/)) + '_o' + src.match(/(\.[a-z]+)$/)[0];
    },

    oldimage: function (src) {
        return src.replace(/_o\./, '.');
    }
};


// Postback
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
