/*<![CDATA[*/
/**
 * functions.js - Bibliothek mit uebergreifenden JavaScript Funktionen
 *
 * Copyright (c) 2008    die.interaktiven GmbH & Co. KG
 *                       Agentur für digitale Medien
 *                       Eisenmarkt 1
 *                       35578 Wetzlar
 *                       Germany
 *
 *                       Fon: +49 (0)64 41 / 39 86 19 - 0
 *                       Fax: +49 (0)64 41 / 39 86 19 - 9
 *                       Web: www.die-interaktiven.de
 *
 * Alle Rechte vorbehalten. Unberechtigte Kopie und Weiter-
 * verwendung nicht gestattet.
 *
 */

var DOCUMENT_ROOT = '/';

function doStart()
{
	if(window.location.search.indexOf('druck') != -1)
	{
		setStyle('druck');
	}
	
	prepareQsearch();
	
	setStatus('Maerzhaeuser Wetzlar GmbH & Co. KG');
}

function setStatus(sText)
{
	try
	{
		if(!sText) sText = '';
		window.status = sText;
		return true;
	}
	catch(e)
	{
		void(0);
	}
}

function showPopup(sUrl, sName, iBreite, iHoehe, sFeatures, iPosx, iPosy)
{
	try
	{
		var oWin = window.open(sUrl, sName,"width=" + iBreite + ",height=" + iHoehe + "," + sFeatures + "");
		
		if(oWin)
		{
			if(!iPosx)
			{
				x = (screen.width-iBreite)/2;
			}
			else
			{
				x = iPosx;
			}
			
			if(!iPosy)
			{
				y=(screen.height-iHoehe)/2;
			}
			else
			{
				y = iPosy;
			}
			
			oWin.moveTo(x,y);
			
			oWin.focus();
		}
	}
	catch(e)
	{
		void(0);
	}
}

function prepareQsearch()
{
	try
	{
		document.getElementById('sword').onfocus = function() { 
			if(this.value == 'Suchbegriff eingeben') this.value = ''; 
			if(this.value == 'Enter searchterm') this.value = ''; 

		};
	
		document.getElementById('sword').onblur = function() { 
			if(this.value == '' && location.href.indexOf('/en/') == 0) this.value = 'Suchbegriff eingeben'; 
			if(this.value == '') this.value = 'Enter searchterm';
		};



	}
	catch(e)
	{
		void(0);
	}
}

function printPage()
{
	window.print();
}

function checkPimQsearch(oForm)
{
	return true;
}

function getMicroscopes(oManufacturerField, sMicroscopeField)
{
	document.forms['pimsearch'].submit();
}

function resetFontsizeImage()
{

	var sImgname = '';
	var sImgpath = '';
	
	sImgname = 'schrift-normal';
	sImgpath = 'fileadmin/mhwetzlar/images/klein-ia.gif';
	document.getElementById(sImgname).src = sImgpath;

	sImgname = 'schrift-mittel';
	sImgpath = 'fileadmin/mhwetzlar/images/mittel-ia.gif';
	document.getElementById(sImgname).src = sImgpath;

	sImgname = 'schrift-gross';
	sImgpath = 'fileadmin/mhwetzlar/images/gross-ia.gif';
	document.getElementById(sImgname).src = sImgpath;
}

function setFontsizeImage(sSize)
{
	resetFontsizeImage();

	var sImgname = '';
	var sImgpath = '';

	if(!sSize)
	{
		var iSize = efa_fontSize.getPref();
		
		if(iSize <= 101)
		{
			sSize = 'normal';
		}
		else if(iSize >= 120)
		{
			sSize = 'bigger';
		}
		else if(iSize > 100 && iSize < 130)
		{
			sSize = 'big';
		}
		else
		{
			sSize = 'normal';
		}
	}

	switch(sSize)
	{
		case 'normal':	sImgname = 'schrift-normal';
						sImgpath = 'fileadmin/mhwetzlar/images/klein-a.gif';
						break;
		case 'big':		sImgname = 'schrift-mittel';
						sImgpath = 'fileadmin/mhwetzlar/images/mittel-a.gif';
						break;
		case 'bigger':	sImgname = 'schrift-gross';
						sImgpath = 'fileadmin/mhwetzlar/images/gross-a.gif';
						break;
	}

	document.getElementById(sImgname).src = sImgpath;
}


window.onload = doStart;
/*]]>*/
