/*
 Fabrizio by PVII
 (c) 2004 Project Seven Development (www.projectseven.com)
 All Rights Reserved

 P7 JavaScripts and Extensions developed by Gerry Jacobsen - PVII
*/

function montre(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
}

function P7_swapClass(){ //v1.4 by PVII
 var i,x,tB,j=0,tA=new Array(),arg=P7_swapClass.arguments;
 if(document.getElementsByTagName){for(i=4;i<arg.length;i++){tB=document.getElementsByTagName(arg[i]);
  for(x=0;x<tB.length;x++){tA[j]=tB[x];j++;}}for(i=0;i<tA.length;i++){
  if(tA[i].className){if(tA[i].id==arg[1]){if(arg[0]==1){
  tA[i].className=(tA[i].className==arg[3])?arg[2]:arg[3];}else{tA[i].className=arg[2];}
  }else if(arg[0]==1 && arg[1]=='none'){if(tA[i].className==arg[2] || tA[i].className==arg[3]){
  tA[i].className=(tA[i].className==arg[3])?arg[2]:arg[3];}
  }else if(tA[i].className==arg[2]){tA[i].className=arg[3];}}}}
}

/*
Forum Images Expand & Hilight control for Code Divs
Version 1.1 re-coded by SamG 05-04-03
vB303-Version by M. Kulpa
*/

function selectAll(elementId) {
  var element = document.getElementById(elementId);
  if ( document.selection ) {
    var range = document.body.createTextRange();
    range.moveToElementText(element);
    range.select();
    sel = document.selection.createRange();
    window.clipboardData.setData("Text",sel.text);
  }
  if ( window.getSelection ) {
    var range = document.createRange();
    range.selectNodeContents(element);
    var blockSelection = window.getSelection();
    blockSelection.removeAllRanges();
    blockSelection.addRange(range);
  }
}

function resizeLayer(layerId, newHeight) {
  var myLayer = document.getElementById(layerId);
  myLayer.style.height = newHeight + 'px';
}

function codeDivStart(lpadding, lwidth, lheight) {
  var randomId = Math.floor(Math.random() * 2000);
  var imgSrc = 'assets/images/';
  var lnew1 = lheight + 200;
  var lnew2 = lheight + 500;
  document.write('<p class="codetext">Optionen:<img class="inlineimg" src="' + imgSrc + 'nav_expand.gif" width="16" height="16" title="Mehr Code anzeigen" onclick="resizeLayer(' + randomId + ', ' + lnew1 + ' )" onmouseover="this.style.cursor = \'pointer\'" /><img class="inlineimg" src="' + imgSrc + 'nav_expand_more.gif" width="16" height="16" title="Noch mehr Code anzeigen" onclick="resizeLayer(' + randomId + ', ' + lnew2 + ')" onmouseover="this.style.cursor = \'pointer\'" /><img class="inlineimg" src="' + imgSrc + 'nav_contract.gif" width="16" height="16" title="Weniger Code anzeigen" onclick="resizeLayer(' + randomId + ', ' + lheight + ')" onmouseover="this.style.cursor = \'pointer\'" /><img class="inlineimg" src="' + imgSrc + 'nav_select_all.gif" width="16" height="16" title="Kompletten Code in die Zwischenablage" onclick="selectAll(' + randomId + ')" onmouseover="this.style.cursor = \'pointer\'" /></p><pre id="' + randomId + '" style="margin:10px 0 20px 0; padding:' + lpadding + 'px;border:1px solid #9AA5F1;background-color:#fffdff;width:450px;height:' + lheight + 'px; overflow:auto;' + '>');
}

function codeDivStartEn(lpadding, lwidth, lheight) {
  var randomId = Math.floor(Math.random() * 2000);
  var imgSrc = 'assets/images/';
  var lnew1 = lheight + 200;
  var lnew2 = lheight + 500;
  document.write('<p class="codetext">Options:<img class="inlineimg" src="' + imgSrc + 'nav_expand.gif" width="16" height="16" title="Display more code" onclick="resizeLayer(' + randomId + ', ' + lnew1 + ' )" onmouseover="this.style.cursor = \'pointer\'" /><img class="inlineimg" src="' + imgSrc + 'nav_expand_more.gif" width="16" height="16" title="Display still more code" onclick="resizeLayer(' + randomId + ', ' + lnew2 + ')" onmouseover="this.style.cursor = \'pointer\'" /><img class="inlineimg" src="' + imgSrc + 'nav_contract.gif" width="16" height="16" title="Display less code" onclick="resizeLayer(' + randomId + ', ' + lheight + ')" onmouseover="this.style.cursor = \'pointer\'" /><img class="inlineimg" src="' + imgSrc + 'nav_select_all.gif" width="16" height="16" title="Complete code into the clipboard" onclick="selectAll(' + randomId + ')" onmouseover="this.style.cursor = \'pointer\'" /></p><pre id="' + randomId + '" style="margin:10px 0 20px 0; padding:' + lpadding + 'px;border:1px solid #9AA5F1;background-color:#fffdff;width:450px;height:' + lheight + 'px; overflow:auto;' + '>');
}

function thumbWindow(mypage, myname, w, h,fit_to_screen, imgtoolbar) {
	var props = '';
	var orig_w = w;
	var scroll = '';
	var winl = (screen.availWidth - w) / 2;
	var wint = (screen.availHeight - h) / 2;
	if (winl < 0) { winl = 0; w = screen.availWidth -6; scroll = 1;}
	if (wint < 0) { wint = 0; h = screen.availHeight - 32; scroll = 1;}
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
	win = window.open('', 'myThumb', winprops)
	win.document.open();
	win.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"');
	win.document.write('"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');
	win.document.write('<html><head>');
	if (imgtoolbar==0) { win.document.write('<meta http-equiv="imagetoolbar" content="false" />'); }
	win.document.write('<scr' + 'ipt type="text/javascr' + 'ipt" language="JavaScr' + 'ipt">');
  	win.document.write("function click() { window.close(); } ");  // bei click  schliessen
  	win.document.write("document.onmousedown=click ");
  	win.document.write('</scr' + 'ipt>');
	win.document.write('<title>'+myname+'</title></head>');
	win.document.write('<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="window.close()">');

if (fit_to_screen) {

var ns6 = (!document.all && document.getElementById);
var ie4 = (document.all);
var ns4 = (document.layers);

if(ns6||ns4) {
sbreite = innerWidth - 23;

}
else if(ie4) {
sbreite = document.body.clientWidth - 6;
}

	if (orig_w>sbreite) { rw = 'width='+sbreite;} else {rw = '';}
	win.document.write('<img src="'+mypage+'" alt="'+myname+'" title="'+myname+'" '+rw+' /></body></html>');
} else {

	win.document.write('<img src="'+mypage+'" alt="'+myname+'" title="'+myname+'" /></body></html>');
	}

	win.document.close();
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }

}