function setMenu(URL)
{
	toframe();
//	alert(parent.frames[0].name);
	if(!setMenuFrame(parent, URL))
	{
		setMenuFrame(parent.parent, URL)
	}
	self.focus();
}
//------------------------------------------------------------------------------------------------
function setMenuFrame(searchfor, URL)
{
	for(i=0; i<searchfor.frames.length; i++)
	{
		frame = searchfor.frames[i];
		if(frame.name == 'Select')
		{
			frame.setMenu(URL);
//			alert(frame);
			return true;
		}
	}
	return false;
}
//------------------------------------------------------------------------------------------------
function toframe()
{
	if (this.location.href.indexOf(base+'index.php') == 0 ) return;
//	if (top.location.href.indexOf('die-violetten.de') > 0 ) return;
	if (this.location.href == top.location.href)
	{
		fname = this.location.href;
		//fname = fname.substr(0, fname.lastIndexOf('.'));
		if (fname.indexOf(base) >= 0) fname = fname.substr(base.length);
		if (fname.indexOf('/') == 0) fname = fname.substr(1);
//					alert(fname);
		if (fname.indexOf('htmdocs') >= 0)
		{
			fdir = fname.substr(0,fname.indexOf('htmdocs')+7);
			fname = fname.substr(fdir.length + 1);
			fdir = 'htmdocs';
			lang = fname.substr(0,fname.indexOf('/'));
			fname = fname.substr(lang.length+1);
			if (fname.indexOf('/') > 0)
			{
				subdir = fname.substr(0,fname.indexOf('/'));
				fname = fname.substr(subdir.length+1);
//			alert(subdir);
//			alert(fname);
			}
			else
			{
				top.location.href = base+"index.html";
				return;
			}
			relocation = base+"index.php?fdir="+fdir+"&lang="+lang+"&subdir="+subdir+"&fname="+fname;
//			alert(relocation);
			top.location.href = relocation;
		}
	
	/*
		if (this.location.href.indexOf('index.htm') < 0)
		{
			top.location.href = base+"index.html";
		}else{
			top.location.href = "../index.html";
		}
	*/
	}
}

function ShowPic(PicTitle,pic)
{
var width=screen.availWidth*0.9;
if(width > 750) width=750;
var height=screen.availHeight*0.9;
if(height > 750) height=750;
var opts = "Scrollbars=no,toolbar=no,status=no,menubar=no,location=no,rezisable=no,width="+width+",height="+height;
pic=pic+"_xl.jpg";
height-=20;
Imag=window.open("","Img",opts);
Imag.moveTo(10,10);
Imag.document.open("text/html");
Imag.document.write("<html><head><title>" +PicTitle + "</title></head>"
+ "<link href='"+ base +"format.css' rel=stylesheet type=text/css>"
+ "<body class='ImgWindow'><center><table cellpadding=0 cellspacing=0><tr><td><img src=" + imgbase + "empty.gif height="+ height +" width=1></td><td valign='middle'>"
+ "<a href='JavaScript:window.close()'><img src=" + imgbase + pic + " border=1 alt='close window'></a>"
+ "</td><td><img src=" + imgbase + "empty.gif height="+ height +" width=1></td></tr></table></center></body></html>");
Imag.document.close;
Imag.focus();
return;
}

function NewWin(URL)
{
var width=screen.availWidth*0.9;
if(width > 750) width=750;
var height=screen.availHeight*0.9;
if(height > 750) height=750;
	if(height<screen.availHeight && width<screen.availWidth)
	{
		options="status=no,location=no,menubar=no,directories=no,scrollbars=no,height="+height+",width="+width;
	}else{
		options="status=no,location=no,menubar=no,directories=no,scrollbars=yes,height="+height+",width="+width;
	}
	window.open(URL,'Fensterl',options);
	return;
}

vis = new Array("hidden","visible");
function show(which,mod)
{
	itm = document.getElementById(which);
	itm.style.visibility = vis[mod];
return;
	if (document.all)
	{
	eval("document.all."+which+".style.visibility='"+vis[mod]+"'");
	}else{
	eval("document."+which+".visibility='"+vis[mod]+"'");
	}
return;
}

function activate(btn)
{
	ShowButton(btn,1)
}

function deactivate(btn)
{
	ShowButton(btn,0)
}
function ShowButton(btn,evt)
{
if(InitFlag){
	if(evt==0)
	{
		for(i=0; i < bCount; i++)
		if (btn==ButtonNames[i])
		{
			if(ButtonStatus==i)
			{
				document.images[Buttons[i]].src=ButtonOn.src;
			}
			else
			{
				document.images[Buttons[i]].src=ButtonOff.src;
			}
		}
	}
	else
	{
		for(i=0;i<bCount;i++)
		if (btn==ButtonNames[i])
		{
			document.images[Buttons[i]].src=ButtonOn.src;
		}
	}
}
}

function ChangeButton(btn)
{
if(InitFlag){
	for(i=0;i<bCount;i++)
	if(btn==ButtonNames[i])
	{
		document.images[Buttons[i]].src=ButtonOn.src;
		ButtonStatus=i;
	}else{
		document.images[Buttons[i]].src=ButtonOff.src;
	}
}
}
//-----------------------------------------------------------------------------------
function mailto(dvmail)
{
	document.location.href =  "mailto:" + dvmail + "@die-violetten.de";
}
//----------------------------------------------------------------------------------------------
function print_doc(doc)
{
	//doc.blur();
	//alert(doc.frames.length);
	doc.print();
	doc.focus();
}

//----------------------------------------------------------------------------------------------
function schreibe_verlinkungslink() {
	if(window.external) {
		with(document) {
			open("text/html");
			write("<A class=\"setlink\" HREF=\"javascript:window.external.AddFavorite(\'http://www.die-violetten.de/\', \'Die Violetten - für spirituelle Politik\')\" title=\"Bitte klicken Sie hier um die Startseite von www.die-violetten.de Ihren Lesezeichen hinzuzuf&uuml;gen.\">Bookmark</A>");
			write(" | ");
			write("<A class=\"setlink\" HREF=\"javascript:window.external.AddFavorite(location.href, document.title)\" title=\"Bitte klicken Sie hier, um speziell diese Unterseite Ihren Lesezeichen hinzuzuf&uuml;gen.\">Lesezeichen setzen</A>");
			write(" | ");
			write("<a class=\"setlink\" href=\"javascript:mailto('?subject=Hallo%20-%20habe%20eine%20interessante%20Webseite%20gefunden&amp;body=" + window.location.href + "\" title=\"Zeige deinen Freunden diese Seite per email (funktioniert nur bei korrekt installiertem email client)\">tell a friend</a>");
			write(" | ");
			close();
		}
	}
	Verlinkungs_Datei = base + "htmdocs/violett_verlinken.php" ;
	Aktuelle_Url = window.location.href ;
	Aktuelle_Url = Aktuelle_Url.substr(0,127);
	Aktuelle_Url = Aktuelle_Url.replace(/&/g,":und:") ;
	Aktuelle_Url = Aktuelle_Url.replace(/\?/g,":frage:") ;
	Aktuelle_Url = Aktuelle_Url.replace(/ /g,"%20") ;
	Aktuelle_Url = Aktuelle_Url.replace(/=/g,":ist:") ;
	Aktuelle_Url = Aktuelle_Url.replace(/#/g,":raute:") ;
	Titel = document.title ;
	Titel = Titel.substr(0,127);
	Titel = Titel.replace(/'/g," ") ;
	Titel = Titel.replace(/"/g," ") ;
	Titel_x = Titel.replace(/&/g,":und:") ;
	Titel_x = Titel_x.replace(/\?/g,":frage:") ;
	Titel_x = Titel_x.replace(/ /g,"%20") ;
	Titel_x = Titel_x.replace(/=/g,":ist:") ;
	test_Url = Aktuelle_Url.substr(0,Verlinkungs_Datei.length);
	Aktuelle_Url = Verlinkungs_Datei + "?Url=" + Aktuelle_Url + "&Titel=" + Titel_x ;
	if (Aktuelle_Url.match(/["']/g)) { Aktuelle_Url = Verlinkungs_Datei ; }
	if (test_Url!=Verlinkungs_Datei) {
		with(document) {
			open("text/html");
			write("<a class=\"setlink\" HREF=\"" + Aktuelle_Url + "\"  title=\"Bitte klicken Sie hier um diese Seite zu verlinken. (" + Titel + ")\">verlinken</a>");
			write('<a class="print" href="JavaScript:print_doc(this);"><img src="' + base + 'images/druck.gif" class="print" alt="Ausdrucken"></a>');
			write('<a href="#top"><img class="totop" src="' + base + 'images/back.gif" alt="Zum Seitenanfang"></a>');
			close();
		}
	}
}
