if (numLgImages>0)
{
	var browserName=navigator.appName;
	var rand_no =	Math.round((numLgImages-1)*Math.random());
	var arr_lrg_images = lrgImage.split("|");
	var file_name = arr_lrg_images[rand_no];
	var file_type = file_name.substring((file_name.length-3),file_name.length);
	var arr_image_links = lrgImageLink.split("|");
	var link_value = arr_image_links[rand_no];
	var saved_no = rand_no;
//alert("numLgImages="+numLgImages);
}

//alert("lrgImage="+lrgImage);
//alert("file_name="+file_name);
//alert("file_type="+file_type);
//alert("lrgImageLink="+lrgImageLink);
//alert("link_value="+link_value);
//alert("rand_no="+rand_no);

function handlePrev()
{
	if (saved_no > 0)
	{
		saved_no--;
	}else{
		saved_no = numLgImages-1;
	}
	file_name = arr_lrg_images[saved_no];
	file_type = file_name.substring((file_name.length-3),file_name.length);
	arr_image_links = lrgImageLink.split("|");
	link_value = arr_image_links[saved_no];

	document.getElementById("main_img").src = file_name;
	document.getElementById("main_link").href = link_value;
}

function handleNext()
{
	if (saved_no < (numLgImages-1))
	{
		saved_no++;
	}else{
		saved_no = 0;
	}
	file_name = arr_lrg_images[saved_no];
	file_type = file_name.substring((file_name.length-3),file_name.length);
	arr_image_links = lrgImageLink.split("|");
	link_value = arr_image_links[saved_no];

	document.getElementById("main_img").src = file_name;
	document.getElementById("main_link").href = link_value;
}

function writeImage()
{
	if(!(file_type=="swf")) //file is not flash
	{
		if (browserName=="Netscape")
		{
			document.write('<td colspan="2" style="position: absolute; z-index: 0;">');

			if(!(link_value==""))
			{
				document.write('<A id="main_link" href="'+link_value+'">');
			}
			document.write('<IMG SRC="'+file_name+'" id=main_img name=main_img border=0 alt="center column image">');

			if(!(link_value==""))
			{
				document.write('</A>');
			}

			document.write('</td>');
		}
		else
		{
			if (browserName=="Microsoft Internet Explorer")
			{
				document.write('<td colspan="2" style="position: relative; z-index: 0;">');

				if(!(link_value==""))
				{
					document.write('<A id="main_link" href="'+link_value+'">');
				}

				document.write('<IMG SRC="'+file_name+'" id=main_img name=main_img border=0 alt="center column image">');

				if(!(link_value==""))
				{
					document.write('</A>');
				}
				document.write('</td>');
			}
			else
			{
				document.write('<td colspan="2" style="position: absolute; z-index: 0;">');
				if(!(link_value==""))
				{
					document.write('<A id="main_link" href="'+link_value+'">');
				}
				document.write('<IMG SRC="'+file_name+'" id=main_img name=main_img border=0 alt="center column image">');
				if(!(link_value==""))
				{
					document.write('</A>');
				}
				document.write('</td>');
			}
		}
	}
	else //file is flash
	{
	    document.write('<td colspan="2" width="395" height="237" style="position: absolute; z-index: 0;">');
	    //document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" id="main_img" width="395" height="212" >');
	    //document.write('<PARAM NAME=movie value="'+file_name+'">');
	    //document.write('<PARAM NAME=quality VALUE=high>');
	    //document.write('<PARAM NAME=bgcolor VALUE=#FFFFFF>');
	    document.write('<param name="wmode" value="transparent" />');
	    if (!(link_value == "")) 
	    {
	        document.write('<A id="main_link" href="' + link_value + '">');
	    }
	    document.write('<EMBED src="' + file_name + '"  quality="high" bgcolor="#ffffff" width="395" height="237" name="main_img"   ALIGN="middle" allowScriptAccess="sameDomain" wmode="transparent" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
	    document.write('</EMBED>');
	    if (!(link_value == "")) 
	    {
	        document.write('</A>');
	    }
	    //document.write('</OBJECT>');
	    document.write('</td>');
	    
		/*if (browserName=="Netscape")
		{
			document.write('<td colspan="2" style="position: absolute; z-index: 0;">');
			document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab# version=8,0,0,0" id="main_img" align="middle">');
			document.write('<param name="allowScriptAccess" value="sameDomain" />');
			document.write('<param name="movie" value="+file_name+" />');
			document.write('<param name="quality" value="high" />');
			document.write('<param name="wmode" value="transparent" />');
			//document.write('<param name="bgcolor" value="#ffffff" />');
			document.write('<A id="main_link" href="'+link_value+'">');
			document.write('<embed src="'+file_name+'" quality="high" wmode="transparent" bgcolor="#ffffff" id=main_img name="main_img" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
			document.write('</A>');
			document.write('</object>');
			document.write('</td>');
		}
		else
		{
			if (browserName=="Microsoft Internet Explorer")
			{
					document.write('<td colspan="2" style="position: relative; z-index: 0;">');
					document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab# version=8,0,0,0" id="main_img" align="middle">');
					document.write('<param name="allowScriptAccess" value="sameDomain" />');
					document.write('<param name="movie" value="+file_name+" />');
					document.write('<param name="quality" value="high" />');
					document.write('<param name="wmode" value="transparent" />');
					//document.write('<param name="bgcolor" value="#ffffff" />');
					document.write('<A id="main_link" href="'+link_value+'">');
					document.write('<embed src="'+file_name+'" quality="high" wmode="transparent" bgcolor="#ffffff" id=main_img name="main_img" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
					document.write('</A>');
					document.write('</object>');
					document.write('</td>');
			}
			else
			{
					document.write('<td colspan="2" style="position: absolute; z-index: 0;">');
					document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab# version=8,0,0,0" id="main_img" align="middle">');
					document.write('<param name="allowScriptAccess" value="sameDomain" />');
					document.write('<param name="movie" value="+file_name+" />');
					document.write('<param name="quality" value="high" />');
					document.write('<param name="wmode" value="transparent" />');
					//document.write('<param name="bgcolor" value="#ffffff" />');
					document.write('<A id="main_link" href="'+link_value+'">');
					document.write('<embed src="'+file_name+'" quality="high" wmode="transparent" bgcolor="#ffffff" id=main_img name="main_img" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
					document.write('</A>');
					document.write('</object>');
					document.write('</td>');
			}
		}*/
	}
}

function writeNav() 
{
    if (!(file_type == "swf")) //file is not flash
    {
        // write the prev/next nav for images
        document.write('<td width="49%" align="left" bgcolor="#000000" class="imageNav" onMouseOver="this.style.color=\'#cc6600\'" onMouseOut="this.style.color=\'#ffffff\'" onClick="handlePrev();">');
        document.write('&nbsp;&lt;&lt;Previous');
        document.write('</td>');
        document.write('<td width="50%" align="right" bgcolor="#000000" class="imageNav" onMouseOver="this.style.color=\'#cc6600\'" onMouseOut="this.style.color=\'#ffffff\'" onClick="handleNext();">');
        document.write('Next&gt;&gt;&nbsp;');
        document.write('</td>');
    }
}