// JavaScript Document
// Image Scripts for use at comcast website
function ImageInNewWinM(FullPathFileName,Title)
{
	var w = window.open('', '', 'width=800,height=600,resizable=yes,scrollbars=yes');
	w.document.write('<html><head><title>' + Title + '</title></' + 'head><body text=\"#ffffff\" bgcolor=\"#000000\"><div align=\"center\">');
	w.document.write('<a href=\"#\" onClick=self.close();><img src=\"' +  FullPathFileName  + '\" border=\"0\" align=\"center\"></a>');
	w.document.write('</div></body></html>');
}

function PreLoadFavoriteImages( number_of_images,image_path,filename_prefix,thumb_prefix_trailer )
{
	if(!document.PreloadArray)
	{
		document.PreloadArray=new Array();
	}
	var i;
	var j=document.PreloadArray.length;
	for(i=0;i<number_of_images;i++)
	{
		k=i+1;
		document.PreloadArray[j]=new Image;
		document.PreloadArray[j++].src=image_path + filename_prefix + thumb_prefix_trailer + k + '.jpg';
		//document.PreloadArray[j]=new Image;
		//document.PreloadArray[j++].src=image_path + filename_prefix + k + '.jpg';
		
	}
}

function PreLoadAll()
{
	PreLoadFavoriteImages(gcount,'Images/favorites/','favorites','t');
}

function DisplayImagesWI(beginning_index,final_index,number_of_columns,image_path,filename_prefix,thumb_prefix_trailer,number_images,album_title,display_width)
{
	var width_of_small_image=display_width;
	var caption_style='color:#ffffff;font-size:8pt;';
	var i=beginning_index;	//image index
	document.write('<div align=\"center\"><strong>' + album_title + '</strong>');
	document.write('<table align=\"center\" border=\"1\" cellspacing=\"1\" cellpadding=\"1\" bordercolor=\"#ffffff\" bgcolor=\"#000000\" bordercolorlight=\"#ffffff\"><tr><td>');
	//document.write('<div STYLE=\"width:400; height:100; overflow:auto;\">');
	document.write('<table align=\"center\" border=\"1\" cellspacing=\"1\" cellpadding=\"2\" bordercolor=\"#000000\" bgcolor=\"#000000\" bordercolorlight=\"#000000\"');
	while(i<=final_index)
	{
		LineNumber=i;
		document.write('<tr bgcolor="#000000">' + '<a name=\"Line' + LineNumber + '\">');
		for(var j=0;j<number_of_columns;j++)
		{
			if(i<=final_index)
			{
				document.write('<td valign=\"center\" align=\"center\">'); 
				if(number_images==true)
				{
					document.write('<font style=\"' + caption_style +'\">' + i + '</font>' + '<br>'); 
				}
				document.write('<a href=\"#Line' + LineNumber + '\" onClick=\"javascript:ImageInNewWinM(' + "\'" + image_path + filename_prefix + i + ".jpg\',\'" + "Display Large Version of Image \#" + i + "\'" + ');\">');
				document.write('<img src=\"' + image_path + filename_prefix + thumb_prefix_trailer + i + '.jpg\" width=\"' + width_of_small_image + '\" border=\"0\"></a></td>');
			}
			else
			{	 	 	
				document.write('<td>&nbsp;</td>');
			}
			i++;
		}
		document.write('</tr>');
	}
	document.write('</table>');
	//document.write('</div>');
	document.write('</td></tr></table>');	
	document.write('</div>');
}
