//CONFIGURATION//////////////////////////////////////////////////////////////////////////////////////////////
var last_updated = "08-AUG-2008";
var announcement = "Open House on Wednesday\, October 1 from 6-7:30 pm.  Private tours are also now available.  Programs are scheduled to begin on Saturday\, October 4th!";

//CODE///////////////////////////////////////////////////////////////////////////////////////////////////////

var homeURL = ""; //"http://www.karamaria.com/"

function changeImages() {
	if (document.images) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

function imageGrid(type, pageIndex) {
    sorter(images, 5, "r", 3, "r", 4, "r");
    var indexIndex = -1;
    var typeTicker = -1;
	for (a=0; a<images.length; a++){
		if (images[a][1] == type) typeTicker++;
		if (typeTicker == pageIndex) indexIndex = a--;	
	}
    var imageCounter = indexIndex;
    document.write("<table border=0 cellpadding=10 cellspacing=10 align='center'>");
    var loadedImages = new Array();
    for (a=0; a<maxNumOfRows; a++) {
	document.write("<tr>");
            for (b=0; b<maxNumInRow; b++) {
		    if (imageCounter < images.length) {
			if (type == images[imageCounter][1]) {
			    var noQuestion = removeQuestionMark(images[imageCounter][0]);
			    loadedImages[loadedImages.length] = new Array();
				loadedImages[loadedImages.length-1][0] = new Image();
				loadedImages[loadedImages.length-1][0].src = "images/" + noQuestion + "_thumb_off.jpg";
				loadedImages[loadedImages.length-1][1] = new Image();
				loadedImages[loadedImages.length-1][1].src = "images/" + noQuestion + "_thumb_on.jpg";
			    var altText = removeUnderscores(images[imageCounter][0]);	
			    document.write("<td align='center' valign='center'>");
			        document.write("<a href='" + homeURL + "images.html?" + images[imageCounter][images[imageCounter].length-1] + "' onMouseOver=\"changeImages(\'" + noQuestion + "\'\, \'" + loadedImages[loadedImages.length-1][1].src + "\'\)\; return true\;\"  onMouseOut=\"changeImages(\'" + noQuestion + "\'\, \'" + loadedImages[loadedImages.length-1][0].src + "\'\)\; return true\;\">"); 
				document.write("<img src='" + loadedImages[loadedImages.length-1][0].src + "' alt=\"" + altText + "\" name='" + noQuestion + "' border=3></a>");
			    document.write("</td>");
		        } else {
			    b--;
			}
                        imageCounter++;
		    }	
            }
	document.write("</tr>");
    }
    document.write("</table>");

    if (paging == 'TRUE') {
    document.write("<table border=0><tr><td class='textS'>Pages:&nbsp;</td>");
    	for (a=1; a<Math.ceil((typeTicker/(maxNumInRow * maxNumOfRows))+1); a++) {
		if (((a-1)*(maxNumInRow * maxNumOfRows)) == pageIndex) {
    			document.write("<td class='textM'><b>" + a + "</b></td>");		
    		}else{
    			document.write("<td class='textM'><a href='" + homeURL + "gallery.html?" + type + "&" + ((a-1)*(maxNumInRow * maxNumOfRows)) + "'>" + a + "</a></td>");		
    		}
    	}
    document.write("</tr></table>");
    }

}


function removeUnderscores(theString) {
    var theText = "";
    for (c=0; c<theString.length; c++) {
        if ((theString.charAt(c) != "_")&&(theString.charAt(c) != "~")&&(theString.charAt(c) != "@")&&(theString.charAt(c) != "^")) theText = theText + theString.charAt(c);
        if (theString.charAt(c) == "_") theText = theText + " ";
	if (theString.charAt(c) == "~") theText = theText + "/";
	if (theString.charAt(c) == "@") theText = theText + "'";
	if (theString.charAt(c) == "^") theText = theText + ",";
    }
    return theText;
}

function removeQuestionMark(theString) {
    var theText = "";
    for (c=0; c<theString.length; c++) {
        if (theString.charAt(c) != "?") theText = theText + theString.charAt(c);
    }
    return theText;
}

var theImages=new Array();
var theOvers=new Array();
function preloadimagesOLD(){
    for (i=0;i<images.length;i++){
	var noQuestion = removeQuestionMark(images[i][0]);
	theImages[i]=new Image();
	theImages[i].src="images/" + noQuestion + "_thumb_off.jsp";
	theOvers[i]=new Image();
	theOvers[i].src="images/" + noQuestion + "_thumb_on.jsp";
    }
}


function sorter(the_array, pri_index, p_sort, sec_index, s_sort, ter_index, t_sort) {
    for (a=0; a<the_array.length; a++) {
	the_array[a][the_array[a].length] = a;
    }
    var holder = new Array();
	for (i=1; i<the_array.length; i++) {
	    for (j=i; j>0; j--) {
   		if (((p_sort == "f") && (the_array[j][pri_index] < the_array[j-1][pri_index])) || ((p_sort == "r") && (the_array[j][pri_index] > the_array[j-1][pri_index]))) {
		    holder = the_array[j-1];
   		    the_array[j-1] = the_array[j];
   		    the_array[j] = holder;
   		} else {
   		    if ((the_array[j-1][pri_index] == the_array[j][pri_index]) && (((s_sort == "f") && (the_array[j][sec_index] < the_array[j-1][sec_index])) || ((s_sort == "r") && (the_array[j][sec_index] > the_array[j-1][sec_index])))) {
   			holder = the_array[j-1];
   			the_array[j-1] = the_array[j];
   			the_array[j] = holder;			  
   		    } else {
   			if ((the_array[j-1][pri_index] == the_array[j][pri_index]) && (the_array[j-1][sec_index] == the_array[j][sec_index]) && (((t_sort == "f") && (the_array[j][ter_index] < the_array[j-1][ter_index])) || ((t_sort == "r") && (the_array[j][ter_index] > the_array[j-1][ter_index])))) {
   			    holder = the_array[j-1];
   			    the_array[j-1] = the_array[j];
   			    the_array[j] = holder;		  	
   			}
   		    }
   		}
	     }
	 }
    return the_array;		 
}

function linkTable() {
    sorter(links, 0, "f", 2, "f", 1, "f");
    document.write("<table border=0 cellpadding=3 cellspacing=3>");
    for (a=0; a<links.length; a++) {
	document.write("<tr>");
            document.write("<td><a href='" + links[a][1] + "' class='linkTable'>" + links[a][0] + "</a></td>");
	    document.write("<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>");
            document.write("<td>" + links[a][2] + "</td>");
	document.write("</tr>");
    }
    document.write("</table>");
}

function announcer() {
    if (announcement != "") {
        document.write("<tr><td colspan='2' align='center' class='announcements' width='600'><MARQUEE WIDTH='100%' BEHAVIOR='SCROLL' LOOP=1500 scrolldelay=130>" + announcement + "</MARQUEE><br /><br /></td></tr>");
    }
}

function header(page) {
    announcer();
    document.write("<tr><td rowspan='2'><a href='index.html'><img src='images/header_subL.jpg' /></a></td><td><img src='images/header_subR.jpg' /></td></tr>");
    document.write("<tr><td height='40'>");

    miniTabNav(page);

    document.write("</td></tr>");
}

function showImage(spec, nav, fh) {
    document.write("<br /><table border='0' background='images/header_subShim.jpg' cellpadding='0' cellspacing='0' width='600' align='center'>");

    document.write("<tr><td align='center'><img src='images/" + spec + ".jpg' border='0' usemap='#subNav' /></td></tr>");
    document.write("<tr><td width='100%' bgcolor='#ffffff' valign='top'><iframe frameborder='0' src='" + spec + ".html' name='Main' height='" + fh + "' width='600' align='center' border='0'>Your browser does not support this web page. Please contact us directly for information. Thank you.</iframe></td></tr></table>");

    if (nav == "programs") {
    document.write("<map id='subNav' name='subNav'>");
    document.write("<area shape='poly' coords='316\,22\,408\,57\,404\,75\,313\,38' href='programs.html?psc&2225' alt='Preschool' title='Preschool' />");
    document.write("<area shape='poly' coords='307\,56\,431\,108\,427\,118\,302\,70' href='programs.html?aac&670' alt='Art Attack Parties' title='ArtAttack' />");
    document.write("<area shape='poly' coords='298\,81\,402\,132\,398\,144\,288\,101' href='programs.html?dip&830' alt='Down to Earth' title='DownToEarth' />");
    document.write("<area shape='poly' coords='282\,117\,405\,170\,394\,197\,270\,142' href='programs.html?mam&1380' alt='Music and More!' title='MusciAndMore' />");
    document.write("</map>");
    }

    if (nav == "about") {
    document.write("<map id='subNav' name='subNav'>");
    document.write("<area shape='poly' coords='298\,37\,382\,69\,376\,77\,294\,47' href='about.html?abt&1600' alt='About Us' title='About' />");
    document.write("<area shape='poly' coords='285\,64\,400\,108\,393\,120\,283\,80' href='about.html?phi&1200' alt='Our Philosophy' title='Philosophy' />");
    document.write("<area shape='poly' coords='277\,98\,429\,154\,422\,167\,268\,111' href='about.html?why&920' alt='Why an Art Education' title='WhyArt' />");
    document.write("<area shape='poly' coords='266\,127\,363\,163\,358\,178\,259\,144' href='about.html?tst&980' alt='Testimonials' title='Testimonials' />");
    document.write("</map>");
    }


}


function schedule() {
        document.write("<table border='1' align='center' cellpadding='0' cellspacing='0'><tr><td>");
        document.write("<table border='0' align='center' cellpadding='3' cellspacing='0'>");
        document.write("	<tr>");
        document.write("		<td align='center'>CLASS SCHEDULE</td>");
        document.write("	</tr>");
        document.write("	<tr>");
        document.write("		<td align='center'>");
        document.write("			<table border='1' cellpadding='3'>");
        document.write("				<tr><td>Class</td><td>Ages</td><td>Days</td><td>Times</td></tr>");
        document.write("				<tr><td>Preschool Classes</td><td>3-5 years</td><td>Mondays, Wednesdays, and Fridays</td><td>9:15-11:30</td></tr>");
        document.write("				<tr><td>Music & More!</td><td>3-5 years (Additional days/times will be available for children ages 0-5 years.  Please inquire with interest.  Thank you.)</td><td>Saturdays</td><td>9:00-10:00</td></tr>");
        document.write("			</table>");
        document.write("		</td>");
        document.write("	</tr>");
        document.write("	<tr>");
        document.write("		<td align='center'>Cost per Month</td>");
        document.write("	</tr>");
        document.write("	<tr>");
        document.write("		<td align='center'>");
        document.write("			<table border='1' cellpadding='3'>");
        document.write("				<tr><td>Class</td><td>Duration</td><td>Classes per Week</td><td>Cost</td></tr>");
        document.write("				<tr><td>Preschool Classes</td><td>2 1/4 hours</td><td>1</td><td>$60</td></tr>");
        document.write("				<tr><td>'</td><td>'</td><td>2</td><td>$90</td></tr>");
        document.write("				<tr><td>'</td><td>'</td><td>3</td><td>$115</td></tr>");
        document.write("				<tr><td>Music & More</td><td>1 hour (8 week session)</td><td>1</td><td>$95 per session</td></tr>");
        document.write("			</table>");
        document.write("		</td>");
        document.write("	</tr>");
        document.write("	<tr>");
        document.write("		<td align='left'>");
        document.write("Preschool classes run from September-June. Class schedule subject to change due to enrollment.  Families will be notified a minimum of 1 month in advance of any necessary change.  Weather-related closings may occur occasionally.  Call with questions.  A calendar of events and holiday closings will be provided upon enrollment.  Year-long enrollment is not required, but is recommended to ensure continued placement availability.");
        document.write("Fees are all-inclusive.  No additional materials fees apply.");
        document.write("		</td>");
        document.write("	</tr>");
        document.write("</table>");
        document.write("</td></tr></table>");
}


function success(suc) {
    if (suc == "y") {
        document.write("<tr><td colspan='2' align='center' class='success'>");
        document.write("<br />Your information has been submitted and we will get back with you as soon as possible.<br />Thank you for your interest in our services!<br /><br />");
        document.write("</td></tr>");
    }
}

function miniTabNav(page) {

    document.write("<ul id='miniflex'>");
    document.write("<li><a href='Little_World_Registration_Form.pdf' title=''>Registration Form</a></li>");
    document.write("<li><a href='mailto:littleworld@artlover.com' title=''>Contact Us</a></li>");

    document.write("<li><a ");
	if (page == "info") {
		document.write("class='active' ");
	}
    document.write("href='info.html' title=''>Request Info</a></li>");

    document.write("<li><a ");
	if (page == "programs") {
		document.write("class='active' ");
	}
    document.write("href='programs.html' title=''>Our Programs</a></li>");

    document.write("<li><a ");
	if (page == "about") {
		document.write("class='active' ");
	}
    document.write("href='about.html' title=''>About Us</a></li>");

    document.write("</ul>");

}

function footer() {

    document.write("<table border=0 cellpadding=0 cellspacing=0 width='670' align='center'>");

    document.write("<tr><td><table border='0' cellpadding='0' cellspacing='0'>");
    document.write("<tr><td class='footerText'>Little World of Arts</td></tr>");
    document.write("<tr><td class='footerText'>Location: 19 Madison Avenue\, Second Floor\, Endicott\, New York 13760</td></tr>");
    document.write("<tr><td class='footerText'>Mail: 636 Echo Rd\, Vestal\, NY 13850</td></tr>");
    document.write("<tr><td class='footerText'>Ph: 607-222-2393</td></tr>");
    document.write("<tr><td class='footerText'>E-mail: <a href='mailto:littleworld@artlover.com'>littleworld@artlover.com</a></td></tr>");
    document.write("<tr><td class='footerText'>&copy\; 2008 Little World of Arts. All rights reserved.</td></tr>");
    document.write("</table>");

    document.write("</td><td align='right'class='footerText'>");
    document.write("<form method=post action=http://www.ymlp.com/subscribe.php?Krista>");
    document.write("<table border=0><tr>");
    document.write("<td class='footerText'>Fill out your e-mail address to receive our newsletter!<br /><a href=\"http://www.yourmailinglistprovider.com\" target=\"_new\">Hosting by YMLP.com</a></td></tr>");
    document.write("<td class='footerText'><input type=\"text\" name=\"YMLP0\" size=\"20\"><br /><input type=\"radio\" name=\"action\" value=\"subscribe\" checked>&nbsp;Subscribe&nbsp;<input type=\"radio\" name=\"action\" value=\"unsubscribe\">&nbsp;Unsubscribe&nbsp;&nbsp;<input type=\"submit\" value='Submit'></td>");
    document.write("</tr></table></form>");

    document.write("</td></tr></table>");
}

