var iWidth = 0;
var add_xml;
var url = '/addcont/addcont';
var addcont_elm_r = 'add_rt';
var addcont_elm_b = 'add_bm';
var lnk_r = '';
var lnk_b = '';
var addthis_config = {
	ui_language: "de",
	ui_delay: 250,
	ui_hover_direction: 1,
	ui_header_color: "#999966",
	ui_header_background: "#000000",
	services_exclude: 'email,gmail,hotmail,amazonwishlist'
	}
var preTitle = 'Natur Photos - Hendrik Helm';
if (parent.frames.length > 0) {self.parent.location = document.location;} 

function str_replace(search, replace, subject) {return subject.split(search).join(replace);}

function setTitle(addTxt) {
	document.title = preTitle + " :: " + addTxt;
	updWidth();
}

function layonoff(id) {
	if (document.getElementById(id).style.display == 'block') {
		document.getElementById(id).style.display = 'none';
		return;
	}
	if (document.getElementById(id).style.display == 'none' || !document.getElementById(id).style.display) {
		document.getElementById(id).style.display = 'block';
		return;
	}
}

function refreshAd(id) {
	var d = document.getElementById(id);
	if (d) {
		var s = d.getElementsByTagName('iframe');
		if (s && s.length) s[0].src = s[0].src + '&' + new Date().getTime();
	}
	return true;
}

function getWindowWidth() {
	if (window.innerWidth) return window.innerWidth;
	else if (document.body && document.body.offsetWidth) return document.body.offsetWidth;
	else return 0;
}

function updWidth() {
	if (iWidth != getWindowWidth()) {
		iWidth = getWindowWidth();
		if (iWidth > 1100) document.getElementById(addcont_elm_r).style.display = 'inline';
		if (iWidth < 1050) document.getElementById(addcont_elm_r).style.display = 'none';
	}
	refreshAd(addcont_elm_r);
	refreshAd(addcont_elm_b);
}

window.onresize = function(){updWidth();};
window.onload = function(){
	updWidth();
	document.getElementById('bklinks').innerHTML = '<a href="javascript:void(0)" onclick="layonoff(\'linkbox\')"> :: Links :: </a>';
};
