if ( navigator.userAgent.toLowerCase().indexOf('safari') < 0  && document.getElementById )
{
	// add style sheet if not safari
	var dummy = document.getElementById("dummy_css");
	if (dummy)	dummy.href = "fileadmin/templates/css/searchbox.css";
}


// a common PullDownMenu
var activeAndOpen;
function openAPullDown(id)
{
	if(document.getElementById(id).style.display != 'block')
	{
		if (activeAndOpen != null)
		{
			document.getElementById(activeAndOpen).style.display = 'none';
			document.getElementById(activeAndOpen).style.height = '0';
		}
		document.getElementById(id).style.display = 'block';
		document.getElementById(id).style.height = 'auto';
		activeAndOpen = id;
	}
	else
	{
		document.getElementById(id).style.display = 'none';
		document.getElementById(id).style.height = '0';
		if (activeAndOpen != null)
		{
			document.getElementById(activeAndOpen).style.display = 'none';
			document.getElementById(activeAndOpen).style.height = '0';
			activeAndOpen = null;
		}
	}
}

// Author: Harald Klotzberg
// Set Active item in Dropdowns

function setActiveItem(target, item) {

	if ((item != null) && (target != null)) {

		document.getElementById(target).innerHTML = item;

		if ("selectedCountry" == target) {
			fillCountryFormOnChange();
		}

		if ("selectedRadius" == target) {
			fillRadiusFormOnChange();
		}

		if ("selectedObjType" == target) {
			fillObjectTypeOnChange();
		}

		if ("selectedApplicationArea" == target) {
			fillApplicationAreaOnChange();
		}

		if ("selectedProdType" == target) {
			fillProdTypeOnChange();
		}

		if ("selectedResultsAtATime" == target) {
			fillResultsAtATimeOnChange();
		}

		if ("selectedProdSurface" == target) {
			fillProdSurfaceOnChange();
		}

		if ("selectedProdColor" == target) {
			fillProdColorOnChange();
		}

		if ("selectedObjectRegion" == target) {
			fillObjectRegionOnChange();
		}
	}

}


// Author: Harald Klotzberg
// Harvest Dropdowndata for builders merchants and submit it via form

var country = '';
var zip = '';
var radius = '';

function harvestBuildersMerchantDropdownDataAndSubmit () {

		// Harvest Data
	country = document.forms.buildersMerchantForm.elements.selectedCountryPost.value;
	zip = document.forms.buildersMerchantForm.elements.selectedZip.value;
	radius = document.forms.buildersMerchantForm.elements.selectedRadiusPost.value;

	document.buildersMerchantForm.submit();

}


// Author: Harald Klotzberg
// Fill Dummy Forms on Country Change

function fillCountryFormOnChange() {

		// Fill Dummy Form
	document.forms.buildersMerchantForm.elements.selectedCountryPost.value = document.getElementById('selectedCountry').innerHTML;

}


// Author: Harald Klotzberg
// Fill Dummy Forms on Country Change

function fillRadiusFormOnChange() {

		// Fill Dummy Form
	document.forms.buildersMerchantForm.elements.selectedRadiusPost.value = document.getElementById('selectedRadius').innerHTML;

}


// Author: Harald Klotzberg
// Harvest Dropdowndata for Object Database and submit it via form

var privateOrPublicCheckbox = '';
var objectType = '';
var applicationArea = '';
var productType = '';
var resultsAtATime = '';
var productSurface = '';
var productColor = '';
var objectRegion = '';
var objectSearchword = '';

function harvestObjDatabaseDropdownDataAndSubmit () {

		// Harvest Data

	privateOrPublicCheckbox = document.forms.objDatabaseForm.elements.privateOrPublicCheckbox.value;
	objectType = document.forms.objDatabaseForm.elements.objectType.value;
	applicationArea = document.forms.objDatabaseForm.elements.applicationArea.value;
	productType = document.forms.objDatabaseForm.elements.productType.value;
	resultsAtATime = document.forms.objDatabaseForm.elements.resultsAtATime.value;
	productSurface = document.forms.objDatabaseForm.elements.productSurface.value;
	productColor = document.forms.objDatabaseForm.elements.productColor.value;
	objectRegion = document.forms.objDatabaseForm.elements.objectRegion.value;
	objectSearchword = document.forms.objDatabaseForm.elements.objectSearchword;

	document.objDatabaseForm.submit();

}


// Author: Harald Klotzberg
// Fill objectType on Change for objDB
function fillObjectTypeOnChange() {

		// Fill Dummy Form
	document.forms.objDatabaseForm.elements.objectType.value = document.getElementById('selectedObjType').innerHTML;
	document.getElementById('selectedObjType').innerHTML = document.getElementById('selectedObjType').innerHTML.substr(0, 20);

}


// Author: Harald Klotzberg
// Fill Application Area on Change for objDB

function fillApplicationAreaOnChange() {

		// Fill Dummy Form
	document.forms.objDatabaseForm.elements.applicationArea.value = document.getElementById('selectedApplicationArea').innerHTML;
	document.getElementById('selectedApplicationArea').innerHTML = document.getElementById('selectedApplicationArea').innerHTML.substr(0, 20);

}


// Author: Harald Klotzberg
// Fill Product Type on Change for objDB

function fillProdTypeOnChange() {

		// Fill Dummy Form
	document.forms.objDatabaseForm.elements.productType.value = document.getElementById('selectedProdType').innerHTML;
	document.getElementById('selectedProdType').innerHTML = document.getElementById('selectedProdType').innerHTML.substr(0, 20);

}


// Author: Harald Klotzberg
// Fill Results at a time on Change for objDB

function fillResultsAtATimeOnChange() {

		// Fill Dummy Form
	document.forms.objDatabaseForm.elements.resultsAtATime.value = document.getElementById('selectedResultsAtATime').innerHTML;
	document.getElementById('selectedResultsAtATime').innerHTML = document.getElementById('selectedResultsAtATime').innerHTML.substr(0, 20);

}


// Author: Harald Klotzberg
// Fill Product Surface at a time on Change for objDB

function fillProdSurfaceOnChange() {

		// Fill Dummy Form
	document.forms.objDatabaseForm.elements.productSurface.value = document.getElementById('selectedProdSurface').innerHTML;
	document.getElementById('selectedProdSurface').innerHTML = document.getElementById('selectedProdSurface').innerHTML.substr(0, 20);

}


// Author: Harald Klotzberg
// Fill Product Color at a time on Change for objDB

function fillProdColorOnChange() {

		// Fill Dummy Form
	document.forms.objDatabaseForm.elements.productColor.value = document.getElementById('selectedProdColor').innerHTML;
	document.getElementById('selectedProdColor').innerHTML = document.getElementById('selectedProdColor').innerHTML.substr(0, 20);

}


// Author: Harald Klotzberg
// Fill Object Region at a time on Change for objDB

function fillObjectRegionOnChange() {

		// Fill Dummy Form
	document.forms.objDatabaseForm.elements.objectRegion.value = document.getElementById('selectedObjectRegion').innerHTML;
	document.getElementById('selectedObjectRegion').innerHTML = document.getElementById('selectedObjectRegion').innerHTML.substr(0, 20);

}


// PullDowns -- Objektdatenbank
function openObjDbSelItem(id)
{
	if(document.getElementById(id).style.display != 'block')
	{
		if (activeAndOpen != null)
		{
			document.getElementById(activeAndOpen).style.display = 'none';
			document.getElementById(activeAndOpen).style.height = '0';
		}
		document.getElementById(id).style.display = 'block';
		document.getElementById(id).style.height = 'auto';
		$('#objDbSelMoreOptionsPosWrapper').fadeTo("slow", 0.85);
		//new Effect.Opacity('objDbSelMoreOptionsPosWrapper', {duration:0.5, from:1.0, to:0.85});
		if (id == 'objDbSelMoreOptionsMoreContent')
		{
			activeAndOpen = null;
		}
		else
		{
			activeAndOpen = id;
		}
		if (id == 'objDbSelMoreOptionsMoreContent')
		{
			document.getElementById('objDbSelMoreOptionsPosWrapper').style.zIndex = 1;
			opener_to_close = new Image;
			opener_to_close.src = 'fileadmin/templates/img/opener_to_close.gif';
			img_to_close = eval('opener_to' + '_close.src');
			document.getElementById('opener_to').src = img_to_close;
		}
	}
	else
	{
		document.getElementById(id).style.display = 'none';
		document.getElementById(id).style.height = '0';
		if (activeAndOpen != null)
		{
			document.getElementById(activeAndOpen).style.display = 'none';
			document.getElementById(activeAndOpen).style.height = '0';
			activeAndOpen = null;
		}
		if (id == 'objDbSelMoreOptionsMoreContent')
		{
			document.getElementById('objDbSelMoreOptionsPosWrapper').style.zIndex = 1;
			opener_to_open = new Image;
			opener_to_open.src = 'fileadmin/templates/img/opener_to_open.gif';
			img_to_open = eval('opener_to' + '_open.src');
			document.getElementById('opener_to').src = img_to_open;
		}
	}
}

// gefakte Checkboxen -- Objektdatenbank
function changeObjDbSelSelectKindOf(id)
{
	if (activeAndOpen != null)
	{
		document.getElementById(activeAndOpen).style.display = 'none';
		document.getElementById(activeAndOpen).style.height = '0';
		activeAndOpen = null;
	}

	if (id == 'my_checkbox_public')
	{
		document.forms.objDatabaseForm.elements.privateOrPublicCheckbox.value = 0;
		on_img_pointer = new Image;
		on_img_pointer.src = 'fileadmin/templates/img/' + 'my_checkbox' + '_on.gif';
		on_img = on_img_pointer.src;
		document.getElementById('my_checkbox_public').src = on_img;
		off_img_pointer = new Image;
		off_img_pointer.src = 'fileadmin/templates/img/' + 'my_checkbox' + '_off.gif';
		off_img = off_img_pointer.src;
		document.getElementById('my_checkbox_private').src = off_img;
		//document.getElementById('selectedPrivateOrPublicCheckboxPublic').value = '1';
		//document.getElementById('selectedPrivateOrPublicCheckboxPrivate').value = '1';
	}
	else if (id == 'my_checkbox_private')
	{
		document.forms.objDatabaseForm.elements.privateOrPublicCheckbox.value = 1;
		on_img_pointer = new Image;
		on_img_pointer.src = 'fileadmin/templates/img/' + 'my_checkbox' + '_on.gif';
		on_img = on_img_pointer.src;
		document.getElementById('my_checkbox_private').src = on_img;
		off_img_pointer = new Image;
		off_img_pointer.src = 'fileadmin/templates/img/' + 'my_checkbox' + '_off.gif';
		off_img = off_img_pointer.src;
		document.getElementById('my_checkbox_public').src = off_img;
		//document.getElementById('selectedPrivateOrPublicCheckboxPublic').value = '0';
		//document.getElementById('selectedPrivateOrPublicCheckboxPrivate').value = '0';

	}

}


// Objektdatenbank -- Bilderwechsel
/*
function showBigImage(img)
{
	new_img_pointer = new Image;
	new_img_pointer.src = img;
	//new_img_pointer.src = 'fileadmin/templates/img/' + img + '.jpg';
	new_img = new_img_pointer.src;
	document.getElementById('objDbResItemCompleteBigImage').src = new_img;
	document.getElementById('objDbResItemCompleteBigImageBox').style.padding = '10px';
	document.getElementById('objDbResItemCompleteBigImageBox').style.width = 'auto';
}
*/

/* ************************************* */
/* Transparency-Effect for the Main Menu */
/* ************************************* */

function mnBgTransOn(id)
{
	switch (id)
	{
		case "mn1":	document.getElementById(id).style.backgroundImage = 'url(fileadmin/templates/img/nav_trans.png)';
		break;

		case "mn2": document.getElementById(id).style.backgroundImage = 'url(fileadmin/templates/img/nav_trans.png)';
		break;

		case "mn3": document.getElementById(id).style.backgroundImage = 'url(fileadmin/templates/img/nav_trans.png)';
		break;

		case "mn4": document.getElementById(id).style.backgroundImage = 'url(fileadmin/templates/img/nav_trans.png)';
		break;

		case "mn5": document.getElementById(id).style.backgroundImage = 'url(fileadmin/templates/img/nav_trans.png)';
		break;

		case "mn6": document.getElementById(id).style.backgroundImage = 'url(fileadmin/templates/img/nav_trans.png)';
		break;

		case "mn1active":
		break;

		case "mn2active": //document.getElementById(id).style.backgroundImage = 'url(fileadmin/templates/img/nav_trans_serviceplus.png)';
		break;

		case "mn3active":
		break;

		case "mn4active":
		break;

		case "mn5active":
		break;

		case "mn6active":
		break;
	}
}

function mnBgTransOff(id)
{
	switch (id)
	{
		case "mn1active":
		break;

		case "mn2active":
		break;

		case "mn3active":
		break;

		case "mn4active":
		break;

		case "mn5active":
		break;

		case "mn6active":
		break;

		default: document.getElementById(id).style.backgroundImage = 'url(fileadmin/templates/img/blank.png)';
		//default: document.getElementById(id).style.backgroundImage = '';
	}
}


// Thumb Mouseover Gallery
function showPatternImage(img)
{
	new_img_pointer = new Image;
	//new_img_pointer.src = 'uploads/tx_mplithonplusverlegemuster/' + img;
	new_img_pointer.src = img;
	new_img = new_img_pointer.src;
	document.getElementById('patternCurrentImage').src = new_img;

}

