// JavaScript Document
//Extending Array Class to add a complete list requirment
Array.prototype.clear = function()
{
    this.length = 0;
};
   

Array.prototype.ChangeMe = function(newArray)
{
    this.clear();
    for (i=0; i<newArray.length; i++)
    {
        this[i] = newArray[i];
    }
}

Array.prototype.Insert = function(place,element)
{   
    if (place >= this.length) 
    {
        this[palce] = element;
        return;
    }
    
    secondPart = new Array();
    secondPart = this.slice(place,this.length);
    this.length = place;
    this.push([element],secondPart);
}

Array.prototype.Remove = function(index)
{
    secondPart = this.slice(index+1,this.length);
    this.length = index;
    this.push(secondPart);   
}

function TestArray()
{
    list1 = new Array();
    list1.push(2);
    list1.push(3);
    list1.Insert(0,0);
    list1.Insert(1,1); 
    document.getElementById("content").innerHTML += list1+"<br>"; 
    list1.Insert(2,"2-2");
    document.getElementById("content").innerHTML += list1+"<br>"; 
    list1.Remove(2);
    document.getElementById("content").innerHTML += list1+"<br>"; 
}

// Add showModelessDialog
if (navigator.appName != "Microsoft Internet Explorer")
{
	showModelessDialog = function(theUrl, theWindow, theOptions)
	{
		var theOptions = 'dialogHeight=570px;dialogWidth=730px'
		var optionParts = theOptions.split(';');
		var theWidth = "770px";
		var theHeight = "400px";
		for(var i=0; i<optionParts.length; i++)
		{
			paramParts = optionParts[i].split('=');
			if (paramParts[0] == 'dialogHeight')
				theHeight = paramParts[1];
			if (paramParts[0] == 'dialogWidth')
				theWidth = paramParts[1];  
		}
		var openOptions = 'width=' + theWidth + ',height=' + theHeight + ',toolbar=no,personalbar=no,location=no,directories=no,statusbar=no,menubar=no,status=no,resizable=yes,left=60,screenX=60,top=100,screenY=100,scrollbars=1';
		window.open(theUrl, theWindow, openOptions);
	}
}

