// JavaScript Document

function showPopup(imageName,orintaion){
	var pWidth = 700;
	var pHeight = 650;
	imageName = imageName.substring(0,imageName.indexOf('.')+1);
	imageName = (imageName+'jpg').toString();
	var scrLeft = parseInt(screen.width/2-(pWidth/2))+"px";
	var scrTop = parseInt(screen.height/2-(pHeight/2))+"px";
	var scrollB = 'yes';
	var settings='width='+pWidth+',height='+pHeight+',top='+scrTop+',left='+scrLeft+',scrollbars='+scrollB+',location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=yes';
	var popWin = new Object();
	popWin = window.open('','_blank',settings);
	i_width= parseInt(pWidth)+10;
	i_height=parseInt(pHeight)+10;
	
	var tabc='<html><head><title>Welcome Gallery NWA</title>';
		tabc+='	<meta http-equiv="Content-Type" content="text/html; charset=utf-8;">';
		tabc+='	<META HTTP-EQUIV="Expires" CONTENT="-1">';
		tabc+='	<META HTTP-EQUIV="Pragma" CONTENT="no-cache">';
		tabc+='	<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">';
		tabc+='<link rel="stylesheet" href="styles/compass.css">';
		tabc+='</head>';
		tabc+='<body>';
		tabc+='<table cellspacing="5" cellpadding="10" border="0"><tr><td>';
		tabc+='<table cellspacing="0" cellpadding="0" border="0" class="tabThumb" style="width:'+i_width+'; height:'+i_height+';">';
        tabc+='<tr>';
        tabc+=' <td class="borderTL"><img src="images/pixel.gif" width="5" height="5"></td>';
        tabc+=' <td class="imageHorT"><img src="images/pixel.gif" width="5" height="5"></td>';
        tabc+=' <td class="borderTR"><img src="images/pixel.gif" width="5" height="5"></td>';
        tabc+='</tr>';
        tabc+='<tr>';
        tabc+=' <td class="imageVerL"><img src="images/pixel.gif" width="5" height="5"></td>';
        if(orintaion == 'horizontal' && imageName != '')
			tabc+=' <td align="center" valign="middle"><img src="../images/Gallery_Pic/'+imageName+'" style="border:0px none #FFFFFF;"></td>';
		else if(orintaion == 'vertical' && imageName != '')
			tabc+=' <td align="center" valign="middle"><img src="../images/Gallery_Pic/'+imageName+'" style="border:0px none #FFFFFF;"></td>';
        else 
			tabc+=' <td align="center" valign="middle" class="redbold">No Thumbnail</td>';
		tabc+=' <td class="imageVerR"><img src="images/pixel.gif" width="5" height="5"></td>';
        tabc+='</tr>';
        tabc+='<tr>';
        tabc+=' <td class="borderBL"><img src="images/pixel.gif" width="5" height="5"></td>';
        tabc+=' <td class="imageHorB"><img src="images/pixel.gif" width="5" height="5"></td>';
        tabc+=' <td class="borderBR"><img src="images/pixel.gif" width="5" height="5"></td>';
        tabc+='</tr>';
        tabc+='</table>';
		tabc+='</td></tr></table>';
		tabc+='</body>';
		tabc+='<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8;">';
		tabc+='	<META HTTP-EQUIV="Expires" CONTENT="-1">';
		tabc+='	<META HTTP-EQUIV="Pragma" CONTENT="no-cache">';
		tabc+='	<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">';
		tabc+='</head></html>';
		popWin.document.write(tabc);	
		popWin.focus();
}

function getThumb(thumbName, orintaion,i_width, i_height){
	i_width= parseInt(i_width)+10;
	i_height=parseInt(i_height)+10;
	var tabc='<table cellspacing="0" cellpadding="0" border="0" class="tabThumb" style="width:'+i_width+'; height:'+i_height+';">';
        tabc+='<tr>';
        tabc+=' <td class="borderTL"><img src="../images/pixel.gif" width="5" height="5"></td>';
        tabc+=' <td class="imageHorT"><img src="../images/pixel.gif" width="5" height="5"></td>';
        tabc+=' <td class="borderTR"><img src="../images/pixel.gif" width="5" height="5"></td>';
        tabc+='</tr>';
        tabc+='<tr>';
        tabc+=' <td class="imageVerL"><img src="../images/pixel.gif" width="5" height="5"></td>';
        if(orintaion == 'horizontal' && thumbName != '')
			tabc+=' <td align="center" valign="middle"><img src="../images/thumb/'+thumbName+'" style="width:'+i_width+'; height:'+i_height+';border:0px none #FFFFFF;cursor:pointer;" onClick="showPopup(\''+thumbName+'\', \''+orintaion+'\');"></td>';
		else if(orintaion == 'vertical' && thumbName != '')
			tabc+=' <td align="center" valign="middle"><img src="../images/thumb/'+thumbName+'" style="width:'+i_width+'; height:'+i_height+';border:0px none #FFFFFF;cursor:pointer;" onClick="showPopup(\''+thumbName+'\', \''+orintaion+'\');"></td>';
        else 
			tabc+=' <td align="center" valign="middle" class="redbold">No Thumbnail</td>';
		tabc+=' <td class="imageVerR"><img src="../images/pixel.gif" width="5" height="5"></td>';
        tabc+='</tr>';
        tabc+='<tr>';
        tabc+=' <td class="borderBL"><img src="../images/pixel.gif" width="5" height="5"></td>';
        tabc+=' <td class="imageHorB"><img src="../images/pixel.gif" width="5" height="5"></td>';
        tabc+=' <td class="borderBR"><img src="../images/pixel.gif" width="5" height="5"></td>';
        tabc+='</tr>';
        tabc+='</table>';
		document.write(tabc);
}