var imgPost = new Image();
var baseURL = "http://www.qcomet.com/";
var baseImages = "http://www.qcomet.com/pics/";	
var nobar = "<meta http-equiv='imagetoolbar' content='no' /> ";

var cDark = "#000066";
var cLight = "#99ccff"
var cTableBG = " bgcolor=FloralWhite";
//var cCaptionBG = " bgcolor=PowderBlue";
var cCaptionBG = " ";
var cRowBG = " bgcolor=#DDDDDD";
var fCaption = " class='buttonText14'";
var fButton = " class='buttonText'";
var fRegText = " class='regBlueText'";
var fdText = " class='dText'";
var fSmallText = " class='copyText'";
var style = "<LINK REL=stylesheet TYPE='text/css' HREF='" + baseURL + "scripts/scotia.css'>"
var shops = '<SCRIPT LANGUAGE=JAVASCRIPT src="http://www.qcomet.com/scripts/shops.js"></SCRIPT>'
var data = '<SCRIPT LANGUAGE=JAVASCRIPT src="qlist.js"></SCRIPT>'

//var createdby = "<P ALIGN=Center><IMG SRC='" + baseImages + "createdby.gif' ALT='Created by BillP Studios' BORDER='0' WIDTH='75' HEIGHT='64'><BR>"
//var copyFont = "<P ALIGN=Center "+fSmallText+">";
//var copyWrite = "Copyright © 1999-2001 BillP Studios.<BR>All Rights Reserved.<BR>"


var tabtop = "<TABLE align=center border=3  rules=none cellpadding=0 cellspacing=0 bordercolor=DeepSkyBlue ";
var table1 = "<TABLE align=center border=0  rules=none cellpadding=4 cellspacing=0 bordercolor=DeepSkyBlue ";
var table2 = "bordercolordark="+cDark+" bordercolorlight="+cLight+"  >";
var tab1 = "<TABLE align=center border=4  rules=cols cellpadding=0 cellspacing=0 bordercolor=DeepSkyBlue ";
var tab2 = "bordercolordark="+cDark+" bordercolorlight="+cLight+" >";

var row1 = "<TR "+cCaptionBG+"><TD align=center colspan=2>";
var row1s = "<TR><TD align=center colspan=2>";
var rowb1 = "<TR "+cRowBG+"><TD  align=center colspan=2><BR>";
var rowc1 = "<TR "+fCaption+"><TD  align=center  colspan=2 "+cCaptionBG+">";
var row2 = "<TD "+cTableBG+" align=center  colspan=1>";
var endRow = "</TD></TR>"
var endbRow = "<BR></TD></TR>"


function isAOL(){ return  navigator.userAgent.indexOf("AOL") != -1; }


function slideShow()
{
var i= getCurrentPicture();
var slide=i+1;


document.open();

document.write("<HTML><HEAD><TITLE>"+title+"</TITLE>"+nobar+style+shops+data+"</HEAD>");
document.write("<BODY BACKGROUND='http://www.visitscotia.com/images/wallpaper.jpg'>");

document.write("<TABLE summary='Table used for formatting purposes' width='90%' CELLSPACING='0' CELLPADDING='0'>");
document.write("<TR><TD valign=top>");


		drawLogo();
		document.write("<br><br>");
		drawMenu();

	document.write("</TD>");

	document.write("<TD>");
	



	renderControls( i );


	document.write(table1+table2);
	if( caption[i].length > 0)
	{
		document.write(rowc1);
		document.write("<TABLE align=center border=0>");
		document.write("<TR class='buttonText14'><TD>");
		document.write( FormattedText( caption[i], 48 ) );
		document.write("</TD></TR></TABLE>");
		document.write(endRow);
	}


	document.write(row1s);
	document.write("<TABLE align=center border='0' rules=none cellpadding='0' cellspacing=0>");

	// if Netscape we could do it the old way
	// and use this stuff otherwise use the new slides method.
	if(navigator.appName == "Microsoft Internet Explorer"  )
	{
		document.write("<TR><TD colspan=3>");
		document.write("<img name='idLeftTop' border=0 src='http://www.qcomet.com/pics/frametop.jpg' >");
		document.write("</TD></TR>");
		document.write("<TR><TD colspan=1>");
		document.write("<img name='idLeftMiddle' border=0 src='http://www.qcomet.com/pics/frameleft.jpg' >");
		document.write("</TD>");
		document.write("<TD colspan=1>");
		document.write("<a href='javascript:updateSlideShow(1)'>");
		document.write("<img name='idPicture' border=0 src='" + picture[i] + "' " + 'alt="' + caption[i] + '"' +  " onLoad='javascript:CheckSize()'></A>");
		document.write("</TD>");
		document.write("<TD colspan=1>");
		document.write("<img name='idRight' border=0 src='http://www.qcomet.com/pics/frameright.jpg'  >");
		document.write("</TD></TR>");
		document.write("<TR><TD colspan=1>");
		document.write("<img name='idLeft' border=0 src='http://www.qcomet.com/pics/frameleft.jpg' >");
		document.write("</TD>");
		document.write("<TD colspan=1>");
		document.write("<img name='idBottom' border=0 src='http://www.qcomet.com/pics/framebottom.jpg' >");
		document.write("</TD>");
		document.write("<TD colspan=1>");
		document.write("<img border=0 src='http://www.qcomet.com/pics/framecorner.jpg' >");
		document.write("</TD></TR>");
	}
	else
	{
		document.write("<a href='javascript:updateSlideShow(1)'>");
		document.write("<img name='idPicture' border=0 src='" + picture[i] + "' " + 'alt="' + caption[i] + '"' +  " onLoad='javascript:CheckSize()'></A>");
	}



	if(typeof(dtext[i]) != "undefined")
	{
		if( dtext[i].length > 0)
		{
			document.write("<TR class='regBlueText'><TD colspan=1></TD>");
			document.write("<TD align=left colspan=1 >");
			document.write("<TABLE align=center border=0><TR><TD class='regBlueText'>" + FormattedText( dtext[i], 48 )+"</TD></TR></TABLE>");
			document.write("</TD>" );
		
			document.write("<TD></TD></TR>");
		}
	}


	document.write("</TABLE>");
	document.write(endRow);
	document.write("</TABLE>");

    document.write('<center>');
    document.write("<a href='http://creativecommons.org/licenses/by-nc-sa/3.0/'>");
    document.write("<IMG SRC='http://www.qcomet.com/pics/license.png' ALT='Click for Photo Permission Rules'></a>");
    document.write('<br>© BillP Studios</center><BR>');                                   


	document.write('<center>');
	document.write('<form action="http://www.google.com/cse" id="cse-search-box" target="_blank">');
	document.write("<font color='#000066'><br><B><I>Enter Text to Search for More Photos</I></B></font><div>");
	document.write('<input type="hidden" name="cx" value="partner-pub-5216032068438142:rh1oly-3e3q" ID="Hidden1" />');
	document.write('<input type="hidden" name="ie" value="ISO-8859-1" ID="Hidden2" /> <input type="text" name="q" size="38" ID="Text1" />');
	document.write('<br><input type="submit" name="sa" value=" Search " ID="Submit1" /></div></form>');
	document.write('<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&amp;lang=en"></script>');
	document.write('</center>');





	if( typeof(copyright)!= "undefined")
	{
		if(copyright != "")	// use copyright from user
			copyWrite = copyright;
	}



	
	document.write("</TD></TR>");


    document.write("<TR><TD summary='Table used for formatting' WIDTH='30%' VALIGN='top'>");
    document.write("<IMG height=1 alt='Scotia-Glenville NY' src ='http://www.qcomet.com/pics/pixel.gif' width=140 ></TD>");
    document.write("<TD WIDTH='70%' VALIGN='top' align=center><br><hr>");
    
    
    
  
//	 document.write(' <script type="text/javascript"> google_ad_client = "pub-5216032068438142"; google_ad_width = 728; google_ad_height = 90; google_ad_format = "728x90_as"; google_ad_type = "text"; google_ad_channel =""; ');
//	document.write(' google_color_border = "336699"; google_color_bg = "FFFFFF"; google_color_link = "0000FF"; google_color_url = "008000"; google_color_text = "000000"; ></script> ');
//   document.write('<script type="text/javascript"> google_ad_client = "pub-5216032068438142"; google_ad_width = 728; google_ad_height = 90; google_ad_format = "728x90_as"; google_ad_type = "text"; google_ad_channel =""; ');
//    document.write(' google_color_border = "2D5893"; google_color_bg = "99AACC"; google_color_link = "000000"; google_color_url = "000099";google_color_text = "003366"; </script> ');
    //document.write(' <script type="text/javascript"  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> ');

   
    
    
    
    document.write("</TD></TR>");    
	document.write("</TABLE>");





	document.write("</BODY></HTML>");
	document.close();
}

function updateSlideShow(direction)
{
var h = parent.location.href;
var nr = h.split("?");
var page = getCurrentPicture();
var size=picture.length;
var p;

	if(direction == 0)
		page = page - 1
	else
		page = page + 1;
	
	if(page < 0) page = 0;
	//if(page == size) page = size-1;
	if(page == size) page = 0;

	p = "?"+page;
	window.parent.location.href = nr[0]+p;
}


function getCurrentPicture()
{
var h = parent.location.href;
var nr = h.split("?");
var page;

	if(( typeof(nr[1])== "undefined") )
		page = 0;
	else
		page=nr[1]-0;
	return page;
}



function FormattedText(sText, linesize)
{
var myOutput = "";
var myLine = "";
var myWord = "";
var newInput = "";
var	temp1 = "";


	temp1 = sText;

		
    newInput = temp1.split( "<BR>");
	for(i=0; i < newInput.length; i++)
	{
		newParagraph = newInput[i];	

		//	-------------  Each line
		newLine = newParagraph.split("<");
		newSegment = newLine[0];
		
		for(j=1; j < newLine.length+1; j++)
		{
				//	----------------------------------  each word
				myWord = newSegment.split(" ");
				for(k=0; k < myWord.length; k++)	// number of elements in word array
				{
					temp = myLine + myWord[k];
					if( temp.length > linesize )
					{
						myOutput = myOutput + myLine + "<BR>";
						myLine = myWord[k] + " ";
					}
					else
					{
						myLine = myLine + myWord[k] + " ";
					}
				}  //--------------------------------------- end of each word	
			if(j < newLine.length)
			{
				temp = newLine[j].split(">");
				newSegment = temp[1];
				html = "<" + temp[0] + ">";
				myLine = myLine + html;
			}
		}	// ------------------------  end of each line

		myOutput = myOutput + myLine + "<BR>";
		myLine = "";
		
	} //-------- End of check for <BR>'s
	
	myOutput = myOutput + myLine;
	
	return myOutput;
}


function DoLink(slide)
{
	x = screen.availWidth;
	x = x - x/6;
	y = screen.availHeight;
	y = y - y/4;
	

	if(typeof(link[slide]) != "undefined")
	{
		if(link[slide] == "undefined")
			return;
		url = link[slide];

		if(url.length > 0)
		{
			//location.href = url;
			window.open( url, '', 'resizable=1,height=' + y + ',width=' + x + ',scrollbars=1,toolbar=yes,status=0');
		}
	}
	return;
}


function CheckSize()
{	// If new images are added to this code we must change the number found here.

	//if(navigator.appName == "Netscape" ) return;
	if(navigator.appName == "Microsoft Internet Explorer" )
	{
		h = document.images['idPicture'].height;
		w = document.images['idPicture'].width;
		x = screen.availWidth;		y = screen.availHeight;
		x = x - x/4;
	
		if(w > x)
		{
			w1 = x;
			h1 = (h * w1/w);
			document.images['idPicture'].width = w1;
			document.images['idPicture'].height = h1;
		}		
		if(h > y)
		{		
			h1 = y;
			w1 = (w * h1/h);
			document.images['idPicture'].width = w1;
			document.images['idPicture'].height = h1;
		}		

		h = document.images['idPicture'].height;
		w = document.images['idPicture'].width;
		document.images['idRight'].height = h;
		document.images['idRight'].width = 10;
		document.images['idBottom'].width = w;
		document.images['idBottom'].height = 10;
		document.images['idLeftTop'].height = 1;
		document.images['idLeftTop'].width = 1;
		document.images['idLeftMiddle'].height = 1;
		document.images['idLeftMiddle'].width = 1;
		document.images['idLeft'].width = 1;
		document.images['idLeft'].height = 1;
		
		

	}
}


function renderControls( i )
{
var href0 = "<A class='copyText' HREF=javascript:updateSlideShow(0)";
var href1 = "<A class='copyText' HREF=javascript:updateSlideShow(1)";
var himgLast = "<img id='idLast' src='" + baseImages + "last.jpg' border='0'";
var himgNext = "<img id='idNext' src='" + baseImages + "next.jpg' border='0'";
var blankHREF = "<A name='nolast' class='copyText'><img src='" + baseImages + "blank.jpg' alt='No selection available' border='0'>";
var lastHREF;
var nextHREF;
var pic = i+1



document.write(tabtop+tab2);
//document.write("<TR "+cTableBG+">");
if(pic > 1)
{
	lastOver = " ONMOUSEOVER=\"idLast.src='http://www.qcomet.com/pics/last0.jpg'; return true;\" ";
	lastOut =  " ONMOUSEOUT=\"idLast.src='http://www.qcomet.com/pics/last.jpg'; return true;\"> ";
	lastHREF = href0 + lastOver + lastOut + himgLast + 'alt="' + caption[i-1] + '"><BR>LAST</A>';
	document.write("<TR>"+row2+lastHREF+"</TD>");
}
else
	document.write("<TR>"+row2+blankHREF+"<BR>&#149</A></TD>");


document.write("<TD align=center colspan=3 class='buttonText14'"+cTableBG+"> "+ FormattedText( title, 32 ) );
document.write("<span align=center class='copyText'>Picture " + pic + " of "+ picture.length+"</span>");
document.write("<br>");
document.write("<span align=center class='regText'><A href='index.html'><u>Show All</u></A></span></TD>");


if(pic < picture.length)
{
	nextOver = " ONMOUSEOVER=\"idNext.src='http://www.qcomet.com/pics/next0.jpg'; return true;\" ";
	nextOut =  " ONMOUSEOUT=\"idNext.src='http://www.qcomet.com/pics/next.jpg'; return true;\"> ";
	nextHREF = href1 + nextOver + nextOut + himgNext + 'alt="' + caption[i+1] + '"><BR>NEXT</A>';
	document.write(row2+nextHREF+"</TD>");
}
else
	document.write(row2+blankHREF+"<BR>&#149</A></TD>");
	
document.write("</TR>");
document.write("</TABLE>");

}


function drawMenu()
{
    document.write("<TABLE  width='100' align='left' cellpadding='0' cellspacing='1' bgcolor=FloralWhite border='1'  bordercolordark='#000066' bordercolorlight='#4477AA' bordercolor='#000066'>");

    document.write('<TR><TD align=center><iframe src="http://rcm.amazon.com/e/cm?t=qcomet-20&o=1&p=40&l=ur1&category=school&banner=1CVPJXND2X2KXWWNWF82&f=ifr" width="120" height="60" scrolling="no" border="0" marginwidth="0" style="border:none;" frameborder="0"></iframe></TD></TR>');


	document.write('<TR><TD align=center>');
	document.write('<form action="http://www.google.com/cse" id="cse-search-box" target="_blank">');
//	document.write("<table border='3' cellpadding='0' cellspacing='0' width='138' bordercolordark='#000066' ");
//	document.write("bordercolorlight='#99CCFF' bordercolor='#000066'> ");
//	document.write("<tr valign='top'><td>");
	document.write('<table width="72" border="0" align=center cellpadding="0" cellspacing="0">');
	document.write('<tr bgcolor="#fffaf0"><td align="center" class="copyText">');
	document.write("<font color='#000066'><br><B><I>Search Photos<br></I></B></font><div>");
	document.write('<input type="hidden" name="cx" value="partner-pub-5216032068438142:rh1oly-3e3q" ID="Hidden1" />');
	document.write('<input type="hidden" name="ie" value="ISO-8859-1" ID="Hidden2" /> <input type="text" name="q" size="9" ID="Text1" />');
	document.write('<br><input type="submit" name="sa" value=" Search " ID="Submit1" /></div></form>');
	
	document.write('<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&amp;lang=en"></script>');
//	document.write('</TD></TR></TABLE>');
	document.write('</td> </tr> </table> </form></TD></TR> ');



	document.write("<TR><TD align=center><A class='menuText' href='http://visitscotia.blogspot.com/'><Big>What's New</Big><br><img width=88 height=63 src='http://www.visitscotia.com/images/gossip.gif' border=0></A></TD></TR>");
	document.write("<TR><TD align=center><A class='menuText' href='http://www.freedomparkscotia.org/'><img align=absMiddle src='http://www.freedomparkscotia.org/images/littlefreedom.gif' border=0  ><br>Freedom Park</A></TD></TR>");
	document.write("<TR><TD align=center><A href='http://www.visitscotia.com/slides.html'><img src='http://billp.com/pics/g3.gif'></A><br><A  class='menuText'  href='http://www.visitscotia.com/slides.html'><BIG>Photos</BIG></A></TD></TR>");
	document.write("<TR><TD align=center><A href='http://www.scotiaglenvilleschools.org/'><img border=0 src='http://www.visitscotia.com/images/tartan.jpg'></A><br><A href='http://www.scotiaglenvilleschools.org/'><big>Schools</big></A></TD></TR>");

	document.write("<TR><TD align=center><A class='menuText' href='http://www.visitscotia.com/health.html'><b>Sports</b><br>  & Fitness</A></TD></TR>");
	document.write("<TR><TD align=center><A class='menuText' href='http://www.visitscotia.com/fun.html'>Food & Fun</A></TD></TR>");
	document.write("<TR><TD align=center><A class='menuText' href='http://www.visitscotia.com/biz.html'>Business</A></TD></TR>");
	document.write("<TR><TD align=center><A class='menuText' href='http://www.visitscotia.com/support.html'>Community</A></TD></TR>");
	document.write("<TR><TD align=center><A class='menuText' href='http://www.visitscotia.com/history.html'>History</A></TD></TR>");
	

	document.write("<TR><TD align=center><A class='menuText' href='http://www.visitscotia.com/best.html'><small>Other Great<br>Village Websites</small></A></TD></TR>");

	document.write("<TR><TD align=center><A class='menuText' href='http://www.visitscotia.com/archive.html'>VisitScotia Archives</A></TD></TR>");
   	document.write("<TR><TD align=center><A href='http://www.villageofscotia.org/'><img border=0 src='http://www.visitscotia.com/images/sealbw.gif'></A><br><A href='http://www.villageofscotia.org/'><big>Village Hall</big></A></TD></TR>")

	
	document.write("</TABLE>");			
	return;
}

function drawLogo()
{
	document.write("<TABLE  width='120'> <TR><TD align=center>");
    document.write("<A HREF='http://www.visitscotia.com'>");
	document.write("<img src='http://www.visitscotia.com/images/vslogo.gif' alt='VisitScotia.com' border=0 >");
	document.write("<br><font color='Snow'><b><u>Visit Scotia</u></b></font></A>");
	document.write("</TD></TR></TABLE>");

	return;
}

