

function appendClassName(obj, cName){
	obj.className=obj.className.replace(eval('/'+cName+'/'),'');
	obj.className+=' '+cName;
	obj.className=obj.className.replace(/[ ]{2}/,' ');
	obj.className=obj.className.replace(/^[ ]?/,'');
}

function sliceClassName(obj, cName){
	if(obj.className.indexOf(' '+cName)!=-1 || obj.className.indexOf(cName+' ')!=-1 || obj.className==cName)
	{
		obj.className=obj.className.replace(eval('/'+cName+'/'),'');
		obj.className=obj.className.replace(/[ ]{2}/,' ');
		obj.className=obj.className.replace(/^[ ]?/,'');
	}
}

function replaceClassName(obj, cName1, cName2){
	obj.className=obj.className.replace(eval('/'+cName1+'/'),cName2);
}

function trim(s){
	while(s.substring(0,1) == ' '){s = s.substring(1,s.length);}
	while(s.substring(s.length-1,s.length) == ' '){s = s.substring(0,s.length-1);}
	return s;
}

var p;
function popup3(_href){
	//var winWidth=385+5+5;
	var winWidth=385+5+5+20;
	var p=window.open(_href,'popup','resizable=yes,scrollbars=yes,menubar=no,toolbar=no,width='+winWidth+',height=250,top=50,left=50')
	p.focus();
}

function zipHelperPopUp(){
	var p=window.open("/searchZipHelperPopUp.html",'popup','resizable=yes,scrollbars=yes,menubar=no,toolbar=no,width=430,height=300,top=50,left=50')
	p.focus();
}

function sizeWin()
{
	var innerContentHeight = document.body.scrollHeight;
	var innerContentWidth  = document.body.scrollWidth;
	
	var initialWindowHeight = self.innerHeight;
	var initialWindowWidth  = self.innerWidth;
	
	if(!self.innerHeight || self.innerHeight == 'undefined'){
		initialWindowHeight = (1*document.documentElement.clientHeight > 0)?document.documentElement.clientHeight:document.body.clientHeight;
		initialWindowWidth = (1*document.documentElement.clientWidth > 0)?document.documentElement.clientWidth:document.body.clientWidth;
	}
	var newHeight=(innerContentHeight-initialWindowHeight<=500)?innerContentHeight-initialWindowHeight:500;

	/*
	var test1 = document.body.scrollHeight;
	var test2 = document.body.offsetHeight
	var test3 = self.innerHeight;
	var test4 = document.documentElement.clientHeight;
	var test5 = document.body.clientHeight;
	
	Passt noch nicht immer in jedem Browser (wenn geoeffnetes Fenster z.B. hoeher oder breiter als Inhalt)... GoldTopf :-)
	alert('innerContentHeight-initialWindowHeight='+innerContentHeight+'-'+initialWindowHeight+'='+eval(innerContentHeight-initialWindowHeight)+'\ninnerContentWidth-initialWindowWidth='+innerContentWidth+'-'+initialWindowWidth+'='+eval(innerContentWidth-initialWindowWidth)+'\n\n'+test1+'\n'+test2+'\n'+test3+'\n'+test4+'\n'+test5);
	*/

	window.resizeBy(innerContentWidth-initialWindowWidth, newHeight);
}

/* change boxtablayercontents (explorative search) */
function changetab(obj, func){
	var e = document.getElementById(obj);
	if(e != null) {
		for(i=0; i< e.parentNode.childNodes.length; i++){
			e.parentNode.childNodes[i].className='';
		}
		e.className='active';
	}
	if(func != null) {
		eval(func);
	}
	window.focus();
}

function checkAll(f, n, c) {
	for (var i=0;i<f.elements.length;i++) {
		var e=f.elements[i];
		if((e.name==n)&&(e.type=='checkbox')) {
			e.checked=c;
		}
	}
	return false;
}

// _mainPageId	= {aboutme(default) || mysearch || 25questions || vip || be2}
// _subPageId	= {null(default) || iChat || iMessaging || iFlirt}
function openProfilewin(_id, _mainPageId, _subPageId){top.datacenter.openPrfWin(_id, _mainPageId, _subPageId);}