if (window.location.protocol=='file:')
	{path='./deutsch/pictures_3/'}
else	//remote version
	{path='http://www.piemontimmobilien.ch/pictures_3/'}

// function newCH(pic) {window.open(path+pic, 'newCH', 'scrollbars=0,resizable=1,width=760,height=520');}
// pic 720 x 480 
//function newCV(pic) {window.open(path+pic, 'newCV', 'scrollbars=1,resizable=1,width=460,height=670');}
// pic 420 x 630
//function newH(pic) {window.open(path+pic, 'newH', 'scrollbars=0,resizable=1,width=680,height=520');}    
//pic 640 x 480
// function newV(pic) {window.open(path+pic, 'newV', 'scrollbars=1,resizable=1,width=520,height=680');}
//pic 480 x 640

function display(pic,pic_width,pic_height,legend) {

x=screen.width;
y=screen.height;
u=eval(pic_width);
v=eval(pic_height);
w=200;			//text-area height - min 180, but see Opera at 1280x1024
z=(v+w);		//temp variable used for small picture
t=(y-w);		//temp variable used for large picture

if (z<y)	{					// small picture
	y_new=z;					//window height reduced to picture height + text height
	x_new=parseInt(z*(x/y));	//window width reduced in proportion
	a=v;           	 			// image height unchanged
	b=u;						// image width unchanged
	}
else	{					//large picture		
	y_new=y;				//window height unchanged
	x_new=x;				//window width unchanged
	a=t;					//image height reduced to screen height - text height
	b=parseInt(t*(u/v));	//image width reduced in proportion
	}
	
p_number=pic.substring(1,4)	// extract property no. from picture filename, excluding first character
							// Note that first character in string "pic" is ALWAYS "P"

prefix='P'					// all prefixes set to P
if (p_number=='313')	{	// except V313
	prefix='V'
	}

// Jul 2011 New version. Was scrollbars=0,resizable=0 
// Note that you can't FORCE a new window in Opera 11 if
// user deselects the "open windows instead of tabs" option.
// This change gives scrollbars in Opera 11 when user allows only new tabs: scrollbars
// provide a visual clue that only a part of the image is being viewed.

var popup=window.open('','fullscreen','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=1,resizable=1,status=0,titlebar=0');
//popup.location.href = '';	     required for safari 3 bug??
popup.document.open();  // nb escape ALL forward slashes
popup.document.write("<html><head><title>Piedmont Properties "+prefix+p_number+"<\/title><\/head>");
popup.document.write("<body bgcolor='#ffffff' style='font-family:verdana;font-size:12px;' onUnload='window.blur()'>");
popup.document.write("<center><img src='"+path+pic+"' height='"+a+"' width='"+b+"'><br>"+legend);
popup.document.write("<br><br><a href='javascript:window.close();'>Close<\/a>");	
popup.document.write("<\/center><\/body><\/html>");
popup.document.close();
popup.moveTo(0,0);
popup.resizeTo(x_new,y_new); 
popup.focus();
}
