function modelViewVersionPopup(targetUrl, width, height) {
	width = width + 40;
	height = height + 100;
	scrollbars = ''
	if (width > 800) {
		width = 800;
		scrollbars = ',scrollbars';
	}
	if (height > 600) {
		height = 600;
		scrollbars = ',scrollbars';
	}
	window.open(targetUrl, '', 'width='+width+',height='+height+',resizable'+scrollbars);
}

function setCookie(name, value, days, path, domain, secure) {
	var expires = new Date();
	var today = new Date();
	expires.setTime(today.getTime() + (1000*60*60*24*parseInt(days)));
	document.cookie = 
		name + "=" + value + "; expires=" + expires +
		((path == "") ? "" : ("; path=" + path)) +
		((domain == "") ? "" : ("; domain=" + domain)) +
		((secure == "secure") ? "; secure" : "");
}

function debug(msg) {
	alert(msg);
}

function toggleElementVisibility( id, next_msg ) {
  var elem
  var link
  if( document.getElementById ) {
    elem = document.getElementById( id )
    link = document.getElementById( "l_" + id )
  } else if ( document.all ) {
    elem = eval( "document.all." + id )
    link = eval( "document.all.l_" + id )
  } else
    return false;
  var msg = this.nextToggleMsg
  if (msg == null || typeof msg == 'undefined') {
	msg = next_msg
  }
  if( elem.style.display == "block" ) {
    elem.style.display = "none"
  } else {
    elem.style.display = "block"
  }	
  if (link != null && typeof link != 'undefined') {
  	this.nextToggleMsg = link.innerHTML
  	link.innerHTML = msg
  }
}
