function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function fixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}

function openimgwin(){

openPopImg(cacheorigphoto, 'origineel', cacheorigwidth,cacheorigheight);

}
// Copyright 1999 - 2002 by Ray Stott, Pop-up Images Script ver 2.0
// OK to use if this copyright is included
// Script is available at http://www.crays.com/jsc

var pic = null
var popImg = null  // use this when referring to pop-up image
var picTitle = null
var imgCount = 0
var imgWinName = "popImg"

function openPopImg(picName, windowTitle, windowWidth, windowHeight){
  closePopImg()
  picTitle = windowTitle
  imgWinName = "popImg" + imgCount++ //unique name for each pop-up window
  popImg = window.open(picName, imgWinName,
           "toolbar=no,scrollbars=no,resizable=no,width=" 
           + (parseInt(windowWidth)+20)  + ",height=" 
           + (parseInt(windowHeight)+15)) 
  }
function closePopImg(){    // close pop-up window if it is open 
  if (navigator.appName != "Microsoft Internet Explorer" 
      || parseInt(navigator.appVersion) >=4) //do not close if early IE
    if(popImg != null) if(!popImg.closed) popImg.close() 
  }
function setStatus(msg){
  status = msg
  return true
  }

function getObj(name)
{
 if (document.getElementById)
 {
	   this.obj = document.getElementById(name);
 }
 else if (document.all)
 {
	   this.obj = document.all[name];
 }
 return this.obj;
}

function activatemenu(id){

	var thisdiv=getObj('sitemenu_a_'+id);
	if(thisdiv){
		thisdiv.className='active';
	}
	var thisdiv=getObj('sitemenu_li_'+id);
	if(thisdiv){
		thisdiv.className='active';
	}

}

// chooseRandom(myLowNum, myHighNum)
// function to create random integer.
// myLowNum (int) Lowest possible number to be chosen.
// myHighNum (int) Highest possible number to be chosen.
function chooseRandom(myLowNum, myHighNum) {
	// get the total range (from 0) for the random number to be chosen:
	var myRange = myHighNum - myLowNum + 1;

	// set a local variable named result to be a random integer in the range:
	var result = Math.floor(myRange * Math.random());

	// add the low number to the result to get a random number in the
	// corrected range:
	result += myLowNum;

	return result;

};

function shuffleArray(myArray, myTextArray) {
	var myRandomPosition;
	var myChoice;
	var myTextChoice;
	for (x=(myArray.length - 1); x > 0; x--) {
		myRandomPosition = chooseRandom(0, x);
		myChoice = myArray[myRandomPosition];
		myTextChoice = myTextArray[myRandomPosition];
		myArray[myRandomPosition] = myArray[x];
		myTextArray[myRandomPosition] = myTextArray[x];
		myArray[x] = myChoice;
		myTextArray[x] = myTextChoice;
	};
};

// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5500
// Duration of crossfade (seconds)
var crossFadeDuration = 18
// specify the currentUrl to link to
var currentUrl ='/modellen.php?modelid=2'
// Specify the image files
if(Pic && PicText){
	shuffleArray( Pic, PicText );
}

// =======================================
// do not edit anything below this line
// =======================================

var t
var j = 0
var p = Pic.length

var preLoad = new Array()
for (i = 0; i < p; i++){
   preLoad[i] = new Image()
   preLoad[i].src = Pic[i]
}

function runSlideShow(){
if(document.getElementById('SlideShow')){
   if (document.all){
      document.getElementById('SlideShow').style.filter="blendTrans(duration=2)"
      document.getElementById('SlideShow').style.filter="blendTrans(duration=crossFadeDuration)"
      document.getElementById('SlideShow').filters.blendTrans.Apply()
   }
   document.getElementById('SlideShow').src = preLoad[j].src
   currentUrl = PicText[j]
   if (document.all){
      document.getElementById('SlideShow').filters.blendTrans.Play()
   }
   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
}
}

function OpenSlideLink() {
   window.open(currentUrl,'_self');
}

