//Progress Bar script- by Todd King (tking@igpp.ucla.edu)
//Modified by JavaScript Kit for NS6, ability to specify duration
//Visit JavaScript Kit (http://javascriptkit.com) for script

var duration=10 // Specify duration of progress bar in seconds
var _progressWidth = 50;	// Display width of progress bar

var _progressBar = new String("..........................................................................................................................");
var _progressEnd = 10;
var _progressAt = 0;


// Create and display the progress dialog.
// end: The number of steps to completion
function ProgressCreate(end) {
	// Initialize state variables
	_progressEnd = end;
	_progressAt = 0;

	// Move layer to center of window to show
	if (document.all) {	// Internet Explorer
		progress.className = 'select-free show';
		progress.style.left = (document.body.clientWidth/2) - (progress.offsetWidth/2);
		progress.style.top = document.body.scrollTop+(document.body.clientHeight/2) - (progress.offsetHeight/2);
	} else if (document.layers) {	// Netscape
		document.progress.visibility = true;
		document.progress.left = (window.innerWidth/2) - 100;
		document.progress.top = pageYOffset+(window.innerHeight/2) - 40;
	} else if (document.getElementById) {	// Netscape 6+
		document.getElementById("progress").className = 'select-free show';
		document.getElementById("progress").style.left = (window.innerWidth/2)- 100;
		document.getElementById("progress").style.top = pageYOffset+(window.innerHeight/2) - 40;
	}

	ProgressUpdate();	// Initialize bar
}

// Hide the progress layer
function ProgressDestroy() {
	// Move off screen to hide

//	if (document.all) {	// Internet Explorer
//		progress.className = 'hide';
//	} else if (document.layers) {	// Netscape
//		document.progress.visibility = false;
//	} else if (document.getElementById) {	// Netscape 6+
//		document.getElementById("progress").className = 'hide';
//	}

}

// Increment the progress dialog one step
function ProgressStepIt() {
	_progressAt++;
	if(_progressAt > _progressEnd) _progressAt = _progressAt % _progressEnd;
	ProgressUpdate();
}

// Update the progress dialog with the current state
function ProgressUpdate() {
	var n = (_progressWidth / _progressEnd) * _progressAt;
	if (document.all) {	// Internet Explorer
		try {
			var bar = dialog.bar;
		} catch (oe) {
			return;
		}
 	} else if (document.layers) {	// Netscape
		var bar = document.layers["progress"].document.forms["dialog"].bar;
		n = n * 0.55;	// characters are larger
	} else if (document.getElementById){
                var bar=document.dialog.bar
        }
	var temp = _progressBar.substring(0, n);
	bar.value = temp;
}

// Demonstrate a use of the progress dialog.
function Progress() {
	ProgressCreate(10);
	window.setTimeout("Click()", 100);
}

function Click() {
	if(_progressAt >= _progressEnd) {
		ProgressDestroy();
		return;
	}
	ProgressStepIt();
	window.setTimeout("Click()", (duration-1)*1000/10);
}

function CallJS(jsStr) { //v2.0
  return eval(jsStr)
}



// Create layer for progress dialog
document.write("<span id=\"progress\" class=\"hide\">");
	document.write("<FORM name=dialog>");
	document.write("<TABLE width=450 height=150 border=0 style=\"background-image: url(/neted/admin/img/progress_bk.gif); border-left: solid 1px #cccccc; border-top: solid 1px #cccccc; border-right: solid 2px #666666; border-bottom: solid 2px #666666;\" bgcolor=\"#ffffff\">");
	document.write("<TR><TD ALIGN=\"center\">");
	document.write("<TABLE width=\"100%\" border=0  bgcolor=\"#ffffff\">");
	document.write("<TR><TD ALIGN=\"center\">");
	document.write("<span style=\"font-family: Arial; font-size: medium; font-weight: normal; color: #333333;\">Vennligst vent ");
	document.write("<input style=\"border: 0px; font-family: Arial; font-size: medium; font-weight: normal; color: #333333; background: none;\" type=text name=\"bar\" size=\"" + _progressWidth/2 + "\">");
	document.write("</span></td>");
	document.write("<TD width=\"40\" ALIGN=\"center\">");
	document.write("<img src=\"/neted/admin/img/progress.gif\" alt=\"\">");
	document.write("</TD></TR>");
	document.write("</TABLE>");
	document.write("</TD></TR>");
	document.write("</TABLE>");
	document.write("</FORM>");
	document.write("<!--[if lte IE 6.5]><iframe></iframe><![endif]-->");
document.write("</span>");
ProgressDestroy();	// Hides