﻿function setZoom() {
	var theIframe=document.frames["ImgHolder"];
	if (theIframe){
		var theImage=theIframe.document.images[0];
		var theTitle=theIframe.document.location.search;
		theImage.title=unescape(theIframe.document.location.search.substring(1,theIframe.document.location.search.length));
		//theIframe.document.body.style.backgroundColor='#777777';
		theIframe.document.body.style.textAlign='center';
		if (document.getElementById) {var zoomAmount=(document.getElementById("oImgHolder").style.pixelWidth / theImage.width) * 100}
		else {var zoomAmount=((theIframe.document.body.clientWidth + 17) / theImage.width) * 100}
		if (zoomAmount>100) {zoomAmount=100}
		theIframe.document.body.style.zoom=zoomAmount + '%';
		if (document.getElementById) {document.getElementById("oImgHolder").style.pixelHeight=parseInt(theImage.height * (zoomAmount / 100))}
		}
	}

function swapImgRestore() { 
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
function preloadImages() { 
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
	}
function findObj(n, d) { 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
	}
function swapImage() { 
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
function showHideLayers() {
  var i,p,v,obj,args=showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style	; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
	}

function removeOptions(SelectRef,Length) {SelectRef.options.length=Length}

function addOption(SelectRef,TheText,TheValue) {SelectRef.options[SelectRef.options.length] = new Option(TheText,TheValue)}
	
function setMinPrice(fieldRef) {
	whichArray = fieldRef[fieldRef.selectedIndex].value;
	if (whichArray=='1'){
		var maxArray = rentalMaxPrice;
	}
	if (whichArray=='2'){
		var maxArray = rentalMaxPrice;
	}
	if (whichArray=='0'){
		var maxArray = buyMaxPrice;	
	}	
	var maxval = 0;

	removeOptions(fieldRef.form.PriceMax,0);
	//addOption(fieldRef.form.PriceMax,'Please select','');	

	for (var i=0; i<maxArray.length; i++) {
		if (maxArray[i]==10000000){
			maxval='> €' + maxArray[i-1];
		}else{
			maxval = '€' + maxArray[i];
		}
		addOption(fieldRef.form.PriceMax,maxval,maxArray[i]);
		}
		fieldRef.form.PriceMax.selectedIndex = fieldRef.form.PriceMax.length -1		
	}

function player() {
if(document.registration.Full_Name.value=="")
{
alert("Please enter your full name");
document.registration.Full_Name.focus();
return false;
}
else
if(document.registration.Email_Address.value=="")
{
alert("Please enter your email address");
document.registration.Email_Address.focus();
return false;
}
else
{
var r=confirm("Please confirm that this is your email address: "+document.registration.Email_Address.value)
if (r==true)
return true;
}
	}

function addToPortfolio(PID,Message,SiteRoot) {
	var strPIDlist=FSfncReadCookie("Portfolio");
	var dtExpires= new Date();
	dtExpires.setFullYear(dtExpires.getFullYear() + 1)
	if (("," + strPIDlist).indexOf("," + PID + ",")==-1) {FSfncSetCookie("Portfolio",strPIDlist + PID + ",",dtExpires,SiteRoot)}
	alert(Message);
	}

function FSfncReadCookie(key) {
	var cookie_string='' + document.cookie;
	var cookie_array=cookie_string.split('; ');
	for (var i=0; i<cookie_array.length; i++) {
		var single_cookie=cookie_array[i].split('=');
		if (single_cookie.length!=2) {continue}
		if (key==unescape(single_cookie[0])) {return unescape(single_cookie[1])}
		}
	return "";
	}

function FSfncSetCookie(name,value,expires,path,domain,secure) {
	document.cookie=name + '=' + escape(value) + ((expires == null) ? '' : ('; expires=' + expires.toGMTString())) + ((path == null) ? '' : ('; path=' + path)) + ((domain == null) ? '' : ('; domain=' + domain)) + ((secure == true) ? '; secure' : '');
	}

var yPosition = 43;
//new ypSlideOutMenu("number menu", "slide position", left, top, width, height)
new ypSlideOutMenu("menu1", "down",  -1, yPosition, 170, 300)
new ypSlideOutMenu("menu2", "down", 127, yPosition, 170, 130)
new ypSlideOutMenu("menu3", "down", 277, yPosition, 170, 120)
new ypSlideOutMenu("menu4", "down", 426, yPosition, 170, 205)
new ypSlideOutMenu("menu5", "down", 575, yPosition, 170, 205)

var rentalMaxPrice=new Array(100,150,200,250,500,750,1000,1500,2000,10000000);
var buyMaxPrice=new Array(30000,50000,100000,150000,200000,250000,300000,350000,400000,450000,500000,1000000,2000000,3000000,4000000,5000000,10000000);
