
var m_sCopyrightMsg    = "Alle Bilder auf diesen Seiten sind durch Copyright geschützt.";
var m_iBrowserVersion  = parseInt(navigator.appVersion);
var m_bIsNS            = navigator.appName=="Netscape";
var m_bIsIE            = navigator.appName=="Microsoft Internet Explorer";
var m_oWin             = null;
var m_oOfferWin        = null;
var m_oPanoramaWin     = null;
var m_bDebug           = false;

function nrc(e) {
   if (m_bIsNS && e.which > 1){
	  alert(m_sCopyrightMsg);
	  return false;
   } else if (m_bIsIE && (event.button >1)) {
	 alert(m_sCopyrightMsg);
	 return false;
   }
}


function newWindow(sURL, sName ,w, h, scroll){
	var iLeftPos  = (screen.width) ? (screen.width-w)/2 : 0;
	var iTopPos   = (screen.height) ? (screen.height-h)/2 : 0;
	var sSettings ='height='+h+',width='+w+',top='+iTopPos+',left='+iLeftPos+',scrollbars='+scroll+',resizable';
	m_oWin = window.open(sURL, sName, sSettings);
}


function panoramaWindow(sUrl){
	var w = 750;
	var h = 200;
	var iLeft      = (screen.width)  ? (screen.width-w)/2  : 0;
	var iTop       = (screen.height) ? (screen.height-h)/2 : 0;
	var sSettings  = 'height='+h+',width='+w+',top='+iTop+',left='+iLeft+',scrollbars=no,resizable';
	m_oPanoramaWin = window.open(sUrl, "Panorama", sSettings);
	m_oPanoramaWin.focus();
}


function offerWindow(sUrl){
	var w = 550;
	var h = 450;
	var iLeft     = (screen.width)  ? (screen.width-w)/2  : 0;
	var iTop      = (screen.height) ? (screen.height-h)/2 : 0;
	var sSettings = 'height='+h+',width='+w+',top='+iTop+',left='+iLeft+',scrollbars=no,resizable';
	m_oOfferWin   = window.open(sUrl, "Angebot", sSettings);
	m_oOfferWin.focus();
}


function checkFrameset(){
	var url = document.location.href; 
//	alert("top.location.href: "+top.location.href+"\nurl: "+url);
	if (top.location.href==url) {
		top.location.href = 'http://baby-welt.at.mediadsign/baby-welt1/index_extern.php?url=' + escape(url);
	}
}


/**
 * addEvent handler for IE and other browsers
 * addEvent and removeEvent
 * cross-browser event handling for IE5+, NS6 and Mozilla (By Scott Andrew)
 * @param   obj          object  the object 2 add event
 * @param   sEvent       string  event name e. g. 'load' for 'onload'
 * @param   sFunc        string  function name 2 call
 * @param   bUseCapture  bool    flag 2 use capture
 * @return               bool    true on success, otherwhise false
 */
function addEvent(obj, sEvent, sFunc, bUseCapture){
	if (obj.addEventListener) {
		obj.addEventListener(sEvent, sFunc, bUseCapture);
		return true;
	} else if (obj.attachEvent){
		obj.attachEvent("on"+sEvent, sFunc);
		return true;
	}
	return false;
} 

/*
if (m_bDebug == false) {
	document.onmousedown = nrc;
	if (document.layers) window.captureEvents(Event.MOUSEDOWN);
	if (m_bIsNS && m_iBrowserVersion<5) window.onmousedown = nrc;
	document.onload = checkFrameset;
}
*/

if (m_bDebug == false) {
	//events 4 window.onload & document.onmousedown
	if (addEvent(window, "load", checkFrameset, false) == false) { window.onload=checkFrameset; }
	if (addEvent(document, "mousedown", nrc, false) == false) { document.onmousedown=nrc; }
}
