<!--
var objContainer = null;
var mouseX, mouseY;
var loading = null;

/* Jeden Mausklick aufzeichnen */
document.onmousemove	= updateTooltipPosition;

function loadStyle(strLinkId, strUrl) 
{
	css = document.getElementById(strLinkId);
	
	if(!css)
	{
		css = document.createElement('link');
		css.setAttribute('id', strLinkId);
		css.setAttribute('rel','stylesheet');
		document.getElementsByTagName('head')[0].appendChild(css);
	}
	
	css.setAttribute('href','css/sizeUp.php');
	
	return false;
}

function unloadStyle(strLinkId, strUrl)
{
	css = document.getElementById(strLinkId);
	
	if(!css)
	{
		css = document.createElement('link');
		css.setAttribute('id', strLinkId);
		css.setAttribute('rel','stylesheet');
		document.getElementsByTagName('head')[0].appendChild(css);
	}
	
	css.setAttribute('href','css/sizeDown.php');
	
	return false;
}

function updateTooltipPosition(e) 
{
	var scrollX=0, scrollY=0;
	
	if(document.body && (document.body.scrollLeft || document.body.scrollTop) )
	{
		scrollX = document.body.scrollLeft;
		scrollY = document.body.scrollTop;	
	}
		
	if( document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop) )
	{
		scrollX = document.documentElement.scrollLeft;
		scrollY = document.documentElement.scrollTop;	
	}
	
	if(!document.all)
	{
		mouseX = e.pageX;
		mouseY = e.pageY;
	}
	
	if(window.event && document.all)
	{
		mouseX = window.event.clientX + scrollX;
		mouseY = window.event.clientY + scrollY;
	}
	
	if(loading)
	{
		loading.style.top		= mouseY + 'px';
		loading.style.left		= mouseX + 'px';
	}
}

function absLeft(el)
{
    return (el.offsetParent) ? el.offsetLeft+absLeft(el.offsetParent) : el.offsetLeft;
}

function absTop(el)
{
     return (!document.body.all && el.offsetParent) ? el.offsetTop + absTop(el.offsetParent) : el.offsetTop;
}

function showLoading()
{
	if (!loading)
	{
		loading = document.createElement('div');
		loading.id = 'i_show_loading';
		loading.className = 'show_loading';
		loading.innerHTML = '<img src="gfx/ajaxload.gif" border="0" vspace="0" hspace="0" alt="Bitte warten ... in Bearbeitung" />';
		
		document.getElementsByTagName('body').item(0).appendChild(loading);
	}
	
	loading.style.top		= mouseY + 'px';
	loading.style.left		= mouseX + 'px';
	loading.style.display	= 'block';
	
	return false;
}

function hideLoading()
{
	if(loading)
		loading.style.display	= 'none';
		
	if(objContainer)
	{
		numWidth	= objContainer.offsetWidth;
		numHeight	= objContainer.offsetHeight;
		
		numClientWidth	= document.body.clientWidth;
		numClientHeight	= document.body.clientHeight;
		
		if(numWidth && (absLeft(objContainer)+numWidth) > numClientWidth)
		{
			numX = absLeft(objContainer) - numWidth - 2;
			objContainer.style.left		= numX + 'px';
		}
		
		if(numHeight && (absTop(objContainer)+numHeight) > numClientHeight)
		{
			numY = absTop(objContainer);
			
			numY -= absTop(objContainer) + numHeight - numClientHeight - 2;
			objContainer.style.top		= numY + 'px';
		}
			
	}
}

function loadOverlayContainer(objCaller, strContainerId)
{
	objContainer	= document.getElementById(strContainerId);
	
	if(objContainer)
	{
		objContainer.style.top		= mouseY + 'px';
		objContainer.style.left		= mouseX + 'px';
		objContainer.style.display	= 'block';
	}
}

function unloadOverlayContainer(strContainerId)
{
	var objContainer	= document.getElementById(strContainerId);
	
	if(objContainer)
	{
		objContainer.style.display	= 'none';
		objContainer.innerHTML	= '';
	}
}

function disableField(strObjId, boolDisable)
{
	var objField = document.getElementById(strObjId);
	
	if(objField)
	{
		boolDisable ? objField.setAttribute('disabled', 'disabled') : objField.removeAttribute('disabled'); 
	}
}

// selektierten Wert eines Dropdowns auslesen
function getSelectedValue(objSelect)
{
	var selectedValue = 0;
	
	if(objSelect)
		for(var i=0; i<objSelect.length; i++)
			if(true==objSelect.options[i].selected)
				selectedValue = objSelect.options[i].value;
		
	return selectedValue;
}

function getSelectedOptionTxt(objSelect)
{
	var selectedTxt = '';
	
	if(objSelect)
		for(var i=0; i<objSelect.length; i++)
			if(true==objSelect.options[i].selected)
				selectedTxt = objSelect.options[i].text;
		
	return selectedTxt;
}

function show(strObjectId)
{
		document.getElementById(strObjectId).style.display = 'block';
}

function hide(strObjectId)
{
		document.getElementById(strObjectId).style.display = 'none';
}

function copyValueToField(strValue, strFieldId)
{
		var objField = document.getElementById(strFieldId);	
		
		if(objField)
			objField.value = strValue;
}

// ### Overlay Zuordnung Objekte
function hideConfigurator(strAnker)
{
	if(document.getElementById('configurator_layer'))
		document.body.removeChild(document.getElementById('configurator_layer'));
		
	if(document.getElementById('configurator_mask'))
		document.body.removeChild(document.getElementById('configurator_mask'));
		
	if(document.getElementById('footer'))
		document.getElementById('footer').style.display = '';
		
	//this.location.href = top.document.URL.substr(0, top.document.URL.lastIndexOf('#')) +'#'+strAnker;
	top.location.reload();
}

function loadConfigurator(strDoTitle, strUrl)
{
	self.scrollTo(0,0);
	
	var arrayPageSize	= getPageSize();
	
	var objConfiguratorMask	= document.createElement("div");
	objConfiguratorMask.setAttribute('id', 'configurator_mask');
	objConfiguratorMask.style.width = arrayPageSize[0] + 'px';
	objConfiguratorMask.style.height = arrayPageSize[0] + 'px';
	
	var objConfiguratorLayer	= document.createElement("div");
	objConfiguratorLayer.setAttribute('id', 'configurator_layer');
	
	var objConfiguratorWrap	= document.createElement("div");
	objConfiguratorWrap.setAttribute('id', 'configurator_wrap');
	
	var strIframe = '<span class="close_link" style="float:right;"><img src="gfx/close.gif" border="0" alt="Fenster schließen" align="absmiddle" /> <a href="#" onclick="hideConfigurator(\'\'); return false;">Fenster schließen</a></span><h1 class="configurator_header">'+strDoTitle+'<br />&nbsp;</h1><iframe name="configurator_iframe" id="configurator_iframe" marginwidth="0" marginheight="0" width="760" height="540" src="'+strUrl+'" frameborder="0" scrolling="auto"></iframe>';
	
	objConfiguratorWrap.innerHTML = strIframe;
	
	objConfiguratorLayer.appendChild(objConfiguratorWrap);
	
	document.body.appendChild(objConfiguratorMask);
	document.body.appendChild(objConfiguratorLayer);
	
	if(document.getElementById('footer'))
		document.getElementById('footer').style.display = 'none';
}

function getPageSize() 
{
	var xScroll, yScroll;
		
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
		
	var windowWidth, windowHeight;
		
	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
		
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}

	return [pageWidth,pageHeight];
}




var strImgFullId	= 'i_imgview';
var numCurImg		= 1;
var numMaxImg		= 6;
var strImgTitleId	= 'i_imgtitle';

function swapImg(objImgThumb)
{
	if( (objImgFull = document.getElementById(strImgFullId)) )
	{
		numCurImg = eval(objImgThumb.id.replace('i_thumb_', ''));
		
		//changeOpac(0, strImgFullId);
		
		objImgFull.src		= objImgThumb.src.replace('_thumb', '');
		objImgFull.alt		= objImgThumb.alt;
		objImgFull.title	= objImgThumb.title;
		
		//shiftOpacity(strImgFullId, 1000);
		
		document.getElementById(strImgTitleId).innerHTML	= objImgThumb.title;
	}
}

function showNextPrevImg(numDir, numImgAmount)
{
	numMaxImg = numImgAmount;
	numCurImg = Math.ceil(numCurImg + numDir);
	
	if(numCurImg==0)
		numCurImg = numMaxImg;
	else if(numCurImg > numMaxImg)
		numCurImg = 1;
		
	if( (objImgThumb = document.getElementById('i_thumb_' + numCurImg)) && (objImgFull = document.getElementById(strImgFullId)))
	{
		//changeOpac(0, strImgFullId);
		
		objImgFull.src		= objImgThumb.src.replace('_thumb', '');
		objImgFull.alt		= objImgThumb.alt;
		objImgFull.title	= objImgThumb.title;
		
		document.getElementById(strImgTitleId).innerHTML	= objImgThumb.title;
		
		//shiftOpacity(strImgFullId, 1000);
	}
}

function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
}

function shiftOpacity(id, millisec) { 
    //if an element is invisible, make it visible, else make it ivisible 
    if(document.getElementById(id).style.opacity == 0) { 
        opacity(id, 0, 100, millisec); 
    } else { 
        opacity(id, 100, 0, millisec); 
    }
    
    return true; 
} 

function blendimage(divid, imageid, imagefile, millisec) { 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 
     
    //set the current image as background 
    document.getElementById(divid).style.width = document.getElementById(imageid).width + 'px';
    document.getElementById(divid).style.height = document.getElementById(imageid).height + 'px';
    document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")"; 
     
    //make image transparent 
    changeOpac(0, imageid); 
     
    //make new image 
    document.getElementById(imageid).src = imagefile; 

    //fade in image 
    for(i = 0; i <= 100; i++) { 
        setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed)); 
        timer++; 
    } 
} 

//-->
