function displayImage(picURL, title){

	// alert("entering picurl");

	// alert("picURL : " + picURL);

	image = new Image;

	image.src = picURL;

//	var loaded = false;
	
//	if (image.complete) { loaded = true; }
	
//	while (! loaded) { 

//		setTimeout('', 300000); 

//		if (image.complete) { loaded = true; }
		
//		alert("loaded : " + loaded); 
//	}
	
	var picWidth =  image.width;

	var picHeight = image.height;

	// alert("picWidth : " + picWidth);

	// alert("picHeight : " + picHeight);
	
	var widthOption = "width=" + picWidth;

	var heightOption = "height=" + picHeight;

	newWindow = window.open(picURL,
							'newWin',
							"toolbar=no,resizable=yes," + widthOption + "," + heightOption);

	// alert("window created");
	
	title = 'sup-art.com . . . . . . . .' + title;
	
	var message = "alert('calling fitPic')";
	
	newWindow.document.write('<html><head><title>' + title + '<\/title>');
	newWindow.document.write('<link href="..\/css\/main.css" rel="stylesheet" type="text\/css">');
	newWindow.document.write('<script language="JavaScript" src="..\/javascript\/main.js"><\/script>')
	newWindow.document.write('<\/head><body onLoad="alert\(\'\'\)">'); 
	newWindow.document.write('<img src="' + picURL + '"\/><\/body><\/html>');

	// alert("HTML written");
	
	// alert("clientWidth : " + newWindow.document.body.clientWidth);
	
	// alert("clientHeight : " + newWindow.document.body.clientHeight);

	if((picWidth != newWindow.document.body.clientWidth ||
	    picHeight != newWindow.document.body.clientHeight) &&
	   (picWidth > 0 && picHeight > 0)){

		//alert("resizing .........");

		newWindow.resizeBy(picWidth - newWindow.document.body.clientWidth, 
		                   picHeight - newWindow.document.body.clientHeight);

	}

	// alert("Window Resized");

	newWindow.focus();

	// alert('image.width : ' + image.width);;

	// alert('image.height : ' + image.height);
	
	// alert("window focused");
}


function PopupPhoto(sPicURL) {

    //alert("URL : " + "showPicture.html?"+ sPicURL + "&type=photo");

    window.open("showPicture.html?"+ sPicURL + "&photo", 'newWin', "location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no,left=0,top=0,HEIGHT=405,WIDTH=573");
} 

function PopupPainting(sPicURL) {

    //alert("URL : " + "showPicture.html?"+ sPicURL + "&type=painting");

    window.open("showPicture.html?"+ sPicURL + "&painting", 'newWin', "location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no,left=0,top=0,HEIGHT=483,WIDTH=591");
} 

function PopupWork(sPicURL) {

    //alert("URL : " + "showPicture.html?"+ sPicURL + "&type=work");

    window.open("showPicture.html?"+ sPicURL + "&work", 'newWin', "location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no,left=0,top=0,HEIGHT=498,WIDTH=746");
} 

function PopupWorkGraphics(sPicURL) {

    //alert("URL : " + "showPicture.html?"+ sPicURL + "&type=work");

    window.open("showPicture.html?"+ sPicURL + "&work", 'newWin', "location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no,left=0,top=0,HEIGHT=233,WIDTH=518");
}

function popupHome(){

    var features = "location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no,left=0,top=0,width=1006,height=670";
    
    //alert(features);

    window.open("./home.html",'supart',features);
}
