function cursor_wait() 
{
 window.status = "Please wait...";
 //document.body.style.cursor = "wait";
 $('body').addClass('waiting');
}

function cursor_clear() 
{
 window.status = "Done";
// document.body.style.cursor = "default";
 $('body').removeClass('waiting');
}

function myrandom( min, max ) 
{
 if( min > max )  return(0);
 if( min == max ) return(min);
 return( min + parseInt( Math.random() * ( max-min+1 ) ) );
}


function uniqid(prefix) 
{
 if (typeof prefix == 'undefined') {
  prefix = "";
 }
  var retId;    var formatSeed = function (seed, reqWidth) {
        seed = parseInt(seed,10).toString(16); // to hex str
        if (reqWidth < seed.length) { // so long we split
            return seed.slice(seed.length - reqWidth);
        }        if (reqWidth > seed.length) { // so short we pad
            return Array(1 + (reqWidth - seed.length)).join('0')+seed;
        }
        return seed;
    }; 
    // BEGIN REDUNDANT
    if (!this.php_js) {
        this.php_js = {};
    }    // END REDUNDANT
    if (!this.php_js.uniqidSeed) { // init seed with big random int
        this.php_js.uniqidSeed = Math.floor(Math.random() * 0x75bcd15);
    }
    this.php_js.uniqidSeed++; 
    retId  = prefix; // start with prefix, add current milliseconds hex string
    retId += formatSeed(parseInt(new Date().getTime()/1000,10),8);
    retId += formatSeed(this.php_js.uniqidSeed,5); // add seed hex string
    return retId;
}
