var newWindow = null;

function closeWin(){
	if (newWindow != null){
		if(!newWindow.closed)
			newWindow.close();
	}
}

function popUpWin(url, type, strWidth, strHeight){
	closeWin();
	if (type == "fullScreen"){
		strWidth = screen.availWidth - 10;
		strHeight = screen.availHeight - 160;
	}
	var tools="";
	if (type == "standard" || type == "fullScreen") tools = "resizable, toolbar=yes, location=yes, scrollbars=yes, menubar=yes, width="+strWidth+", height="+strHeight;
	if (type == "console") tools = "resizable, toolbar=no, location=no, scrollbars=no, width="+strWidth+", height="+strHeight;
	newWindow = window.open(url, 'newWin', tools);
	newWindow.focus();
}

checked=false;
function checkedAll () {
	if (checked == false){checked = true}else{checked = false}
	for (var i = 0; i < document.getElementById('form').elements.length; i++) {
		document.getElementById('form').elements[i].checked = checked;
	}
}
 
function breakout_of_frame()
{
  // see http://www.thesitewizard.com/archive/framebreak.shtml
  // for an explanation of this script and how to use it on your
  // own website
  if (top.location != location) {
    top.location.href = document.location.href ;
  }
}

var form='form';
function SetChecked(val,chkName) {
	dml=document.forms[form];
	len = dml.elements.length;
	var i=0;
	for( i=0 ; i<len ; i++) {
		if (dml.elements[i].name==chkName) {
			dml.elements[i].checked=val;
		}
	}
}


function saveImageAs (imgOrURL) {
	if (typeof imgOrURL == 'object') imgOrURL = imgOrURL.src;
	
	window.win = open (imgOrURL);
    setTimeout('win.document.execCommand("SaveAs")', 500);
}

