var oWindow;
var oDefaultQtipStyle = {
	position: {
		corner: {
			target: 'topMiddle',
			tooltip: 'bottomLeft'
		}
	},
	style: {
		border: {
			width: 3,
			radius: 7
		},
		padding: 10,
		textAlign: 'left',
		lineHeight: '1.5',
		tip: true,
		name: 'light',
		width: 400
	},
	show: {
		delay: 1500,
		effect: {
			length: 300
		}
	},
	hide: {
		delay: 500,
		effect: {
			length: 100
		}
	}
}

function getQtipObjectStyle(oStyle) {
	return mergeObject(oDefaultQtipStyle, oStyle);
}

function advertCreator(sOpenClass, sCloseClass, sTitle, sContent) {
	var fnGetWindowElements = function (oWindow){
		return [oWindow.getElementsByTagName(sTitle).item(0), oWindow.getElementsByTagName(sContent).item(0)];
	}
	var oOpenButton = new DocumentBuilder().addElement('span', '', {title: 'pokaż szczegóły', className: 'action ' + sOpenClass});
	var oCloseButton = new DocumentBuilder().addElement('span', '', {title: 'ukryj szczegóły', className: 'action ' + sCloseClass});
	var oWindowCollection = new WindowCollection();
	oWindowCollection.setElementGetter(new Caller(fnGetWindowElements));
	oWindowCollection.setButtons(oOpenButton, oCloseButton);
	
	return oWindowCollection;
}

function offerCreator(sOpenPath, sClosePath) {
	return advertCreator(sOpenPath, sClosePath);
}

/*function animateWindow(oEvent) {
	var iClientWidth = (document.documentElement.clientWidth || document.body.clientWidth) + (document.documentElement.scrollLeft || document.body.scrollLeft);
	if(typeof oWindow != "undefined" && oWindow.style.display != "none") {
		var oPosition = getPosition(oEvent);
		oWindow.style.top = oPosition.y + 15 + 'px';
		if(oPosition.x + 15 + oWindow.offsetWidth < iClientWidth) {
			oWindow.style.left = oPosition.x + 15 + 'px';
		} else {
			oWindow.style.left = iClientWidth - oWindow.offsetWidth + 'px';
		}
	}
}

function showHelp(oEvent, oElement) {
	var iClientWidth = (document.documentElement.clientWidth || document.body.clientWidth) + (document.documentElement.scrollLeft || document.body.scrollLeft);
	var sTitle = oElement.getAttribute('title');
	var oPosition = getPosition(oEvent);
	oElement.setAttribute('title', '');
	oElement.oldTitle = sTitle;
	oWindow.innerHTML = sTitle;
	oWindow.style.top = oPosition.y + 15 + 'px';
	if(oPosition.x + 15 + oWindow.offsetWidth < iClientWidth) {
		oWindow.style.left = oPosition.x + 15 + 'px';
	} else {
		oWindow.style.left = iClientWidth - oWindow.offsetWidth + 'px';
	}
	showWindow();
}

function hideHelp(oElement) {
	hideWindow();
	oElement.setAttribute('title', oElement.oldTitle);
}

function generateWindow() {
	var oDiv = document.createElement('div');
	oDiv.id = "helpWindow";
	oDiv.style.top = 0;
	oDiv.style.display = 'none';
	document.body.appendChild(oDiv);
	
	return oDiv;
}

function showWindow() {
	oWindow.style.display = "block";
	oWindow.style.visibility = "visible";
}

function hideWindow() {
	oWindow.style.visibility = "hidden";
	oWindow.style.display = "none";
}
*/
