
function toggle(id)
{
	var elem = document.getElementById(id);
	if(elem)
	{
		elem.style.display = (elem.style.display == 'none') ? '' : 'none';
	}
}

function ts(id)
{
	var control = document.getElementById('ts_control_' + id);
	if(document.getElementById('ts_'+id).style.display == 'none')
	{
		control.className = 'ts_control_active';
	}
	else
	{
		control.className = 'ts_control';
	}
	toggle('ts_'+id);
	return false;
}


function product_bloc(id)
{
	klappe(id);
	toggle('item_control_' + id);
	toggle('product_desc_short_' + id);
	toggle('product_desc_' + id);
	document.getElementById('ts_' + id).style.display = 'none';

	return false;
}


function klappe_is_open(id)
{
  var klappBlock = document.getElementById('prod' + id);
  var c = klappBlock.className;
  return (c.indexOf("items_block_open") != -1);
}

function klappe(id)
{
	var klappBlock = document.getElementById('prod' + id);
  var klappText = document.getElementById('t' + id);
	var klappBild = document.getElementById('k' + id);
	if (klappText.style.display == 'none')
  {
    if (klappBlock)
    {
      klappBlock.setAttribute('class', 'items_block items_block_open');
      klappBlock.setAttribute('className', 'items_block items_block_open');
    }
    
		klappText.style.display = 'block';
		if (klappBild)
		  klappBild.innerHTML = '&ndash;';
	} else {
		if (klappBlock)
		{
      klappBlock.setAttribute('class', 'items_block');
      klappBlock.setAttribute('className', 'items_block');
    }
    
    klappText.style.display = 'none';
		if (klappBild)
		  klappBild.innerHTML = '+';
	}
}
function ferme(id)
{
	var fermeBild = document.getElementById('img' + id);
	if (fermeBild.style.visibility == 'hidden')
  {
		fermeBild.style.visibility = 'visible';
	} else {
		fermeBild.style.visibility = 'hidden';
	}
}
function showPopup(event, src, width)
{
  var fermeBlock = document.getElementById('popup_img');
  
  fermeBlock.src = src;
  fermeBlock.style.display = 'block';
  fermeBlock.style.width = width+'px';
  fermeBlock.style.marginLeft = (200-width)/2+'px';

  var elem = document.getElementById('divLeftBlock');
  if(elem)
  {
	  elem.style.display = 'none';
  }
  
  if (window.event) {
    window.event.cancelBubble = true;
  }
  else
  {
    event.stopPropagation();
  }
}
function hidePopup()
{
  var fermeBlock = document.getElementById('popup_img');
  fermeBlock.style.display = 'none';

  var elem = document.getElementById('divLeftBlock');
  if(elem)
  {
	  elem.style.display = '';
  }
}
function updateJSON(request, json)
{
  var nbElementsInResponse = json.length;
  for (var i = 0; i < nbElementsInResponse; i++)
  {
     Element.update(json[i][0], json[i][1]);
  }
}
function stopPropagation(event)
{
  if (window.event) {
    window.event.cancelBubble = true;
  }
  else
  {
    event.stopPropagation();
  }
}

/*************************************************************\
 *	DYNIFS - Dynamic IFrame Auto Size v1.0.0
 *
 *	Copyright (C) 2006, Markus (phpMiX)
 *	This script is released under GPL License.
 *	Feel free to use this script (or part of it) wherever you need
 *	it ...but please, give credit to original author. Thank you. :-)
 *	We will also appreciate any links you could give us.
 *	http://www.phpmix.org
 *
 *	Enjoy! ;-)
\*************************************************************/

//var DYNIFS = {
//	// Storage for known IFrames.
//	iframes: {},
//	// Here we save any previously installed onresize handler.
//	oldresize: null,
//	// Flag that tell us if we have already installed our onresize handler.
//	ready: false,
//	// The document dimensions last time onresize was executed.
//	dim: [-1,-1],
//	// Timer ID used to defer the actual resize action.
//	timerID: 0,
//	// Obtain the dimensions (width,height) of the given document.
//	getDim: function(d) {
//		var w=200, h=0, scr_h, off_h;
//		if( d.height ) { return [d.width,d.height]; }
//		with( d.body ) {
//			if( scrollHeight ) { h=scr_h=scrollHeight; w=scrollWidth; }
//			if( offsetHeight ) { h=off_h=offsetHeight; w=offsetWidth; }
//			if( scr_h && off_h ) h=Math.max(scr_h, off_h);
//		}
//		return [w,h];
//	},
//	// This is our window.onresize handler.
//	onresize: function() {
//		// Invoke any previously installed onresize handler.
//		if( typeof this.oldresize == 'function' ) { this.oldresize(); }
//		// Check if the document dimensions really changed.
//		var dim = this.getDim(document);
//		if( this.dim[0] == dim[0] && this.dim[1] == dim[1] ) return;
//		// Defer the resize action to prevent endless loop in quirksmode.
//		if( this.timerID ) return;
//		this.timerID = setTimeout('DYNIFS.deferred_resize();', 10);
//	},
//	// This is where the actual IFrame resize is invoked.
//	deferred_resize: function() {
//		// Walk the list of known IFrames to see if they need to be resized.
//		for( var id in this.iframes ) this.resize(id);
//		// Store resulting document dimensions.
//		this.dim = this.getDim(document);
//		// Clear the timer flag.
//		this.timerID = 0;
//	},
//	// This is invoked when the IFrame is loaded or when the main window is resized.
//	resize: function(id) {
//
//		// Browser compatibility check.
//		if( !window.frames || !window.frames[id] || !document.getElementById || !document.body )
//			return;
//
//      // Get references to the IFrame window and layer.
//		var iframe = window.frames[id];
//      if(!iframe) return;
//      var div = document.getElementById(id);
//		if( !div ) return;
//		// Save the IFrame id for later use in our onresize handler.
//		if( !this.iframes[id] ) {
//			this.iframes[id] = true;
//		}
//
//		// Should we inject our onresize event handler?
//		if( !this.ready ) {
//			this.ready = true;
//			this.oldresize = window.onresize;
//			window.onresize = new Function('DYNIFS.onresize();');
//		}
//		// This appears to be necessary in MSIE to compute the height
//		// when the IFrame'd document is in quirksmode.
//		// OTOH, it doesn't seem to break anything in standards mode, so...
//		//if( document.all ) div.style.height = '0px';
//		// Resize the IFrame container.
//		var dim = this.getDim(iframe.document);
//		div.style.height = (dim[1]+30) + 'px';
//	}
//};

//setInterval(function(){ DYNIFS.resize('frame'); }, 1300);
