function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}
/*
Pop up window creator!!!

*/

function imgProps (section, imageUrl, imageW, imageH, imageTitle, bgColor){
	this.section = section;
	this.imageUrl = imageUrl;
	this.imageW = imageW;
	this.imageH = imageH;
	this.imageTitle = imageTitle;
	this.bgColor = bgColor;
}

function createProductImagesArray (){
	productImagesArray = new Array ();
	productImagesArray[0] = new imgProps ('arise', '/assets/images/products/bedrooms/arise_big.jpg', 488, 288, 'Arise', '#656598');
	productImagesArray[1] = new imgProps ('optima', '/assets/images/products/bedrooms/optima_big.jpg', 515, 301, 'Optima', '#656598');
	productImagesArray[2] = new imgProps ('symphonyII', '/assets/images/products/bedrooms/symphonyII_big.jpg', 500, 260, 'Symphony II', '#656598');
	
	productImagesArray[3] = new imgProps ('curtainCall', '/assets/images/products/entertainment/curtainCall_big.jpg', 404, 323, 'Malibu Hi-Lo', '#989865');
	productImagesArray[4] = new imgProps ('playhouse90', '/assets/images/products/entertainment/playhouse90_big.jpg', 404, 323, 'Broadway Curtain Call', '#989865');
	productImagesArray[5] = new imgProps ('eclipse', '/assets/images/products/entertainment/eclipse_large.jpg', 404, 327, 'Eclipse', '#989865');

	productImagesArray[6] = new imgProps ('sipario', '/assets/images/products/diningrooms/sipario_big.jpg', 529, 369, 'Sipario', '#958F81');
	productImagesArray[7] = new imgProps ('parsons', '/assets/images/products/diningrooms/parsons_large.jpg', 418, 336, 'Parsons', '#958F81');
	productImagesArray[8] = new imgProps ('sophisticate', '/assets/images/products/diningrooms/sophisticate_large.jpg', 500, 300, 'Sophisticate', '#958F81');
	
	productImagesArray[9] = new imgProps ('lotus', '/assets/images/products/vitrines/lotus_big.jpg', 332, 480, 'Lotus', '#656598');
	productImagesArray[10] = new imgProps ('lola', '/assets/images/products/vitrines/lola_big.jpg', 362, 501, 'Lola', '#656598');
	productImagesArray[11] = new imgProps ('lunaRene', '/assets/images/products/vitrines/lunaRene_big.jpg', 454, 468, 'Luna Rene', '#656598');
	
	productImagesArray[12] = new imgProps ('sonata', '/assets/images/products/whatsNew/sonata_large.jpg', 404, 274, 'Sonata', '#958F81');
	productImagesArray[13] = new imgProps ('arezzo', '/assets/images/products/whatsNew/arezzo_large.jpg', 404, 333, 'Luxe', '#958F81');
	productImagesArray[14] = new imgProps ('curtaincallsupreme', '/assets/images/products/whatsNew/soho_large.jpg', 404, 355, 'Soho Buffet', '#958F81');
	productImagesArray[15] = new imgProps ('trigon', '/assets/images/products/whatsNew/trigon_large.jpg', 404, 451, 'Tempo 3-Bay Vitrine', '#958F81');
}

function findSection (section) {
	var products = productImagesArray.length;
	for (i = 0; i < products; i++){
			if (section == productImagesArray[i].section){
				return i;
			}
	}
}

function createPopUp(section) {
	productId = findSection(section);
	var padding = 0;
	var windowWidth = productImagesArray[i].imageW + padding;
	var windowHeight = productImagesArray[i].imageH + padding;
	var windowProperties = 'width=' + windowWidth + ' height=' +  windowHeight + ' scrollbars=no resizable=yes';
	var mywindow = productImagesArray[i].section;
	
	mywindow = window.open('', '_blank', windowProperties);
	mywindow.document.write('<html>');
	mywindow.document.write('<head>');
	mywindow.document.write('<title>' + productImagesArray[i].imageTitle + '</title>');
	mywindow.document.write('<style>Body { margin: 0px; padding: 0px;}</style>');
	mywindow.document.write('</head>');
	mywindow.document.write('<body bgcolor=\"' + productImagesArray[i].bgColor + '\">');
	mywindow.document.write('<td align=\"center\">');
	mywindow.document.write('<img src=\"' + productImagesArray[i].imageUrl + '\" width=\"' + productImagesArray[i].imageW + '\" height=\"' + productImagesArray[i].imageH + '\" alt=\"' + productImagesArray[i].imageTitle +  '\" border=\"0\">');
	mywindow.document.write('</td>');
	mywindow.document.write('</body>');
	mywindow.document.write('</html>');
}
createProductImagesArray();

