function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}

function printHeader()
{
	FPHdr = "Images/Banners/Hdr_"
	LPHdr = ".jpg"
	
	NumberOfImagesToRotate = 15;
	var r = Math.ceil(Math.random() * NumberOfImagesToRotate);
	imgH = FPHdr + Right('000'+r,3) + LPHdr
	imgHdr.src = imgH
}

function OpenMyViewer(prjType, prjNo, prjCount, strTitle, intStartFrom)
{
	prjToView = 'Portfolio/' + prjType + '/Images/' + prjType + '-' + prjNo
	imgMain = prjToView + '-1.jpg'
		intLPos=0
		intTPos=0
		
	intCount = 1
	intButton = 1
	strButton = ''
	strAllButton = ''
	
	strObjectName = 'strProjectDescription'
	
	if (intStartFrom==0)
	{
		intCount = 0
		prjCount = prjCount - 1
		imgMain = prjToView + '-0.jpg'
	}
	
	while(intCount<=prjCount)
	{
		if (intStartFrom == 0)
		{
			intButton = intCount + 1
		}
		else
		{
			intButton = intCount
		}
		
		
		imgToView = prjToView + '-' + intCount + '.jpg'
		strOnClick = 'onclick="imgDisplay.src=\'' + imgToView + '\'"'
		
		strButton = '<INPUT ' + strOnClick + ' style="cursor:hand;border:0px solid #557998; FONT-SIZE: 7 pt; WIDTH: 15; COLOR: White; FONT-FAMILY: Verdana; HEIGHT: 15; BACKGROUND-COLOR: #557998; padding-left:2px; padding-right:2px; padding-top:0px; padding-bottom:1px" type="submit" value="' + intButton + '">'
		
		//strButton = '<a href="#" onclick="' + strOnClick + '>' + intCount + '</a>'
		strAllButton =  strAllButton + ' ' + strButton
		intCount = intCount + 1
	}


	if(screen)
	{
		intLPos=(screen.width-500)/2
		intTPos=(screen.height-500)/2
	}
	newPopUp = window.open('','','scrollbars=no,width=500,height=500, left='+ intLPos + ', top=' + intTPos)
	newPopUp.document.write('<html><head><title>Prismagraphia: ' + strTitle + '</title></head><style type = "text/css">	.NavOn {background-color:"#557998";color:white;font-family:Verdana; color:white;font-size:7pt;}	.NavOff {background-color:"#7D9BB7";color:white; font-family:Verdana; color:white;}		.ThumbOff{filter:progid:DXImageTransform.Microsoft.Alpha(opacity=50);-moz-opacity: 0.5;}	.ThumbOn{filter:progid:DXImageTransform.Microsoft.Alpha(opacity=100);-moz-opacity: 1;}</style><body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" bgcolor="#364A5F" onload="self.focus()"><table border="0" width="100%" id="table1" cellspacing="0" cellpadding="0" height="100%">	<tr>		<td align="center"><div align="center">			<table border="0" width="450" id="table10" cellspacing="0" cellpadding="0" height="40">				<tr>					<td width="200">					<p style="margin-top: 0; margin-bottom: 0">					<a href="http://www.prismagraphia.com">	<img border="0" src="Images/Logo.gif" width="200" height="30"></a></td>					<td width="550">					<p style="margin-top: 0; margin-bottom: 0" align="right">						&nbsp;</td>				</tr>			</table>			<p style="margin-top: 0; margin-bottom: 0">			<font face="Verdana" style="font-size: 3pt">&nbsp;</font></p>	<table border="0" width="450" id="table11" cellpadding="0" bgcolor="#FFFFFF" bordercolor="#FFFFFF" height="400" style="border-width:1px; border-collapse:collapse">		<tr>			<td style="border-left-style:solid; border-left-width:1px; border-right-style:solid; border-right-width:1px; border-top-style:none; border-top-width:medium; border-bottom-style:solid; border-bottom-width:1px" valign="top" bgcolor="#FFFFFF">			<div align="center">				<table border="0" width="400" id="table18" height="0" cellpadding="0" style="border-collapse: collapse">					<tr>						<td>&nbsp;</td>					</tr>					<tr>						<td height="300" style="border-style: solid; border-width: 1px" bordercolor="#000000">						<img id="imgDisplay" src = ' + imgMain + ' border="0" width="400" height="300"></td>					</tr>					<tr>						<td height="20" style="border-bottom-style: solid; border-bottom-width: 1px">						<font face="Verdana" style="font-size: 7pt" color="#7D9BB7">						<p id = "strProjectDescription" align="center">' + strTitle + '</p></font></td>					</tr>					<tr>						<td height="20" style="border-top-style: solid; border-top-width: 1px"><font face="Verdana" style="font-size: 7pt" color="#808080">Images :</font>' + strAllButton + '</td>					</tr>				</table>			</div>			</td>		</tr>	</table></div><div align="center">	<table id="table17" height="20" cellSpacing="0" cellPadding="0" width="450" border="0">		<tr>			<td>			<p style="margin-top: 0; margin-bottom: 0" align="center">			<font style="FONT-SIZE: 7pt" face="Verdana" color="#D6DFE9">			Copyright © Prismagraphia 2007. All rights reserved</font></td>		</tr>		</table></div>		</td>	</tr></table></body></html>')
	
	newPopUp.document.close
}
