/************************************************************************
** JavaScript file used for various fnctions
************************************************************************/

/************************************************************************
** WINDOW OPENER
************************************************************************/
function showItem(imgType, imgName, imgDir, capt, size, desc, crDate)
{
	var imgNameExt = imgName + '.jpg';
	var imgDirFull = 'images/main/' + imgDir + "/" + imgNameExt;
	var imgFull = new Image();
	imgFull.src = imgDirFull; 
	var winHeight = imgFull.height + 150;
	//alert(winHeight);
	//return;
	
    var scr = window.screen;
    var x = (scr.availWidth / 2) - (740 / 2);
    if(x < 0)
    {
        x = 10;
    }
    
	var y = (scr.availHeight / 2) - (570 / 2);
    if(y < 0)
    {
        y = 10;
    }
	var workType = getWorkType(desc);
	var texts = writeText (capt, size, workType, crDate);
	//alert(texts);
	//return;
	var winNew = '';
	if ('7' == imgType) {
		winNew = window.open("","WinNew","top=" + y + ",left=" + x + ",width=580,height=710,dependant=0,toolbar=no,status=no");
		winNew.document.open();
		winNew.resizeTo(580, 710);
	}
	if ('1' == imgType) {
		winNew = window.open("","WinNew","top=" + y + ",left=" + x + ",width=580,height=690,dependant=0,toolbar=no,status=no");
		winNew.document.open();
		winNew.resizeTo(580, 690);
	}
	if ('6' == imgType) {
		winNew = window.open("","WinNew","top=" + y + ",left=" + x + ",width=580,height=630,dependant=0,toolbar=no,status=no");
		winNew.document.open();
		winNew.resizeTo(580, 630);
	}
	if ('5' == imgType) {
		winNew = window.open("","WinNew","top=" + y + ",left=" + x + ",width=580,height=580,dependant=0,toolbar=no,status=no");
		winNew.document.open();
		winNew.resizeTo(580, 580);
	}
	if ('2' == imgType) {
		winNew = window.open("","WinNew","top=" + y + ",left=" + x + ",width=580,height=530,dependant=0,toolbar=no,status=no");
		winNew.document.open();
		winNew.resizeTo(580, 530);
	}
	if ('3' == imgType) {
		winNew = window.open("","WinNew","top=" + y + ",left=" + x + ",width=580,height=480,dependant=0,toolbar=no,status=no");
		winNew.document.open();
		winNew.resizeTo(580, 480);
	}
	if ('4' == imgType) {
		winNew = window.open("","WinNew","top=" + y + ",left=" + x + ",width=580,height=430,dependant=0,toolbar=no,status=no");
		winNew.document.open();
		winNew.resizeTo(580, 430);
	}


	winNew.document.writeln("<html><head><title>" + capt + "</title>");
	winNew.document.writeln("</head>");
	winNew.document.writeln("<body><center>");
	winNew.document.writeln("<a href='javascript:self.close()'>Close window</a><br><br>");
	winNew.document.writeln("<table><tr><td width=80% align='center'><img onClick='javascript:self.close();'");
	winNew.document.writeln("src='" + imgDirFull + "' alt='" + capt + "'></td></tr></table>");
	winNew.document.writeln("<tr><td width=20% align='right' valign='top'>" + texts + "<br><br><br></td></tr>");
	winNew.document.writeln("</center></body>");
	winNew.document.writeln("</html>");	
}

function getWorkType(type) {
	var wType = '';
	if ('0' == type) wType = "Paper Pulp Painting"; 
	if ('1' == type) wType = "Rapidograph Ink pen"; 
	if ('2' == type) wType = "collagraph"; 
	if ('3' == type) wType = "Intaglio, collagraph, direct monotype,<br>Japanese hand made paper, acrylic"; 	
	if ('4' == type) wType = "Intaglio, collagraph, direct monotype,<br>Japanese hand made paper, collage, acrylic paint, India Ink";
	if ('5' == type) wType = "Intaglio, etching, relief"; 
	if ('6' == type) wType = "Intaglio, Xerox transfer, relief, Japanese hand made paper"; 
	if ('7' == type) wType = "Intaglio, collagraph, pronto plate lithography,<br>collage, relief, Japanese hand made paper, paper pulp"; 
	if ('8' == type) wType = "Micro pigment ink, permanent marker,<br>white-out, pencil from a sketch book"; 
	if ('9' == type) wType = "Digital Image"; 
	if ('10' == type) wType = "Pronto lithography"; 
	if ('11' == type) wType = "Pronto lithography, Xerox transfer, Rapidograph ink pen";
	if ('12' == type) wType = "Pronto lithography, Xerox transfer, woodcut relief, chincolle";
	if ('13' == type) wType = "Intaglio, collagraph, relief, Japanese hand made paper";
	if ('14' == type) wType = "Intaglio, collagraph, direct monotype, relief,<br>Japanese hand made paper, acrylic paint";
	if ('15' == type) wType = "Intaglio, collagraph, direct monotype,<br>relief, collage, pencil, acrylic";
	if ('16' == type) wType = "Dry point";
	if ('17' == type) wType = "Intaglio, collagraph, direct monotype,<br>relief, Japanese hand made paper ";
	if ('18' == type) wType = "Pronto lithography, Xerox transfer, hand made paper";
	if ('19' == type) wType = "Micro pigment ink, permanent marker,<br>white-out, color pencil";
	if ('20' == type) wType = "Pronto lithography, Xerox transfer";
	if ('21' == type) wType = "Intaglio, collagraph, Pronto lithography,<br>acrylic "; 	
	if ('22' == type) wType = "Intaglio, collagraph, Pronto lithography,<br>acrylic, pencil "; 	
	if ('23' == type) wType = "Rapidograph Ink pen, acrylic"; 
	if ('24' == type) wType = "Xerox of a drawing done on a pronto plate followed by a digital image";
	if ('25' == type) wType = "Xerox of a drawing done on a paper followed by a digital image";
	if ('26' == type) wType = "Drawing on a paper";
	if ('27' == type) wType = "Etching and water color on Western hand made paper";
	if ('28' == type) wType = "Relief, butcher paper, butcher tape, vegetable oil, ink"; 
	if ('29' == type) wType = "Relief, trash bags, butcher paper, butcher tape, vegetable oil, ink"; 
	if ('30' == type) wType = "Washable kids paint, acrylic, pencil, gesso"; 
	
	
	
	return wType;	
}

/*******************************************************************************************
	FUNCTION TO RETURN TEXT IN NEWLY OPENED WINDOW
********************************************************************************************/
function writeText (capt, size, desc, crDate)
{
	var text = "<font color='#000000' size='3' face='Arial'><em>" + capt + "<em></font><br>";
	text+="<font color='#000000' size='2' face='Arial'>" + size + "</font>&nbsp;&nbsp;<br>";
	text+="<font color='#000000' size='2' face='Arial'>" + desc + "</font>&nbsp;&nbsp;<br>";
	text+="<font color='#000000' size='2' face='Arial'>" + crDate + "</font>";
	return text;
}

