/**
 * Globale Javascripts
 *
 * For more information see: http://www.sylinx.de/
 *
 * @copyright   Copyright (C) SyLinx GmbH
 * @author      Lothar Jenisch <info@sylinx.de>
 * @version     $Id: global.js 2548 2009-11-24 12:58:54Z lothar $
 * @license     http://www.sylinx.de/license
 * @package     SyShop
 */

function Suche(strId)
{
	// Suchfeld ermitteln
	var oFeld = document.getElementById(strId);
	if (oFeld)
	{
		var strWert = oFeld.value;

		// leere Sucheingabe ?
		//alert(strWert);
		if (strWert != "")
		{
			return (true);
		}
	}

	return (false);
} // Suche

function FeldWertSetzen(strFeld, strWert)
{
	oFeld = document.getElementsByName(strFeld)[0];
	if (oFeld)
	{
		oFeld.value = strWert;
	}
	
} // FeldWertSetzen

function FeldWeiter(e, Quelle, Ziel, Laenge)
{
	if (!e) var e = window.event;

	// Keine Controlchars
	if (e.keyCode > 32)
	{
		if (Quelle.value.length == Laenge)
		{
			Ziel.focus();
		}
	}
		
} // FeldWeiter

function BildAendern(strId, strBild)
{
	// Bild ermitteln
	var oBild = document.getElementById(strId);

	// Bild ändern	
	oBild.src = strBild;

	return;
} // BildAendern

function openScreen(url, name, parameters)
{
	var screen = window.open(url, name, parameters);
	screen.focus();
	
	return false;
} // openScreen

function openWindow(url, name, width, height, scroll, resizable) 
{
	var win = null;
	
	// check args
	width = width || 800;
	height = height || 600;
	scroll = scroll || 'no'; 
	resizable = resizable || 'no';
	
    leftPos = (screen.width) ? (screen.width-width) / 2 : 0;
    topPos = (screen.height) ? (screen.height-height) / 2 : 0;
    specs = 'width='+width+',height='+height+',left='+leftPos+',top='+topPos+',scrollbars='+scroll+',resizable='+resizable;
    win = window.open(url, name, specs);
    
    return false;
}

/**
 * Radio Button anhand der id aktivieren
 * @param string id
 * @return void
 */
function activateRadioButton(id)
{
	var radio = document.getElementById(id);
	if (radio)
	{
		radio.checked = true;
	}

	return;
}
