// Pembangkit Objek Image Dinamis
function DynamicImage (imgName, imgOff, imgOn)
{
	this.name = imgName;
	this.imgOff = loadImage(imgOff);
	this.imgOn = loadImage(imgOn);
	this.on = on;
	this.off = off;
}

// Pembangkit Objek Image Random
function RandomImage (imgName, arrayOff, arrayOn, width, height)
{
	this.name = imgName;
	this.num = getRandNum(arrayOff.length);
	this.imgOff = loadRandImage(arrayOff, this.num, width, height);
	this.imgOn = loadRandImage(arrayOn, this.num, width, height);
	this.on = on;
	this.off = off;
	this.printTag = printTag;
}

// Member
function on ()
{
	document[this.name].src = this.imgOn.src;
}

// Member
function off ()
{
	document[this.name].src = this.imgOff.src;
}

// Member
function printTag ()
{
	document.write('<IMG NAME="' + this.name + '" SRC="' + this.imgOff.src + '" WIDTH=' + this.imgOff.width + ' HEIGHT=' + this.imgOff.height + ' BORDER=0 ALT="">');
}

// Buat Image
function loadImage (img)
{
	imgDir = ""
	imgObject = new Image()
	imgObject.src = imgDir + img;
	return imgObject;
}

// Buat Image Dari Array
function loadRandImage (arr, i, x, y)
{
	imgDir = "";
	imgObject = new Image(x, y)
	imgObject.src = imgDir + arr[i];
	return imgObject;
}

// Kembalikan Nomor Random
function getRandNum (len)
{
	randNum = parseInt(Math.random() * len);
	if (isNaN(randNum))
		randNum = 0;
	return randNum;
}

function quickJump(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function popupWin(locationURL, lebar, tinggi) { 
	var winLeft = (screen.width - lebar) / 2;
	var winTop = (screen.height - tinggi) / 2;
	winProp = 'width='+lebar+', height='+tinggi+', top='+winTop+', left='+winLeft+', directories=no, location=no, menubar=no, scrollbars=yes, status=no, toolbar=no, resizable=yes';
	window.open(locationURL, "player", winProp);
}

function popupModal(locationURL, lebar, tinggi) { 
	var winLeft = (screen.width - lebar) / 2;
	var winTop = (screen.height - tinggi) / 2;
	winProp = 'dialogWidth: '+lebar+'; dialogHeight: '+tinggi+'; resizable: yes; help: no; status: no; scroll: yes;';
	showModalDialog(locationURL, "temp", winProp);
}

function popupWin2(locationURL, lebar, tinggi) { 
	var winLeft = (screen.width - lebar) / 2;
	var winTop = (screen.height - tinggi) / 2;
	winProp = 'width='+lebar+', height='+tinggi+', top='+winTop+', left='+winLeft+', directories=no, location=no, menubar=no, scrollbars=no, status=no, toolbar=no, resizable=no';
	window.open(locationURL, "player", winProp);
}
