var nclick_count=0;
if (top.frames.length>=3)
{
	document.onclick=htmlClick;
}

var lastIdx = 0;

function refreshAndOpenRightFrame(idx)
{
	// this is the adframe
	if (top.frames.length>=3)
	{
		var T2 = top.frames[1].document.getElementById("TabOpen");
		var T1 = top.frames[1].document.getElementById("TabClose");
		if(top.ssF !=null)
		{
			if (!top.fO) top.ssF();
			if (idx)
			{
				t_url="http://"+top.location.hostname+"/adv_page"+idx+".html";
				top.frames[2].location.href=t_url;
			} else
			{
				top.frames[2].location.reload();
			}
			
			T1.style.display = "none";
			T2.style.display = "block";
		}
	}
	
	/*if (top.frames['top_adv_cabanova_frame'])
	{
		var fr=top.frames['top_adv_cabanova_frame'];
		if(idx)
		{
			if(lastIdx != idx)
			{
				var a = (document.location+'').split('/');
				a.pop();
				a[a.length] = 'adv_page'+idx+'.html';
				fr.location = a.join('/');
			}
			lastIdx = idx;
		}
		else
			fr.location.reload();
	}*/
}

function navClick(t, idx)
{
	top.document.title=t;
	nclick_count++;
	if (nclick_count<2) return;

	refreshAndOpenRightFrame(idx);
}


function htmlClick(e)
{
	e=e||window.event;

	if (!e) return e; 
	
	var tgt=e.target||e.srcElement;

	if((e.shiftKey)||(e.ctrlKey)||(e.button>=2)){return e;}
	
	doReload=false;
	if ((tgt)&&(tgt.nodeName=="A")) doReload=true;
	if ((tgt.parentNode)&&(tgt.parentNode.nodeName=="A")) doReload=true;
	if ((tgt.parentNode.parentNode)&&(tgt.parentNode.parentNode.nodeName=="A")) doReload=true;
	if ((tgt.parentNode.parentNode.parentNode)&&(tgt.parentNode.parentNode.parentNode.nodeName=="A")) doReload=true;
	
	if (doReload) refreshAndOpenRightFrame();
}

function index_DoFSCommand(command, args)
{
	if(command == 'eval')
		eval(args);
}
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub index_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call index_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}

function showFlash(src, w, h, o, transparent)
{
	var a = [];
	for(var n in o)
	{
		a.push(escape(n)+'='+escape(o[n]));
	}
	var vars = a.join('&');

	str_wmode1 = '<param name="wmode" value="transparent">';
	str_wmode2 = 'wmode="transparent"';

	if(navigator.userAgent.indexOf("Firefox")!=-1)
	{
		var versionindex=navigator.userAgent.indexOf("Firefox")+8;
		if (parseInt(navigator.userAgent.charAt(versionindex))>=1)
		{
			//remove wmode parameter for mozilla firefox, problem with some keyboards with char @ (like british,german,french layout etc)
			//see http://www.headlondon.com/blog/index.php/archives/no-wmode-please-were-british/
			str_wmode1 = '';
			str_wmode2 = '';
		}
	}

	document.write('<object id="index" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+w+'" height="'+h+'">');
	document.write('<param name="movie" value="'+src+'" />');
	document.write('<param name="allowScriptAccess" value="always" />');
	document.write('<param name="FlashVars" value="'+vars+'" />');
	document.write('<param name="quality" value="high" />');
	document.write(str_wmode1);
	document.write('<param name="menu" value="false" />');
	document.write('<embed name="index" src="'+src+'" menu="false" quality=high pluginspage="http://www.macromedia.com/go/getflashplayer" FlashVars="'+vars+'" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'" allowScriptAccess="always"'+str_wmode2+'></embed>');
	document.write('</object>');
}
