var template_runOnLoad = new Array();
var g_oResBANNER1and2 = new ResourceInfo(new Size(533, 87), 'images/noFlash_Banner1.gif');
var g_oResBANNER1 = g_oResBANNER1and2;
var g_oResBANNER2 = g_oResBANNER1and2;
var g_oResBANNER3 = new ResourceInfo(new Size(297, 60), 'images/noFlash_Banner3.gif');
var g_oResCOMMS = new ResourceInfo(new Size(142, 60), 'images/noFlash_Comms.gif');
var g_oResCOMMS1 = g_oResCOMMS;
var g_oResCOMMS2 = g_oResCOMMS;
var g_oResCOMMS3 = g_oResCOMMS;

function changeCulture(culture) {
    if (culture == "en") {
        Delete_Cookie(COOKIE_CULTURE, '/', '');
    } else {
        Set_Cookie(COOKIE_CULTURE, culture, '', '/', '', '' );
    }
    location.href = location.href;
}

function doHelpWin(id) {
	var oDlg = new DialogWindow(g_sRoot + 'help/help.aspx?id='+id);
	oDlg.Name = "TOTEHelp";
	oDlg.Width = Math.floor(window.screen.width * 0.7);
	oDlg.Height = Math.floor(window.screen.height * 0.6);
	oDlg.Scroll = true;
	oDlg.Status = false;
	oDlg.Resizable = true;
	oDlg.TryModal = false;
	oDlg.RequiresLogin = false;
	oDlg.Show();
	return false;
}

function getUrlFromRoot(url) {
	return g_sRoot + url;
}

function insertFlash(source, resInfo, linkUrl, linkNewWindow) {
  var DEBUG_flashoff = false;
  
  plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
  
  var html = "";
    
  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))) {
    html += '<object id="flashMovie" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width='+ resInfo.Size.Width +' height='+ resInfo.Size.Height +(resInfo.Transparent ? ' wmode="Transparent"' : '')+'>';
    html += '<param name="MOVIE" value="'+source+'">';
    html += '<param name="QUALITY" value="HIGH">';
    html += '<param name="BGCOLOR" value="'+resInfo.BgColor+'">';
    html += '<param name="MENU" value="TRUE">';
    if (resInfo.Transparent) { html += '<param name="WMODE" value="transparent">'; }
    if (linkUrl.length > 0) {
		html += '<param name="LINKTOURL" value="' + linkUrl + '">';
	    if (linkNewWindow == 'yes') html += '<param name="LINKEXTERNAL" value="TRUE">';
	}
    
    html += '<embed name="flashMovie"';
    html += ' src="' + source + '"';
    html += ' menu="TRUE"';
    if (resInfo.Transparent) html += ' wmode="Transparent"';
    if (linkUrl.length > 0) {
		html += ' LINKTOURL="' + linkUrl + '"';
	    if (linkNewWindow == 'yes') html += ' LINKEXTERNAL="TRUE"';
	}
    html += ' quality="HIGH"';
    html += ' bgcolor="'+ resInfo.BgColor +'"';
    html += ' WIDTH="'+ resInfo.Size.Width + '"';
    html += ' HEIGHT="'+ resInfo.Size.Height +'"';
    html += ' type="application/x-shockwave-flash"';
    html += ' pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">';
    html += '</embed>';    
    
    html += '</object>';
  } else {
  
	if (linkUrl.length > 0) {
		html += '<a href="' + linkUrl + '"';
		if (linkNewWindow == 'yes') {
			html += ' target="_blank"';
		}
		html += '> \n';
	}
	
	html += '<img src="' + resInfo.NoFlashImage + '" width="' + resInfo.Size.Width + '" height="' + resInfo.Size.Height + '" alt="" />';
	
	if (linkUrl.length > 0) {
		html += '</a> \n';
	}
	
  }
  
  //alert(html);
  document.write(html);
}

function openFormWindow(url) {
	var oDlg = new DialogWindow(url);
	oDlg.Height = 410;
	oDlg.Width = 790;
	oDlg.Scroll = true;
	oDlg.Status = false;
	oDlg.RequiresLogin = false;
	oDlg.Resizable = true;
	oDlg.Toolbar = true;
	oDlg.TryModal = false;
	oDlg.Show();
}

function ResourceInfo(size, noFlashImage) {
	this.Size = size;
	this.NoFlashImage = noFlashImage;
	this.Transparent = false;
	this.BgColor = '#ffffff';
}

function showTips(state) {
	var d = new DialogWindow("tips.aspx?state=" + state);
	d.RequiresLogin = false;
	d.Scroll = true;
	d.Width = 330;
	d.Height = 385;
	d.Show();
}

function Size(width, height) {
	this.Width = width;
	this.Height = height;
}


function template_addToRunOnLoad(code) {
	template_runOnLoad[template_runOnLoad.length] = code;
}

function template_onPageLoad() {
	var run = template_runOnLoad;
	
	var runCount = run.length;
	for (var i=0; i<runCount; ++i) eval(run[i]);
}

function toggleWhatIsThis() {
	var oStyle = document.getElementById("whatIsThis").style;
	oStyle.display = oStyle.display == "none" ? "block" : "none";
}