function random(min, max)
{
return (Math.random() * (max - min)) + min;
}

function makeInt(value)
{
	iRet = parseInt(value);
	if(isNaN(iRet))
	    iRet = 0;
	
	return iRet;

}

function SetCookie(sName, sValue, sInterval)
{
  var dt = new Date();
  //date.setDay(date.getDay() + sInterval);
  //date = date + sInterval;
  dt.setMonth(dt.getMonth() + sInterval);
  document.cookie = sName + "=" + escape(sValue) + "; expires=" + dt.toGMTString();
}


function SetAttributeEx(obj, name, value) {
    obj[name] = value;
}





/*Array*/
function CreateArray() {
    return new Array();
}

Array.prototype.exists = function(name){
	return (typeof(this[name]) != "undefined");
}

Array.prototype.keys = function(){
	var a = new Array();
	var j = 0;
	for (var p in this.valueOf()){
	    if (typeof(this[p]) == "function") continue;
		a[j] = p;
		j ++;
	}
	return a;
}

Array.prototype.count = function() {
	return this.keys().length;
}

Array.prototype.key = function(index){
	var j = 0;
	for (var p in this.valueOf()){
	    if (typeof(this[p]) == "function") continue;
		if(j ++ == index)
		    return p;
	}
	return "";
}

Array.prototype.item = function(index){
    return this[index];
}

Array.prototype.set = function(key, value) {
    this[key] = value;
}

Array.prototype.remove = function(index) {
    delete this[index];
}

Array.prototype.clear = function() {
    for (var p in this.valueOf()){
        if (typeof(this[p]) == "function") continue;
        delete this[p];
    }
}
