function element(id) {
	return document.getElementById(id);
}

function insertFlash(id, width, height, bgcolor, alt, transparent) {

  var DEBUG_flashoff = false;

  transparent = (transparent != null && transparent == 'true') ? true : false;
  
  plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;

  if ( plugin ) {
    plugin = parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) >= 7;
  } else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
             && (navigator.userAgent.indexOf("Windows 95")>=0 
                 || navigator.userAgent.indexOf("Windows 98")>=0 
                 || navigator.userAgent.indexOf("Windows NT")>=0)) {
    document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
    document.write('on error resume next \n');
    document.write('plugin = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5")))\n');
    document.write('</SCR' + 'IPT\>');
  }
  if ((!DEBUG_flashoff) && (plugin) && ((navigator.userAgent.indexOf("MSIE")>=0) || (document.getElementById) || (document.layers))) {
    document.write('<object id="flashMovie" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width='+ width +' height='+ height +((transparent) ? ' wmode="Transparent"' : '')+'>');
    document.write('<param name="MOVIE" value="'+id+'">');
    document.write('<param name="QUALITY" value="HIGH">');
    document.write('<param name="BGCOLOR" value="'+bgcolor+'">');
    document.write('<param name="MENU" value="TRUE">');
    if (transparent) { document.write('<param name="WMODE" value="transparent">'); }
    document.write('<embed name="flashMovie" src="'+id+'" menu="TRUE" '+((transparent) ? 'wmode="Transparent" ' : '')+'quality="HIGH" bgcolor="'+ bgcolor +'" WIDTH="'+ width +'" HEIGHT="'+ height +'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>');    
    document.write('</object>');
    
  } else {
    document.write(alt);
  }
}

function selectMenuItem(section, subSection, contentItemId) {
	var frm = element("navigationForm");
	element("s").value = section;
	if (section == '1') {
		frm.action = "default.aspx";
		frm.method = "post";
	} else {
		element("ss").value = subSection;
		element("c").value = contentItemId;
	}
	frm.submit();
}

function DialogWindow(url) {

	this.Url = url;
	this.Name = null;
	this.Width = null;
	this.Height = null;
	this.Scroll = false;
	this.Status = false;
	this.Resizable = true;
	this.Toolbar = false;
	this.TryModal = false;
	this.WasModal = false;
	this.ReturnValue = null;
	
	this.CanShowModal = function()
	{
		return typeof(window.showModalDialog) == "object";
	}
	
	this.Show = function() {	
		if (this.TryModal && this.CanShowModal()) {			var iActHeight = this.Height + 40;
			this.ReturnValue = window.showModalDialog(this.Url, null, "dialogHeight: " + iActHeight + "px; dialogWidth: " + this.Width + "px; edge: Raised; center: Yes; help: No; resizable: " + YN(this.Resizable) + "; status: " + YN(this.Status) + "; scroll: " + YN(this.Scroll) + ";");
			this.WasModal = true;
		} else {
			var iLeft = (screen.availWidth-10 - this.Width) / 2;
			var iTop = (screen.availHeight-20 - this.Height) / 2;
			var oWin = window.open(this.Url, this.Name, "top=" + iTop + "px, left=" + iLeft + "px, height=" + this.Height + "px, width=" + this.Width + "px, scrollbars=" + YN(this.Scroll) + ", resizable=" + YN(this.Resizable) + ", status=" + YN(this.Status) + ", toolbar=" + YN(this.Toolbar) + ", fullscreen=No, location=No, menubar=No");
			//try { oWin.focus(); } catch(e) {}
		}
	}
}

function YN(bool) {
	return bool ? "yes" : "no";
}