window.onerror = null;
var topMargin = 168;
var slideTime = 1200;
var ie5  = (document.all && document.getElementById);
var ns6 = (!document.all && document.getElementById);
var ie4 = (document.all);
var ns4 = (document.layers);
function layerObject(id,left) {
if (ns6) {
this.obj = document.getElementById(id).style;
this.obj.left = left;
return this.obj;
}
else if(ie4) {
this.obj = document.all[id].style;
this.obj.left = left;
return this.obj;
}
else if(ns4) {
this.obj = document.layers[id];
this.obj.left = left;
return this.obj;
   }
}
function layerSetup() {
floatLyr = new layerObject('floatLayer', 767);
window.setInterval("main()", 10)
}
function floatObject() {
if (ns4 || ns6) {
findHt = window.innerHeight;
} else if(ie4) {
findHt = document.body.clientHeight;
   }
} 
function main() {
if (ns4) {
this.currentY = document.layers["floatLayer"].top;
this.scrollTop = window.pageYOffset;
mainTrigger();
}
else if(ns6) {
this.currentY = parseInt(document.getElementById('floatLayer').style.top);
this.scrollTop = scrollY;
mainTrigger();
} else if(ie4) {
this.currentY = floatLayer.style.pixelTop;
this.scrollTop = document.body.scrollTop;
mainTrigger();
   }
}
function mainTrigger() {

  if (this.scrollTop<document.body['clientHeight'])
  {
   var newTargetY = 168;  // this.topMargin;  
  }
  else
  {
    var newTargetY = this.scrollTop;	 
  }
 
//neue werte setzen 
if ( this.currentY != newTargetY ) {
if ( newTargetY != this.targetY ) {
this.targetY = newTargetY;
floatStart();
}
animator();
   }
}
function floatStart() {
var now = new Date();
this.A = this.targetY - this.currentY;
this.B = Math.PI / ( 2 * this.slideTime );
this.C = now.getTime();
if (Math.abs(this.A) > this.findHt) {
this.D = this.A > 0 ? this.targetY - this.findHt : this.targetY + this.findHt;
this.A = this.A > 0 ? this.findHt : -this.findHt;
}
else {
this.D = this.currentY;
   }
}

function animator() {
var now = new Date();
var newY = this.A * Math.sin( this.B * ( now.getTime() - this.C ) ) + this.D;
newY = Math.round(newY);
if (( this.A > 0 && newY > this.currentY ) || ( this.A < 0 && newY < 

this.currentY )) {
if ( ie4 )document.all.floatLayer.style.pixelTop = newY;
if ( ns4 )document.layers["floatLayer"].top = newY;
if ( ns6 )document.getElementById('floatLayer').style.top = newY + "px";
   }
}


function start() {
if(ns6||ns4) {
pageWidth = innerWidth;
pageHeight = innerHeight;
layerSetup();
floatObject();
}
else if(ie4) {
pageWidth = document.body.clientWidth;
pageHeight = document.body.clientHeight;
layerSetup();
floatObject();
   }
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

var oldposx,oldposy 
function dropshadow(object, col, ofx, ofy)
{
	object.position
	//object.style.filter="dropshadow(Color=#"+col+", offx="+ofx+", offy="+ofy+", positive=1);"
	object.style.border = "1px solid #6699CC";

}
function noshadow(object)
{
	object.style.filter=false
	object.style.border="0px";

}
function getheight()
{
	return document.innerHeight;
}

function OpenWindow(Datei)
    {
      URL=Datei;
      var fenster=window.open(URL,Datei,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,screenX=20,screenY=20,width=600,height=440');
     /* if(navigator.appName.substring(0,8)=="Netscape" )
      {
        fenster.location=URL;
      }*/
    }

//Fotowindow Öffnen und bei Klick wieder schließen...

// stellt die Bildschirmabmessungen fest
function dimension() {
var ns6 = (!document.all && document.getElementById);
var ie4 = (document.all);
var ns4 = (document.layers);
if(ns6||ns4) {
breite = innerWidth;
hoehe = innerHeight;
}
else if(ie4) {
breite = document.body.clientWidth;
hoehe = document.body.clientHeight;
}
return
}


// Fensterposition x-pos y-pos
// uebergabe url , breite , hoehe
// aufruf: <a href="javascript: popwin5('dateiname.htm','700','450')">link</a>
function popwin5(url,w,h) {
dimension()

x=(breite - w)-40 ;
y=(hoehe - hoehe) +40

popUp=window.open(url,'win5','width='+ w +',height='+ h +',left=' + x +',top='+ y +',directories=0,status=0,scrollbars=1,resizable=0,menubar=1,locationbar=0')
}




// www.web-toolbox.net , W. Jansen
// Als Übergabeparameter wird die bildquelle,breite und höhe übergeben
function FotoWindow(bildurl,bildurl2,b,h)
{
var eigenschaft,sbreite,shoehe,fenster,b,h;

// stellt die Bildschirmabmessungen fest
var ns6 = (!document.all && document.getElementById);
var ie4 = (document.all);
var ns4 = (document.layers);

if(ns6||ns4) {
sbreite = innerWidth;
shoehe = innerHeight;
}
else if(ie4) {
sbreite = document.body.clientWidth;
shoehe = document.body.clientHeight;
}

x = (sbreite-b)/2;
y = (shoehe-h)/2;

eigenschaften="left="+x+",top="+y+",screenX="+x+",screenY="+y+",width="+b+",height="+h+",menubar=no,toolbar=no, scrollbar=yes";
fenster=window.open("","",eigenschaften);
fenster.focus();
fenster.document.open();

with (fenster) {
  document.write('<html><head>');
  document.write('<title>schmuckkommo.de - Artikelbild</title></head>');
  document.write('<link href="Fonts/styles.css" rel="stylesheet" type="text/css">');
  document.write('<body  '); // bei Focusverlust schliessen
  document.write('marginwidth="0" marginheight="0" leftmargin="0" scroll="yes" topmargin="0">');
  document.write('<table border="0" cellspacing="0" cellpadding="0"><tr><td style="border-right:1px solid #CCCCCC">'); 
  document.write('<center>');
  document.write('<img src="'+ bildurl +'"border="0">');
  document.write('<center></td>');
  if (!(bildurl2=='-1'))
  {
	document.write('<td >');
  	document.write('<center>');
  	document.write('<img src="'+ bildurl2 +'"border="0">');
  	document.write('<center>');
	document.write('</td>');
  }
  document.write('</tr></table></body></html>');
  fenster.document.close();
}
}

function newswindow(newsid)
{
	var eigenschaft,sbreite,shoehe,fenster,b,h;
	
	// stellt die Bildschirmabmessungen fest
	var ns6 = (!document.all && document.getElementById);
	var ie4 = (document.all);
	var ns4 = (document.layers);
	var documenthome = "http://www.ec-soft.de/tbv/";
	if(ns6||ns4) {
	sbreite = innerWidth;
	shoehe = innerHeight;
	}
	else if(ie4) {
	sbreite = document.body.clientWidth;
	shoehe = document.body.clientHeight;
	}
	
	x = (sbreite-b)/2;
	y = (shoehe-h)/2;
	
	eigenschaften="left="+x+",top="+y+",screenX="+x+",screenY="+y+",width="+b+",height="+h+",menubar=no,toolbar=no, scrollbar=yes";
	fenster=window.open("","",eigenschaften);
	fenster.focus();
	fenster.document.open();
	
	with (fenster) {
		document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">');
		document.write('<html>');
		document.write('<head>');
		document.write('<title>TBV - NEWS</title>');
		document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
		document.write('<link href="'+documenthome+'fonts/styles.css" rel="stylesheet" type="text/css">');
		document.write('<link href="'+documenthome+'fonts/navigation.css" rel="stylesheet" type="text/css">');
		document.write('</head>');
		document.write('<body>');
		document.write('<table width="100%"  border="0" cellspacing="0" cellpadding="0">');
		document.write('  <tr>');
		document.write('	<td width="5%">&nbsp;</td>');
		document.write('	<td width="*" class="boxtitle">Hier kommt die &Uuml;berschrift hin </td>');
		document.write('	<td width="5%">&nbsp;</td>');
		document.write('  </tr>');
		document.write('  <tr>');
		document.write('	<td>&nbsp;</td>');
		document.write('	<td>&nbsp;</td>');
		document.write('	<td>&nbsp;</td>');
  	 	document.write(' </tr>');
		  document.write('<tr>');
			document.write('<td>&nbsp;</td>');
			document.write('<td>Hier folgt die 2. &Uuml;berschrift </td>');
			document.write('<td>&nbsp;</td>');
		  document.write('</tr>');
		  document.write('<tr>');
			document.write('<td>&nbsp;</td>');
			document.write('<td class="textnormal"><img src="file:///C|/Eigene%20Dateien/Webseiten/TBV-Boxen/images/zbik.jpg" width="60" height="67" hspace="10" vspace="5" align="left">Direkt gefolgt von dem text Direkt gefolgt von dem textDirekt gefolgt von dem textDirekt gefolgt von dem textDirekt gefolgt von dem textDirekt gefolgt von dem textDirekt gefolgt von dem textDirekt gefolgt von dem textDirekt gefolgt von dem textDirekt gefolgt von dem textDirekt gefolgt von dem textDirekt gefolgt von dem textDirekt gefolgt von dem textDirekt gefolgt von dem textDirekt gefolgt von dem textDirekt gefolgt von dem text</td>');
			document.write('<td>&nbsp;</td>');
		  document.write('</tr>');
		  document.write('<tr>');
			document.write('<td>&nbsp;</td>');
			document.write('<td>&nbsp;</td>');
			document.write('<td>&nbsp;</td>');
		  document.write('</tr>');
		  document.write('<tr>');
			document.write('<td>&nbsp;</td>');
			document.write('<td><input onClick="window.close();" type="button" name="Submit" value="Fenster schliessen"></td>');
			document.write('<td>&nbsp;</td>');
		  document.write('</tr>');
		document.write('</table>');
		document.write('</body>');
		document.write('</html>');
	}
}



function ViewImage(ifile,ix,iy,ititle) {
var win;
var sWidth;
var sHeight;
var NS = (document.layers) ? 1 : 0;
win = window.open("","imageviewer","width="+ix+",height="+iy+",menubar=no,toolbar=no");
   if (NS) {
   sWidth = win.innerWidth;
   sHeight = win.innerHeight;
   } else {
   sWidth = win.document.body.clientWidth;
   sHeight = win.document.body.clientHeight;
   }
   if(sWidth!=ix || sHeight!=iy) {
   win.close();
   setTimeout("ViewImage('"+ifile+"',"+ix+","+iy+",'"+ititle+"')", 400);
   return;
   }
win.document.open();
win.document.write("<html><head><title>"+ititle+"</title>");
win.document.write("</head><body>");
win.document.write('<div style="position:absolute;width:'+ix+'px;height:'+iy+'px;left:0px;top:0px">');
win.document.write("<img src="+ifile+"></div></body></html>");
win.document.close();
}


function quelltext() {
window.location = 'view-source:' + window.location.href;
return
}

function quelltext2(datei) {
window.location = 'view-source:' + datei;
return
}


function printWindow() {
Browser = parseInt(navigator.appVersion);
if (Browser >= 4) window.print();
}


function openPHPWin(phpdatei,name,b,h)
{
var eigenschaft,sbreite,shoehe,fenster,b,h;

// stellt die Bildschirmabmessungen fest
var ns6 = (!document.all && document.getElementById);
var ie4 = (document.all);
var ns4 = (document.layers);

if(ns6||ns4) {
sbreite = innerWidth;
shoehe = innerHeight;
}
else if(ie4) {
sbreite = document.body.clientWidth;
shoehe = document.body.clientHeight;
}

x = (sbreite-b)/2;
y = (shoehe-h)/2;

eigenschaften="left="+x+",top="+y+",screenX="+x+",screenY="+y+",width="+b+",height="+h+",menubar=yes,toolbar=no, resizable = no, scrollbars = yes, fullscreen = no";
//newWin = window.open(phpdatei,name,eigenschaften);
if (newwin) {newwin.close();}
var newwin = window.open(phpdatei,name,eigenschaften);
//tipWin.opener = self;
 newwin.focus();
 newwin.bringtofront();
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}



function printrechnung(){
	openPHPwin('/PHP/rechnung.php','Bestellschein','1024','768');
	window.print()
}



nOpac=0; 
direction = 0; 
function FadeIn(){
	 if(ie4) document.all['sc'].style.filter = "Alpha(Opacity="+nOpac+")";
	 //document.all["sc"].filters.alpha.opacity = nOpac;
	// if(ns6) document.getElementById("sc").style.MozOpacity = nOpac + '%';
	 if (direction < 1)
	 {
	 	if (nOpac>=99) {direction = 1}
	 	nOpac+=1
	 	setTimeout("FadeIn()",30)
	 }
	 else
	 {
		if (nOpac<=1) {direction = 0}
   	 	nOpac-=1
	 	setTimeout("FadeIn()",30)
	 }
	
}

function adaptwindow()
{
			  //Fenstergröße dynamisch anpassen
			  var minHeight = 500;
			  var centerHeight = document.getElementById("zentrallayer").offsetHeight;
			  var bodyHeight = centerHeight + document.getElementById("zentrallayer").offsetTop + 100;
			  if (minHeight >  bodyHeight) {bodyHeight=minHeight;};
			  
			  document.body.style.height = String(bodyHeight)+"px";
			  document.getElementById("Menulayer").style.height=String(bodyHeight)+"px";
			  document.getElementById("vlines").style.height=String(bodyHeight)+"px";
			  
			  //unteres Menu Plazieren...
			  document.getElementById("bottomMenu").style.top=String(bodyHeight-90)+"px";	
}


function checkAdminartikel()
{
	var form = document.forms["adminform"]; 
    for(var i = 0; i < form.elements.length; i++) 
    if((form.elements[i].value == "")&&(form.elements[i].id!="bild")) { 
      alert("Bitte füllen Sie das Feld " + (i+1) + " aus."); 
      return false; 
    } 
 	document.getElementById("adminform").submit();  
	return true; 

	
	
}

function gowin(p)
		{
			w = window.open(p, 'Objekt', config='width=600,height=400,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no');
			w.focus();
		}

//-->
