// FUNCTION TO OPEN A NEW WINDOW, ONLY dnum NEEDS TO CHANGE AS DATA IN '2D' ARRAY
// DNUM CALL STARTS AT ONE ALTHOUGH ARRAYS NUMBER FROM 0 WITH title
// det is existing global variable from inline script
function Winopen(mypage,myname,dnum){
fabricgroup=winstat
pos=dnum
des=det[pos][0];
col=det[pos][1];
dim=det[pos][2];
fabcon=det[pos][3];
price=det[pos][4];
comment=det[pos][5];
roomshots=false
if (myname=="room")
 {roomshots=true}

if (roomshots)
    {
	// Run Roomshots picture popup code.

	//NEW WINDOW SETTINGS
	settings ='height=735,width=760,top=5,left=5,resizable'
	roomviewer = window.open("",myname,settings);

	//HTML OUTPUT, CODE FOR NEW WINDOW WRITTEN ON THE FLY

	output="<html>"
	output+="<head>"
	output+="<title>"+fabricgroup+"</title>"
                
                output+="<script language='javascript'>"
                output+="var i=0;"
                output+="function resize() {"
                output+="if (document.images[0]) window.resizeTo(document.images[0].width +40, document.images[0].height+175-i);" 
                output+="self.focus();"
                output+="}"
                output+="//--></script>"
//
                output+="</head>"
//
	output+="<body topmargin='3' leftmargin='3' background='../../_themes/canvas2/cnvbkgnd.jpg' bgcolor='#FFFFFF' text='#000000' link='#0066CC' vlink='#006666' alink='#996699'   onload='resize();'>"

                  

	output+="<div align='center'><center>"
	//
	output+="  <table border='0' cellpadding='2' cellspacing='0' style='border-collapse: collapse' >"
	output+="    <tr>"
	output+="      <td align='center' valign='top'>"
	//
	output+="      <img border='0' src="+mypage+"></td>"
	output+="    </tr>"
	output+="    <tr>"
	//
	// 100% height below 'pushes' Close Window link to bottom of open widow as this row grows as large as it can !
	output+="    <td align='center' valign='top' width='755' height='100%'>"
	output+="      <p><b><font face='Arial' size='2'>"
	output+="      "+des+" </font></b></td>"
	output+="    </tr>"
	//
	// Height of 20below reserves some space for the Close Window link at bottom of the table.
	output+="    <tr>"
	output+="    <td align='center' valign='top' height='25' width='755'><b>"
	output+="      <font face='Arial' color='#FF0000'><a href='javascript:window.close()'>"
	output+="    <font size='2'>Close"
	output+="      Window</font></a></font></b></td>"
	output+="    </tr>"
	//
	output+="  </center>"
	output+="  </table>"
	output+="</div>"
	output+="</body>"

	output+="</html>"
	
	roomviewer.document.write(output);
	roomviewer.document.close();

	roomviewer.focus();

	
	}
else
	{
	// Run normal picture popup code.

//NEW WINDOW SETTINGS
//
//
settings ='height=460,width=587,top=5,left=5,resizable'
viewer = window.open("",myname,settings);
//


//HTML OUTPUT, CODE FOR NEW WINDOW WRITTEN ON THE FLY

output="<html>"
output+="<head>"
output+="<title>"+fabricgroup+"</title></head>"
output+="<body topmargin='3' leftmargin='3' background='../../_themes/canvas2/cnvbkgnd.jpg' bgcolor='#FFFFFF' text='#000000' link='#0066CC' vlink='#006666' alink='#996699'>"
output+="<div align='center'><center>"
output+="  <table border='0' cellpadding='2' cellspacing='0' style='border-collapse: collapse' height='454'>"
output+="    <tr>"
output+="      <td align='center' rowspan='7' height='450' width=10 valign='top'>"
output+="      <img border='0' src="+mypage+"></td>"
output+="    <td align='left' valign='top' height='43'>"
output+="      <p><b><font face='Arial' size='2'>Design:<br>"
output+="      "+des+" </font></b></td>"
output+="    </tr>"
output+="    <tr>"
output+="    <td align='left' valign='top' height='44' width='120'>"
output+="      <p><b><font face='Arial' size='2'>Colour:<br>"
output+="      "+col+" </font></b></td>"
output+="    </tr>"
output+="    <tr>"
output+="    <td align='left' valign='top' height='44' width='120'>"
output+="      <p><b><font size='2' face='Arial'>Width/Patt.Rpt:<br>"
output+="      "+dim+" </font></b></td>"
output+="    </tr>"
output+="    <tr>"
output+="    <td align='left' valign='top' height='44' width='120'>"
output+="      <p><b><font face='Arial' size='2'>Fabric Content:<br>"
output+="      "+fabcon+" </font></b></td>"
output+="    </tr>"
output+="    <tr>"
output+="    <td align='left' valign='top' height='44' width='120'>"
output+="      <p><b><font face='Arial' size='2'>Price:<br>"
output+="      "+price+" </font></b></td>"
output+="    </tr>"
output+="    <tr>"
output+="    <td align='left' valign='top' height='180 width='120'>"

output+="      <p><b><font face='Arial' size='2'>"
output+="      "+comment+" </font></b></td>"

output+="    </tr>"
output+="    <tr>"
output+="    <td align='left' valign='bottom' height='20' width='120'><b>"
output+="      <font face='Arial' color='#FF0000'><a href='javascript:window.close()'>"
output+="    <font size='2'>Close"
output+="      Window</font></a></font></b></td>"
output+="    </tr>"
output+="  </center>"
output+="  </table>"
output+="</div>"
output+="</body>"

output+="</html>"
	viewer.document.write(output);
	viewer.document.close();

	viewer.focus();}
	}

