var scroll=false;

function loginPopup() {
	var baseHref = "";
	if(document.all) {
		var baseTag = document.all.tags('BASE');
		if(baseTag.length>0) {
			baseHref = baseTag[0].href;
		}	
	}
	var win = window.open(baseHref+"katj/management/login.php","Login","toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,width=250,height=200,left=50,top=50,dependent=yes");
}

function anonncePopup(uri,width,height) {
	var win = window.open(uri,"Kampagne","resizable=no,toolbar=0,scrollbars=auto,location=0,statusbar=0,menubar=0,width="+width+",height="+height+",left=50,top=50");
}

function printWindow(parameters,width,height,divwidth) {
	var win = window.open("printwindow.php?"+parameters+"width="+divwidth,"KATJ","resizable=no,toolbar=0,scrollbars=auto,location=0,statusbar=0,menubar=0,width="+width+",height="+height+",left=50,top=50");
}

function windowPopup(uri,title,width,height,resizable,top,left) {
	var win = window.open(uri,title,"resizable="+resizable+",toolbar=0,scrollbars=auto,location=0,statusbar=0,menubar=0,width="+width+",height="+height+",left="+left+",top="+top);
	win.focus();
	return win;
}

function showHideLayer(id) {
	var object;
	if(document.layers) {
		object = document.layers[id]
       object.visibility = (object.visibility=="" || object.visibility == "hide") ? "show" : "hide";
       return;
    } else if(document.getElementById) {
    	object = document.getElementById(id);
    } else if(document.all) {
    	object = document.all[id];
    }
    object.style.visibility = (object.style.visibility=="" || object.style.visibility == "hidden") ? "visible" : "hidden";
}


function getStyle(element,styleProp) {
	var y=null;
	if(element.offsetTop) {
		if(styleProp=="top") {
			y = element.offsetTop;
		} else if(styleProp=="bottom") {
			y = element.offsetBottom;
		} else if(styleProp=="height") {
			y = element.offsetHeight;
		} else if(styleProp=="width") {
			y = element.offsetWidth;
		} else if(styleProp=="left") {
			y = element.offsetLeft;
		} else if(styleProp=="right") {
			y = element.offsetRight;
		}
		if(y!=null) {
			return y;
		}
	}
	if (document.defaultView && document.defaultView.getComputedStyle) {
		y = document.defaultView.getComputedStyle(element,null).getPropertyValue(styleProp);
	} else if (document.all) {
		y = eval('element.currentStyle.' + styleProp);
	} 
	return y;
}

function getStyleAsInteger(element,styleProp) {
	var style=getStyle(element,styleProp);
	if(typeof style == 'number') {
		return style;
	}
	var pxPos =style.indexOf("px");
	if(pxPos!=-1) {
		return parseInt(style.substring(0,pxPos));
	} else {
		return 0;
	}
}

function getContentMargins(element) {
	var marginLeft="marginLeft";
	var marginRight="marginRight";
	if(!document.all) {
		marginLeft="margin-left";
		marginRight="margin-right";
	} 
	var margin=getStyle(element,marginLeft);
	
	var pxPos =margin.indexOf("px");
	var totalMargin = parseInt(margin.substring(0,pxPos));
	
	margin=getStyle(element,marginRight);
	pxPos =margin.indexOf("px");
	totalMargin += parseInt(margin.substring(0,pxPos));
	return totalMargin;
}

function sitemapFolders(id,picPath) {
	var image = document.getElementById(id);
	var childElement = document.getElementById("parentid_"+image.parentNode.id);
	if(childElement.style.display=="none") {
		childElement.style.display="block";
		image.src=picPath + "/btn/minus.gif"
	} else {
		childElement.style.display="none";
		image.src=picPath + "/btn/plus.gif"
	}
}

function trim(str) {
    return str.replace(/^\s+/, '').replace(/\s+$/, '');
}
