var loadedobjects=""
var containerid=""
var rootdomain="http://"+window.location.hostname
var newWindow = null
var Left = (screen.width-(200))/2
var Top = (screen.height-(220))/2

function makeNewWindow() {
    if (!newWindow || newWindow.closed) {
        newWindow = window.open("","sub","status,height=200,width=300");
        setTimeout("writeToWindow()", 50);
    } else if (newWindow.focus) {
        newWindow.focus();
    }
}
function writeToWindow(imname)
 {
  html = "<HTML><HEAD><TITLE>"+imname+"</TITLE>" +
  "</HEAD><BODY onblur='self.close()' "
  + "LEFTMARGIN=0 " 
  + "MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0><CENTER>" 
  + "<IMG SRC='" + myimage + "' BORDER=0 NAME=image " 
  + "onload='window.resizeTo(window.screen.availWidth/2, window.screen.availHeight/2)'>"
  + "</CENTER>"
  + "</BODY></HTML>";


    newWindow.document.write(html);
    newwindow.document.focus();
    newWindow.document.close();


}



function display3(myimage,imname)
 {

  if (!newWindow || newWindow.closed)
   {
        newWindow = window.open('','image','toolbar=0,status=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=1');
        setTimeout("writeToWindow(imname)", 50);
   } else if (newWindow.focus) {
        newWindow.focus();
   }

 
 }

function display(myimage,imname)
 {
  html = "<HTML><HEAD><TITLE>"+imname+"Photo</TITLE>" +
   "</HEAD><BODY onblur='self.close()' LEFTMARGIN=0 " 
   + "MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0><CENTER>" 
   + "<IMG SRC='" + myimage + "' BORDER=0 NAME=image " 
   + "onload='window.resizeTo(window.screen.availWidth/2, window.screen.availHeight/2)'>"
   + "</CENTER>" 
   + "</BODY></HTML>";
  popup=window.open('','image','toolbar=0,status=0,location=0,directories=0,menuBar=0,screenX=100,screenY=100,Top=100,scrollbars=0,resizable=1');
  popup.document.open();
  popup.document.write(html);
  popup.document.focus();
  popup.document.close();
  popup.moveTo(Left,Top);  
 };

function startAd() {
  if (window.screen) {
    pos = 0;
    aw = screen.availWidth;
    window.moveTo(pos, 0);
    timerID = setInterval("moveAd()", 50);
  }
}

function moveAd() {
  if (pos <= 0) inc = 5;
  // 5 - so it doesn't pass the right edge
  // 10 - accounts for the window chrome
  if (pos + 468 + 10 + 5 > aw) inc = -5;
  pos += inc;
  window.moveTo(pos, 0);
}




function wopen(url, name, w, h)
{
w += 32;
h += 96;
 var win = window.open(url,
  name, 
  'width=' + w + ', height=' + h + ', ' +
  'location=no, menubar=no, ' +
  'status=no, toolbar=no, scrollbars=no, resizable=no');
 win.resizeTo(w, h);
 win.focus();
}

function openWindow(contentURL,windowName,windowWidth,windowHeight) {
	widthHeight = 'height=' + windowHeight + ',width=' + windowWidth;
	newWindow = window.open(contentURL,windowName,widthHeight);
	newWindow.focus()
}

function closeWindow() {
	if (newWindow != null)  {	
	 newWindow.close();
	 newWindow = null;
	}
}

function toggleWindow(contentURL,windowName,windowWidth,windowHeight) {
	if (newWindow == null) {
		widthHeight = 'height=' + windowHeight + ',width=' + windowWidth;
		newWindow = window.open(contentURL,windowName,widthHeight);
		newWindow.focus()
	}
	else {	
	 			newWindow.close();
	 			newWindow = null;
	}
}

function changepage(url, containerid){
 var page_request = false
 if (window.XMLHttpRequest)
     page_request = new XMLHttpRequest()
 else if (window.ActiveXObject){
 try {
       page_request = new ActiveXObject("Msxml2.XMLHTTP")
     }
 catch (e){
  try{
      page_request = new ActiveXObject("Microsoft.XMLHTTP")
     }
 catch (e){}
 }
 }
 else
 return false
 page_request.onreadystatechange=function(){loadpage(page_request, containerid)}
 page_request.open('GET', url, true)
 page_request.send(null)
}

function changepageLan(url, containerid_1){
 var page_request = false
 if (window.XMLHttpRequest)
     page_request = new XMLHttpRequest()
 else if (window.ActiveXObject){
 try {
       page_request = new ActiveXObject("Msxml2.XMLHTTP")
     }
 catch (e){
  try{
      page_request = new ActiveXObject("Microsoft.XMLHTTP")
     }
 catch (e){}
 }
 }
 else
 return false
 // Main container
 if (containerid_1 == 'en')
   {	
     var containerid = "main"
     page_request.onreadystatechange=function(){loadpage(page_request, containerid)}
     page_request.open('GET', url, true)
     page_request.send(null)
  
   }
 if (containerid_1 == 'de')
   {	 
     var containerid = "main"
     page_request.onreadystatechange=function(){loadpage(page_request, containerid)}
     page_request.open('GET', url, true)
     page_request.send(null)
   }
 if (containerid_1 == 'nl')
   {	 
     var containerid = "main"
     page_request.onreadystatechange=function(){loadpage(page_request, containerid)}
     page_request.open('GET', url, true)
     page_request.send(null)
   }
 
}

function loadpage(page_request, containerid){
 if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
 document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs(){
 if (!document.getElementById)
 return
 for (i=0; i<arguments.length; i++){
  var file=arguments[i]
  var fileref=""
  if (loadedobjects.indexOf(file)==-1){ //Object exists
  if (file.indexOf(".js")!=-1){ //JS file
      fileref=document.createElement('script')
      fileref.setAttribute("type","text/javascript");
      fileref.setAttribute("src", file);
     }
  else if (file.indexOf(".css")!=-1){ //CSS file
   fileref=document.createElement("link")
   fileref.setAttribute("rel", "stylesheet");
   fileref.setAttribute("type", "text/css");
   fileref.setAttribute("href", file);
 }
 }
 if (fileref!=""){
 document.getElementsByTagName("head").item(0).appendChild(fileref)
 loadedobjects+=file+" " //Remember this object as being already added to page
 }
 }
}

var rotate_delay = 3000; 
current = 0;

function next() {
 if (document.slideform.slide[current+1])
 {
  document.images.show.src = document.slideform.slide[current+1].value;
  document.slideform.slide.selectedIndex = ++current;
 }
 else first();
}

function previous() {
 if (current-1 >= 0)
 {
  document.images.show.src = document.slideform.slide[current-1].value;
  document.slideform.slide.selectedIndex = --current;
 }
 else last();
}

function first() {
 current = 0;
 document.images.show.src = document.slideform.slide[0].value;
 document.slideform.slide.selectedIndex = 0;
}

function last() {
 current = document.slideform.slide.length-1;
 document.images.show.src = document.slideform.slide[current].value;
 document.slideform.slide.selectedIndex = current;
}

function ap(text) {
 document.slideform.slidebutton.value = (text == "Stop") ? "Start" : "Stop";
 rotate();
}

function change() {
 current = document.slideform.slide.selectedIndex;
 document.images.show.src = document.slideform.slide[current].value;
}

function rotate() {
 if (document.slideform.slidebutton.value == "Stop")
 {
  current = (current == document.slideform.slide.length-1) ? 0 : current+1;
  document.images.show.src = document.slideform.slide[current].value;
  document.slideform.slide.selectedIndex = current;
  window.setTimeout("rotate()", rotate_delay);
 }
}
