var xmlhttp = false;

function apu(url, id) {

	if (window.XMLHttpRequest) {     
		xmlhttp = new XMLHttpRequest(); 	
	} 

	else if (window.ActiveXObject) { 

		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {

		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (e) {}

	}
 }

if (xmlhttp) {

	document.getElementById(id).className = 'wait';

	xmlhttp.onreadystatechange = responseHandler; 
	xmlhttp.open('get', url, true);
	xmlhttp.send(null);

}

function responseHandler() {


	if (xmlhttp.readyState == 4) { 

	document.getElementById(id).className = 'ready';


	if (xmlhttp.status == 200 || window.location.href.indexOf("http")==-1) { 

	   document.getElementById(id).innerHTML=xmlhttp.responseText;
	   
	   
	   if (myLightWindow) {
	   
			Event.unloadCache();
			myLightWindow._setupLinks();
			myLightWindow._addLightWindowMarkup(false);
		}
	   
	   CSBfleXcroll('news_b');
	   CSBfleXcroll('referenzen_b');
	   CSBfleXcroll('downloads_b');
	
	} else {

		alert('Daten konnten nicht geladen werden..');
	}
  }
}


} // end


function popup_microsite() {
				w = window.open("http://www.royal-design.eu/fotografie/index.php","flash","toolbar=no,menubar=no,scrollbars=no,status=no,width=905,height=685");
				w.focus();
			}
function popup_sound() {
				w = window.open("http://www.royal-design.eu/sound/index.htm","flash","toolbar=no,menubar=no,scrollbars=no,status=no,width=445,height=270");
				w.focus();
			}

/* Quirks */



// xCore
/* Compiled from X 4.17 by XC 1.06 on 10Jul07 */
xLibrary={version:'4.17',license:'GNU LGPL',url:'http://cross-browser.com/'};function xCamelize(cssPropStr){var i,c,a=cssPropStr.split('-');var s=a[0];for(i=1;i<a.length;++i){c=a[i].charAt(0);s+=a[i].replace(c,c.toUpperCase());}return s;}function xClientHeight(){var v=0,d=document,w=window;if((!d.compatMode||d.compatMode=='CSS1Compat')&&!w.opera&&d.documentElement&&d.documentElement.clientHeight){v=d.documentElement.clientHeight;}else if(d.body&&d.body.clientHeight){v=d.body.clientHeight;}else if(xDef(w.innerWidth,w.innerHeight,d.width)){v=w.innerHeight;if(d.width>w.innerWidth)v-=16;}return v;}function xClientWidth(){var v=0,d=document,w=window;if((!d.compatMode||d.compatMode=='CSS1Compat')&&!w.opera&&d.documentElement&&d.documentElement.clientWidth){v=d.documentElement.clientWidth;}else if(d.body&&d.body.clientWidth){v=d.body.clientWidth;}else if(xDef(w.innerWidth,w.innerHeight,d.height)){v=w.innerWidth;if(d.height>w.innerHeight)v-=16;}return v;}function xDef(){for(var i=0;i<arguments.length;++i){if(typeof(arguments[i])=='undefined')return false;}return true;}function xGetComputedStyle(e,p,i){if(!(e=xGetElementById(e)))return null;var s,v='undefined',dv=document.defaultView;if(dv&&dv.getComputedStyle){s=dv.getComputedStyle(e,'');if(s)v=s.getPropertyValue(p);}else if(e.currentStyle){v=e.currentStyle[xCamelize(p)];}else return null;return i?(parseInt(v)||0):v;}function xGetElementById(e){if(typeof(e)=='string'){if(document.getElementById)e=document.getElementById(e);else if(document.all)e=document.all[e];else e=null;}return e;}function xGetElementsByClassName(c,p,t,f){var r=new Array();var re=new RegExp("(^|\\s)"+c+"(\\s|$)");var e=xGetElementsByTagName(t,p);for(var i=0;i<e.length;++i){if(re.test(e[i].className)){r[r.length]=e[i];if(f)f(e[i]);}}return r;}function xGetElementsByTagName(t,p){var list=null;t=t||'*';p=p||document;if(typeof p.getElementsByTagName!='undefined'){list=p.getElementsByTagName(t);if(t=='*'&&(!list||!list.length))list=p.all;}else{if(t=='*')list=p.all;else if(p.all&&p.all.tags)list=p.all.tags(t);}return list||new Array();}function xHasPoint(e,x,y,t,r,b,l){if(!xNum(t)){t=r=b=l=0;}else if(!xNum(r)){r=b=l=t;}else if(!xNum(b)){l=r;b=t;}var eX=xPageX(e),eY=xPageY(e);return(x>=eX+l&&x<=eX+xWidth(e)-r&&y>=eY+t&&y<=eY+xHeight(e)-b);}function xHeight(e,h){if(!(e=xGetElementById(e)))return 0;if(xNum(h)){if(h<0)h=0;else h=Math.round(h);}else h=-1;var css=xDef(e.style);if(e==document||e.tagName.toLowerCase()=='html'||e.tagName.toLowerCase()=='body'){h=xClientHeight();}else if(css&&xDef(e.offsetHeight)&&xStr(e.style.height)){if(h>=0){var pt=0,pb=0,bt=0,bb=0;if(document.compatMode=='CSS1Compat'){var gcs=xGetComputedStyle;pt=gcs(e,'padding-top',1);if(pt!==null){pb=gcs(e,'padding-bottom',1);bt=gcs(e,'border-top-width',1);bb=gcs(e,'border-bottom-width',1);}else if(xDef(e.offsetHeight,e.style.height)){e.style.height=h+'px';pt=e.offsetHeight-h;}}h-=(pt+pb+bt+bb);if(isNaN(h)||h<0)return;else e.style.height=h+'px';}h=e.offsetHeight;}else if(css&&xDef(e.style.pixelHeight)){if(h>=0)e.style.pixelHeight=h;h=e.style.pixelHeight;}return h;}function xLeft(e,iX){if(!(e=xGetElementById(e)))return 0;var css=xDef(e.style);if(css&&xStr(e.style.left)){if(xNum(iX))e.style.left=iX+'px';else{iX=parseInt(e.style.left);if(isNaN(iX))iX=xGetComputedStyle(e,'left',1);if(isNaN(iX))iX=0;}}else if(css&&xDef(e.style.pixelLeft)){if(xNum(iX))e.style.pixelLeft=iX;else iX=e.style.pixelLeft;}return iX;}function xMoveTo(e,x,y){xLeft(e,x);xTop(e,y);}function xNum(){for(var i=0;i<arguments.length;++i){if(isNaN(arguments[i])||typeof(arguments[i])!='number')return false;}return true;}function xOpacity(e,o){var set=xDef(o);if(!(e=xGetElementById(e)))return 2;if(xStr(e.style.opacity)){if(set)e.style.opacity=o+'';else o=parseFloat(e.style.opacity);}else if(xStr(e.style.filter)){if(set)e.style.filter='alpha(opacity='+(100*o)+')';else if(e.filters&&e.filters.alpha){o=e.filters.alpha.opacity/100;}}else if(xStr(e.style.MozOpacity)){if(set)e.style.MozOpacity=o+'';else o=parseFloat(e.style.MozOpacity);}else if(xStr(e.style.KhtmlOpacity)){if(set)e.style.KhtmlOpacity=o+'';else o=parseFloat(e.style.KhtmlOpacity);}return isNaN(o)?1:o;}function xPageX(e){var x=0;e=xGetElementById(e);while(e){if(xDef(e.offsetLeft))x+=e.offsetLeft;e=xDef(e.offsetParent)?e.offsetParent:null;}return x;}function xPageY(e){var y=0;e=xGetElementById(e);while(e){if(xDef(e.offsetTop))y+=e.offsetTop;e=xDef(e.offsetParent)?e.offsetParent:null;}return y;}function xResizeTo(e,w,h){xWidth(e,w);xHeight(e,h);}function xScrollLeft(e,bWin){var offset=0;if(!xDef(e)||bWin||e==document||e.tagName.toLowerCase()=='html'||e.tagName.toLowerCase()=='body'){var w=window;if(bWin&&e)w=e;if(w.document.documentElement&&w.document.documentElement.scrollLeft)offset=w.document.documentElement.scrollLeft;else if(w.document.body&&xDef(w.document.body.scrollLeft))offset=w.document.body.scrollLeft;}else{e=xGetElementById(e);if(e&&xNum(e.scrollLeft))offset=e.scrollLeft;}return offset;}function xScrollTop(e,bWin){var offset=0;if(!xDef(e)||bWin||e==document||e.tagName.toLowerCase()=='html'||e.tagName.toLowerCase()=='body'){var w=window;if(bWin&&e)w=e;if(w.document.documentElement&&w.document.documentElement.scrollTop)offset=w.document.documentElement.scrollTop;else if(w.document.body&&xDef(w.document.body.scrollTop))offset=w.document.body.scrollTop;}else{e=xGetElementById(e);if(e&&xNum(e.scrollTop))offset=e.scrollTop;}return offset;}function xStr(s){for(var i=0;i<arguments.length;++i){if(typeof(arguments[i])!='string')return false;}return true;}function xStyle(sProp,sVal){var i,e;for(i=2;i<arguments.length;++i){e=xGetElementById(arguments[i]);if(e.style){try{e.style[sProp]=sVal;}catch(err){e.style[sProp]='';}}}}function xTop(e,iY){if(!(e=xGetElementById(e)))return 0;var css=xDef(e.style);if(css&&xStr(e.style.top)){if(xNum(iY))e.style.top=iY+'px';else{iY=parseInt(e.style.top);if(isNaN(iY))iY=xGetComputedStyle(e,'top',1);if(isNaN(iY))iY=0;}}else if(css&&xDef(e.style.pixelTop)){if(xNum(iY))e.style.pixelTop=iY;else iY=e.style.pixelTop;}return iY;}function xWidth(e,w){if(!(e=xGetElementById(e)))return 0;if(xNum(w)){if(w<0)w=0;else w=Math.round(w);}else w=-1;var css=xDef(e.style);if(e==document||e.tagName.toLowerCase()=='html'||e.tagName.toLowerCase()=='body'){w=xClientWidth();}else if(css&&xDef(e.offsetWidth)&&xStr(e.style.width)){if(w>=0){var pl=0,pr=0,bl=0,br=0;if(document.compatMode=='CSS1Compat'){var gcs=xGetComputedStyle;pl=gcs(e,'padding-left',1);if(pl!==null){pr=gcs(e,'padding-right',1);bl=gcs(e,'border-left-width',1);br=gcs(e,'border-right-width',1);}else if(xDef(e.offsetWidth,e.style.width)){e.style.width=w+'px';pl=e.offsetWidth-w;}}w-=(pl+pr+bl+br);if(isNaN(w)||w<0)return;else e.style.width=w+'px';}w=e.offsetWidth;}else if(css&&xDef(e.style.pixelWidth)){if(w>=0)e.style.pixelWidth=w;w=e.style.pixelWidth;}return w;}


// xSlideTo

function xSlideTo(e, x, y, uTime)
{
  if (!(e=xGetElementById(e))) return;
  if (!e.timeout) e.timeout = 25;
  e.xTarget = x; e.yTarget = y; e.slideTime = uTime; e.stop = false;
  e.yA = e.yTarget - xTop(e); e.xA = e.xTarget - xLeft(e); // A = distance
  if (e.slideLinear) e.B = 1/e.slideTime;
  else e.B = Math.PI / (2 * e.slideTime); // B = period
  e.yD = xTop(e); e.xD = xLeft(e); // D = initial position
  var d = new Date(); e.C = d.getTime();
  if (!e.moving) _xSlideTo(e);
}
function _xSlideTo(e)
{
  if (!(e=xGetElementById(e))) return;
  var now, s, t, newY, newX;
  now = new Date();
  t = now.getTime() - e.C;
  if (e.stop) { e.moving = false; }
  else if (t < e.slideTime) {
	setTimeout("_xSlideTo('"+e.id+"')", e.timeout);

	s = e.B * t;
	if (!e.slideLinear) s = Math.sin(s);
//    if (e.slideLinear) s = e.B * t;
//    else s = Math.sin(e.B * t);

	newX = Math.round(e.xA * s + e.xD);
	newY = Math.round(e.yA * s + e.yD);
	xMoveTo(e, newX, newY);
	e.moving = true;
  }  
  else {
	xMoveTo(e, e.xTarget, e.yTarget);
	e.moving = false;
	if (e.onslideend) e.onslideend();
  }  
}

// xAddEventListener r8, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xAddEventListener(e,eT,eL,cap)
{
  if(!(e=xGetElementById(e)))return;
  eT=eT.toLowerCase();
  if(e.addEventListener)e.addEventListener(eT,eL,cap||false);
  else if(e.attachEvent)e.attachEvent('on'+eT,eL);
  else {
	var o=e['on'+eT];
	e['on'+eT]=typeof o=='function' ? function(v){o(v);eL(v);} : eL;
  }
}

function xScrollLeft(e, bWin)
{
  var offset=0;
  if (!xDef(e) || bWin || e == document || e.tagName.toLowerCase() == 'html' || e.tagName.toLowerCase() == 'body') {
	var w = window;
	if (bWin && e) w = e;
	if(w.document.documentElement && w.document.documentElement.scrollLeft) offset=w.document.documentElement.scrollLeft;
	else if(w.document.body && xDef(w.document.body.scrollLeft)) offset=w.document.body.scrollLeft;
  }
  else {
	e = xGetElementById(e);
	if (e && xNum(e.scrollLeft)) offset = e.scrollLeft;
  }
  return offset;
}





var slideTime = 500;

xAddEventListener(window, 'load',

  function () {

		xAddEventListener(window, 'scroll', winOnScroll, false); //Prüft ob gescrollt wird

  }, false

);



function winOnScroll() { // Scroll funktion

  xSlideTo('navi', xScrollLeft(), 0, slideTime);

}

function setSlideTime(st) {
  st = parseInt(st);
  if (!isNaN(st)) slideTime = st;
  var e = xGetElementById('st');
  e.value = st;
  return false;
}

//** Tab Content script v2.0- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
//** Updated Oct 7th, 07 to version 2.0. Contains numerous improvements:
//   -Added Auto Mode: Script auto rotates the tabs based on an interval, until a tab is explicitly selected
//   -Ability to expand/contract arbitrary DIVs on the page as the tabbed content is expanded/ contracted
//   -Ability to dynamically select a tab either based on its position within its peers, or its ID attribute (give the target tab one 1st)
//   -Ability to set where the CSS classname "selected" get assigned- either to the target tab's link ("A"), or its parent container 

////NO NEED TO EDIT BELOW////////////////////////

function ddtabcontent(tabinterfaceid){
  this.tabinterfaceid=tabinterfaceid //ID of Tab Menu main container
  this.tabs=document.getElementById(tabinterfaceid).getElementsByTagName("a") //Get all tab links within container
  this.enabletabpersistence=true
  this.hottabspositions=[] //Array to store position of tabs that have a "rel" attr defined, relative to all tab links, within container
  this.subcontentids=[] //Array to store ids of the sub contents ("rel" attr values)
  this.revcontentids=[] //Array to store ids of arbitrary contents to expand/contact as well ("rev" attr values)
  this.selectedClassTarget="link" //keyword to indicate which target element to assign "selected" CSS class ("linkparent" or "link")
}

ddtabcontent.getCookie=function(Name){ 
  var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
  if (document.cookie.match(re)) //if cookie found
	return document.cookie.match(re)[0].split("=")[1] //return its value
  return ""
}

ddtabcontent.setCookie=function(name, value){
  document.cookie = name+"="+value+";path=/" //cookie value is domain wide (path=/)
}

ddtabcontent.prototype={

  expandit:function(tabid_or_position){ //PUBLIC function to select a tab either by its ID or position(int) within its peers
	this.cancelautorun() //stop auto cycling of tabs (if running)
	var tabref=""
	try{
	  if (typeof tabid_or_position=="string" && document.getElementById(tabid_or_position).getAttribute("rel")) //if specified tab contains "rel" attr
		tabref=document.getElementById(tabid_or_position)
	  else if (parseInt(tabid_or_position)!=NaN && this.tabs[tabid_or_position].getAttribute("rel")) //if specified tab contains "rel" attr
		tabref=this.tabs[tabid_or_position]
	}
	catch(err){alert("Invalid Tab ID or position entered!")}
	if (tabref!="") //if a valid tab is found based on function parameter
	  this.expandtab(tabref) //expand this tab
  },

  setpersist:function(bool){ //PUBLIC function to toggle persistence feature
	  this.enabletabpersistence=bool
  },

  setselectedClassTarget:function(objstr){ //PUBLIC function to set which target element to assign "selected" CSS class ("linkparent" or "link")
	this.selectedClassTarget=objstr || "link"
  },

  getselectedClassTarget:function(tabref){ //Returns target element to assign "selected" CSS class to
	return (this.selectedClassTarget==("linkparent".toLowerCase()))? tabref.parentNode : tabref
  },

  expandtab:function(tabref){
	var subcontentid=tabref.getAttribute("rel") //Get id of subcontent to expand
	//Get "rev" attr as a string of IDs in the format ",john,george,trey,etc," to easily search through
	var associatedrevids=(tabref.getAttribute("rev"))? ","+tabref.getAttribute("rev").replace(/\s+/, "")+"," : ""
	this.expandsubcontent(subcontentid)
	this.expandrevcontent(associatedrevids)
	for (var i=0; i<this.tabs.length; i++){ //Loop through all tabs, and assign only the selected tab the CSS class "selected"
	  this.getselectedClassTarget(this.tabs[i]).className=(this.tabs[i].getAttribute("rel")==subcontentid)? "selected" : ""
	}
	if (this.enabletabpersistence) //if persistence enabled, save selected tab position(int) relative to its peers
	  ddtabcontent.setCookie(this.tabinterfaceid, tabref.tabposition)
  },

  expandsubcontent:function(subcontentid){
	for (var i=0; i<this.subcontentids.length; i++){
	  var subcontent=document.getElementById(this.subcontentids[i]) //cache current subcontent obj (in for loop)
	  subcontent.style.display=(subcontent.id==subcontentid)? "block" : "none" //"show" or hide sub content based on matching id attr value
	}
  },


  expandrevcontent:function(associatedrevids){
	var allrevids=this.revcontentids
	for (var i=0; i<allrevids.length; i++){ //Loop through rev attributes for all tabs in this tab interface
	  //if any values stored within associatedrevids matches one within allrevids, expand that DIV, otherwise, contract it
	  document.getElementById(allrevids[i]).style.display=(associatedrevids.indexOf(","+allrevids[i]+",")!=-1)? "block" : "none"
	}
  },

  autorun:function(){ //function to auto cycle through and select tabs based on a set interval
	var currentTabIndex=this.automode_currentTabIndex //index within this.hottabspositions to begin
	var hottabspositions=this.hottabspositions //Array containing position numbers of "hot" tabs (those with a "rel" attr)
	this.expandtab(this.tabs[hottabspositions[currentTabIndex]])
	this.automode_currentTabIndex=(currentTabIndex<hottabspositions.length-1)? currentTabIndex+1 : 0 //increment currentTabIndex
  },

  cancelautorun:function(){
	if (typeof this.autoruntimer!="undefined")
	  clearInterval(this.autoruntimer)
  },

  init:function(automodeperiod){
	var persistedtab=ddtabcontent.getCookie(this.tabinterfaceid) //get position of persisted tab (applicable if persistence is enabled)
	var persisterror=true //Bool variable to check whether persisted tab position is valid (can become invalid if user has modified tab structure)
	this.automodeperiod=automodeperiod || 0
	for (var i=0; i<this.tabs.length; i++){
	  this.tabs[i].tabposition=i //remember position of tab relative to its peers
	  if (this.tabs[i].getAttribute("rel")){
		var tabinstance=this
		this.hottabspositions[this.hottabspositions.length]=i //store position of "hot" tab ("rel" attr defined) relative to its peers
		this.subcontentids[this.subcontentids.length]=this.tabs[i].getAttribute("rel") //store id of sub content ("rel" attr value)
		this.tabs[i].onclick=function(){
		  tabinstance.expandtab(this)
		  tabinstance.cancelautorun() //stop auto cycling of tabs (if running)
		  return false
		}
		if (this.tabs[i].getAttribute("rev")){ //if "rev" attr defined, store each value within "rev" as an array element
		  this.revcontentids=this.revcontentids.concat(this.tabs[i].getAttribute("rev").split(/\s*,\s*/))
		}
		if (this.enabletabpersistence && parseInt(persistedtab)==i || !this.enabletabpersistence && this.getselectedClassTarget(this.tabs[i]).className=="selected"){
		  this.expandtab(this.tabs[i]) //expand current tab if it's the persisted tab, or if persist=off, carries the "selected" CSS class
		  persisterror=false //Persisted tab (if applicable) was found, so set "persisterror" to false
		  //If currently selected tab's index(i) is greater than 0, this means its not the 1st tab, so set the tab to begin in automode to 1st tab:
		  this.automode_currentTabIndex=(i>0)? 0 : 1
		}
	  }
	} //END for loop
	if (persisterror) //if an error has occured while trying to retrieve persisted tab (based on its position within its peers)
	  this.expandtab(this.tabs[this.hottabspositions[0]]) //Just select first tab that contains a "rel" attr
	if (parseInt(this.automodeperiod)>500 && this.hottabspositions.length>1){
	  this.automode_currentTabIndex=this.automode_currentTabIndex || 0
	  this.autoruntimer=setInterval(function(){tabinstance.autorun()}, this.automodeperiod)
	}
  } //END int() function

} //END Prototype assignment