var onloadarray = '';
var targettopnummer=0;
var z_index=9999;
function onloadfunction_commonjs(){
		maketarget_blank();
		get_info();
		focus_text();
		eval(onloadarray);
}
window.onload=onloadfunction_commonjs;

function maketarget_blank(){
	if((document.all || document.getElementsByTagName) && document.getElementById){
		var alltags=document.all? document.all : document.getElementsByTagName("A");
		for (i=0; i<alltags.length; i++){
			if(alltags[i].tagName=="A" && alltags[i].className.indexOf("targetblank")!=-1){
				alltags[i].onclick=function(){return gettargetblank(this);};
				alltags[i].setAttribute('title','Neues Fenster');
			};
		};
	};
}

function focus_text(){
	if((document.all || document.getElementsByTagName) && document.getElementById){
		var alltags3=document.all? document.all : document.getElementsByTagName("*");
		for (i=0; i<alltags3.length; i++){
			if(alltags3[i].tagName=="INPUT" && alltags3[i].className.indexOf("smalltext")!=-1) {
				alltags3[i].onfocus=function(){ this.className='text smalltext active';};
				alltags3[i].onblur=function(){ this.className='text smalltext';};
			} 
			else if(alltags3[i].tagName=="INPUT" && alltags3[i].className.indexOf("middletext")!=-1) {
				alltags3[i].onfocus=function(){ this.className='text middletext active';};
				alltags3[i].onblur=function(){ this.className='text middletext';};
			}
			else if(alltags3[i].tagName=="INPUT" && alltags3[i].className.indexOf("largetext")!=-1) {
				alltags3[i].onfocus=function(){ this.className='text largetext active';};
				alltags3[i].onblur=function(){ this.className='text largetext';};
			}
			else if(alltags3[i].tagName=="INPUT" && alltags3[i].className.indexOf("text")!=-1) {
				alltags3[i].onfocus=function(){ this.className='text active';};
				alltags3[i].onblur=function(){ this.className='text';};
			}
			if(alltags3[i].tagName=="TEXTAREA" && alltags3[i].className.indexOf("text")!=-1){
				alltags3[i].onfocus=function(){ this.className='text active';};
				alltags3[i].onblur=function(){ this.className='text';};
			};			
			if(alltags3[i].tagName=="SELECT"){
				alltags3[i].onfocus=function(){ this.className='active';};
				alltags3[i].onblur=function(){ this.className='';};
			};
			if(alltags3[i].tagName=="INPUT" && alltags3[i].className.indexOf("checkbox")!=-1){
				alltags3[i].onfocus=function(){ this.className='checkbox active';};
				alltags3[i].onblur=function(){ this.className='checkbox';};
			};
		};
	};
}

function get_info(){
	var firstCHCH=new Array();
	if(document.all || document.getElementsByTagName){
		var alltags2=document.all? document.all : document.getElementsByTagName("SPAN");
		for (i=0; i<alltags2.length; i++){
			if(alltags2[i].tagName=="SPAN" && alltags2[i].className.indexOf("info")!=-1){
				alltags2[i].style.zIndex=z_index;
				z_index--;
				alltags2[i].innerHTML=alltags2[i].innerHTML+'<span>'+alltags2[i].firstChild.getAttribute('title')+'</span>';
				alltags2[i].lastChild.style.left=(alltags2[i].firstChild.clientWidth+27)+'px';
				alltags2[i].firstChild.setAttribute('title','');
				alltags2[i].onmouseover=function(){ this.lastChild.style.visibility='visible'; };
				alltags2[i].onmouseout=function(){ this.lastChild.style.visibility='hidden'; };
			};
		};
	};
}


function gettargetblank(aobject){
	openwindow(aobject,'targettop'+targettopnummer,'scrollbars=yes,status=yes,titlebar=yes,toolbar=yes,menubar=yes,resizable=yes');
	targettopnummer++;
	return false;
}

function openwindow(url,winName,winParams)	{	
	var theWindow = window.open(url,winName,winParams);
	if (theWindow)	{theWindow.focus();}
}

function submitExperts(formObj) {
	// alert('formObj: ' + formObj);
}

function popterms(url) {
//	var fenster=window.open(url,"fenster","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizeable=no,width=500,height=550");
	var fenster=window.open(url,"fenster","toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizeable=yes,width=580,height=550");
    return false;
}

function popAuftrag(url) {
	var fenster=window.open(url,"fenster","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizeable=yes,width=637,height=600");
    return false;
}

function popHires(url) {
	var fenster=window.open(url,"fenster","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizeable=no,width=1000,height=650");
    return false;
}

function toggleCatalog(einzelKatalog, printKatalog) {
	var catContainer 		= document.getElementById('einzelkatalogContainer');
	var linkText 	 		= document.getElementById('printKatalogJSLink');
	var printkatalogeTable 	= document.getElementById('printkatalogeTable');
	
	var isMSIE = /*@cc_on!@*/false;
	
	if (catContainer.style.display == 'block') {
		catContainer.style.display = 'none';
		if (isMSIE)
			printkatalogeTable.style.display = 'block';
		else	
			printkatalogeTable.style.display = 'table';
		linkText.innerHTML = einzelKatalog;
		
		
	} else {
		catContainer.style.display = 'block';
		catContainer.style.height = '11em';
		printkatalogeTable.style.display = 'none';
		linkText.innerHTML = printKatalog;
		
		
	}
	return false;
}

function hideSubmitButtons() {
	var button1;
	var button2;
	
	button1 = document.getElementById('spartenSubmit');
	button2 = document.getElementById('filialenSubmit');
	
	button1.style.display = 'none';
	button2.style.display = 'none';
}

function openURL(url) {
	location.href = url;
}

/* 
// function escape() ?
function goSearch() {
	var searchedString = document.getElementById('suchelinkspalte').value;
	
	var page = "default.asp?contURL=default.asp?C=SearchLotNotLogged%26txtSearchPhrase1="+searchedString;
	window.location = page;
}
*/

function Set_Cookie( name, value, expires, path, domain, secure ) 
{
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	
	/*
	if the expires variable is set, make the correct 
	expires time, the current script below will set 
	it for x number of days, to make it for hours, 
	delete * 24, for minutes, delete * 60 * 24
	*/
	
	var expires_date = new Date( today.getTime() + (expires) );

	document.cookie = name + "=" +escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
		( ( path ) ? ";path=" + path : "" ) + 
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}

function markAll(el, nor) {
	
	if (el.checked == true) {
		
		var i=1;
		for(i; i<=nor; i++) {
			//alert('test');
			var element = document.getElementById('delete_'+i);
			element.checked = true;
 		}
	} else {
		var i=1;
		for(i; i<=nor; i++) {
			//alert('test');
			var element = document.getElementById('delete_'+i);
			element.checked = false;
		} 
	}
}

function jumpToLink(newLocation) {
	location.href = newLocation; 
}

function doCursorMouseOver(element) {
	element.style.cursor = 'pointer';
	//alert('test');
	//window.status = 'This is a link';
	return true;
	
}

function undoCursorMouseOver(element) {
	element.style.cursor = 'pointer';
	return true;
}

function doTableRowRollover(tableRow) {
	tableRow.style.cursor = 'pointer';
	
	if ( navigator.appName.indexOf("Firefox") == -1 &&  navigator.appName.indexOf("Netscape") == -1 ) {
		var tds = tableRow.childNodes;
		for (i = 0; i < tds.length; i++) {
			tds[i].style.backgroundColor = '#E6E7E9';
			//tds[i].style.borderBottomColor = '#B41A34';
			//tds[i].style.color = '#FFFFFF';
			tds[i].style.cursor = 'hand';
		}
	}
}

function undoTableRowRollover(tableRow) {
	tableRow.style.cursor = 'pointer';
	
	if ( navigator.appName.indexOf("Firefox") == -1 &&  navigator.appName.indexOf("Netscape") == -1 ) {
		var tds = tableRow.childNodes;
		for (i = 0; i < tds.length; i++) {
			tds[i].style.backgroundColor = '#ffffff';
			//tds[i].style.borderBottomColor = '#E7E6E7';
			//tds[i].style.color = '#45400B';
			
			//if (tds[i].className == 'oznacenieBytu')
			//	tds[i].style.color = '#FF6600';
		}
	}
}

function getMultipleSelectedItems( frmName, listName, tgtName, separator ) {
	var form = eval( 'document.' + frmName );
	var list = eval( 'form.' + listName );
	var target = eval( 'form.' + tgtName );

	values = Array();

	for ( i = 0, n = list.options.length; i < n; i++ ) {
		if ( list.options[i].selected ) values.push( list.options[i].value );
	}
	
	target.value = values.join( separator );
}

function multipleCheckBoxControl( formName, elementsName, check ) {
	var form = eval( 'document.' + formName )

	for (var i = 0, n = form.elements.length; i < n; i++) {  
		var e = form.elements[i]; 

		if ( ( e.name == elementsName || elementsName == '' ) && ( e.type == 'checkbox' ) ) { 
			e.checked = check; 
		} 
	} 
}

function multipleCheckBoxControlIsSelected( formName, elementsName ) {
	var form = eval( 'document.' + formName )

	for (var i = 0, n = form.elements.length; i < n; i++) {  
		var e = form.elements[i]; 

		if ( ( e.name == elementsName || elementsName == '' ) && ( e.type == 'checkbox' ) && ( e.checked ) ) { 
			return true;
		} 
	}
	
	return false;
}

function highlightRowIfSelected( inputObj, activeColor, inactiveColor ) {
	var rowObj = inputObj.parentNode.parentNode;
	
	var isChecked = false;
	var i, n;

	for ( i = 1, n = rowObj.childNodes.length; i < n; i++ ) {
		if ( rowObj.childNodes[i].tagName == 'TD' && rowObj.childNodes[i].hasChildNodes() ) {
			var e = rowObj.childNodes[i].firstChild;
			if ( e.type == 'checkbox' && e.checked ) {
				isChecked = true;
				break;
			}
		}
	}

	if ( isChecked ) {
		changeTableRowBG( rowObj, activeColor );
	}
	else {
		changeTableRowBG( rowObj, inactiveColor );
	}
}

function changeTableRowBG( rowObj, color ) {
	var tds = rowObj.childNodes;
	for (i = 0; i < tds.length; i++) {
		if ( tds[i].tagName == 'TD' ) tds[i].style.backgroundColor = color;
	}
}