// JavaScript Documentfunction ICSnav(a){		var image = '<img src= images/smallbean.gif alt="Coffee" width="23" height="22" align="absbottom" border="0"/>';	var abt = '<a href="about.htm" class="nav">'+image +'About Us</a><br />';	var hm = '<a href="index.htm" class="nav">'+image +'Home</a><br />';		var menu = '<a href="menu.htm" class="nav">'+image +'Menu</a><br />';	/*var spec ='<a href="specials.htm" class="nav">'+image +'Specials</a><br />';*/	var shop = '<a href="shopping.htm" class="nav">'+image +'Shopping</a><br />';	var blog ='<a href="http://www.internetcoffeestation.blogspot.com" class="nav" target="_blank">'+image +'Blog</a><br />';	var comp = '<a href="computers.htm" class="nav">'+image +'Computers</a><br />';	var photo ='<a href="photos.htm" class="nav">'+image +'Photos</a><br />';	var links ='<a href="links.htm" class="nav">'+image +'Links</a><br />';	//var map = '<a href="locate.htm" class="nav">'+image +'Locate Us</a><br />';	var cont = '<a href="contact.htm" class="nav">'+image +'Contact</a><br />';		switch(a){		case "home":var hm = image + '<a href="#" class="navOVER">Home</a><br />';	break;case "about":var abt = image + '<a href="#" class="navOVER">About Us</a><br />';	break;case "specials":var spec = image + '<a href="#" class="navOVER">Specials</a><br />';	break;	case "menu":var menu = image + '<a href="#" class="navOVER">Menu</a><br />';	break;	case "shop":var shop = image + '<a href="#" class="navOVER">Shopping</a><br />';	break;	case "blog":var blog = image + '<a href="#" class="navOVER">Blog</a><br />';	break;		case "comp":var comp = image + '<a href="#" class="navOVER">Computers</a><br />';	break;		case "photo":var photo = image + '<a href="#" class="navOVER">Photos</a><br />';	break;	case "link":var links = image + '<a href="#" class="navOVER">Links</a><br />';	break;		case "cont":var cont = image + '<a href="#" class="navOVER">Concact</a><br />';	break;			case "map":var map = image + '<a href="#" class="navOVER">Locate Us</a><br />';	break;		}			var navigation = '<div id="nav">'+hm+abt+menu+shop+blog+comp+photo+links+cont+'</div>';	document.write(navigation);}function bottominfo(){	var btm ='<div id="mainbottom"><div id="bottom">All content copyright 2009 Internet Coffee Station<br />308 Main  -   Stevensville, Montana 59870  -  406.777.2110  -  internetcoffeestation@hotmail.com</div></div>';	document.write(btm);}function hoursinfo(){	var hrs ='Mon-Fri 9am-6pm<br>Sat 9am-3pm<br>Sun-Closed';	document.write(hrs);}/***********************************************---------FOR THE BACKEND-----------------------------**********************************//**************************---------MENU UPDATER-------------********************/var ITEMSCOUNTER = new Array();var SECTIONCOUNTER = new Array();/////----this keeps track of how many sections there are.function addsection(){SECTIONCOUNTER.push("section");alert(SECTIONCOUNTER.length -1);}function changeitem(Anum,changeItemName,where,Snum){	//alert("Anum = ..."+Anum+" changeItemName = ..."+changeItemName+" Snum = "+Snum);	var s = "itms"+Snum;	var sel = document.IC1[where].selectedIndex;	var reassigned = document.IC1[where][sel].text;	//alert("block "+y+"..........section "+z);	////////////////	//alert(JSmadeMenuMaster[Anum][Snum][where]);JSmadeMenuMaster[Anum][changeItemName][Snum]= reassigned;	//////////////	redraw();}//////the function that assembles the universal dropdown to choose menu items fromfunction menuchoices(k,m,arr,sectn,itmm){		var opt = new Array();	opt.push('<SELECT name="itms'+k+'[]"  onchange="changeitem('+arr+','+sectn+','+itmm+','+k+');" ><option value="no" selected>Select Item</option>');	for(y=0; y<JSMasterMenu_ARRAY.length; y++){		if(y>0){			opt.push('<optgroup label="--------------DRINKS--------------"></optgroup>');		}else{		opt.push('<optgroup label="--------------FOOD--------------"></optgroup>');		}		for(j=0; j<JSMasterMenu_ARRAY[y].length; j++){	var sectionName = JSMasterMenu_ARRAY[y][j][0];			opt.push('<optgroup label="'+sectionName+'">');		for(u=1; u<JSMasterMenu_ARRAY[y][j].length; u++){			var tit = JSMasterMenu_ARRAY[y][j][u]['title'];						if(m.indexOf('"')){						 var h = m.split('"');						  m = h.join("&quot;");						 }			if(m.indexOf("'")){						 var av = m.split("'");						  m = av.join("&lsquo;");						 }			if(tit.indexOf('"')){						 var hh = tit.split('"');						  tit = hh.join("&quot;");						 }			if(tit.indexOf("'")){						 var hl = tit.split("'");						  tit = hl.join("&lsquo;");						 }						 												//			if(m == tit){			opt.push('<option value="'+tit+'" selected>'+tit+'</option>');				}else{		opt.push('<option value="'+tit+'" >'+tit+'</option>');		}					}		opt.push('</optgroup>');			}	}	opt.push('</SELECT>');	var theresult = opt.join("");	var thersult2 = theresult + '<------------<a href="#" onclick="deleteitem('+arr+','+sectn+','+itmm+')";> Delete Item</a><br />';	//document.write(thersult2);	return thersult2;}<!---  Note:  The JSmadeMenuMaster is set up like this. JSmadeMenuMaster[0][0][0] gives the SECTION NAME of the first section in the food section: so JSmadeMenuMaster[0][0][1] gives the first title of the first item in the food section: JSmadeMenuMaster[0][1][0] gives the SECTION NAME of the second section i the food section....etc    JSmadeMenuMaster[0].length is how many sections there are in the food section JSmadeMenuMaster[1].length is how many sections there are in the drinks section. JSmadeMenuMaster[0][0].length is how many items (minus the first one that's actually the section name) there are in the first section of the food section....etc.    -->//////////*******************  This function is the one that gets triggered first that takes the array that has been configured from the EXISTING xml doc and turns that into the sections with drop downs....good luck      *********************///////////////////////////////function thexml(){	var buildup = new Array();	var sec =0;		for(nn=0; nn<JSmadeMenuMaster.length; nn++){		if(nn==0){			buildup.push('<h1>FOOD</h1><a href="#" onclick="addsection()">Add Section</a><br /><br>');		}		if(nn==1){			buildup.push('<hr width="70%" /><h1>DRINKS</h1><a href="#" onclick="addsection()">Add Section</a><br /><br>');		}			for(lq=0; lq<JSmadeMenuMaster[nn].length; lq++){				buildup.push('<table width="600" cellpadding="5" cellspacing="5" border="0" bgcolor="#eeeeee">');		buildup.push('<tr><td>Section Name: <input type=text" size="30" name="sections[]" value="'+JSmadeMenuMaster[nn][lq][0]+'"> ----- <a href="#" onclick="additem('+nn+','+lq+');">Add Item</a><input type="hidden"  name="pics[]" value="'+JSmadeMenuMaster[nn][lq][1]+'"></td></tr>');		for(gp=2; gp<JSmadeMenuMaster[nn][lq].length; gp++){						var theitem = JSmadeMenuMaster[nn][lq][gp];					buildup.push('<tr><td>'+menuchoices(sec,theitem,nn,lq,gp)+'</td></tr>');		}sec++;		buildup.push('</table><br /><br />');	}}var additup = buildup.join("");document.write(additup);}//////////////----------this redraws the page with a new arrayfunction redraw(){	var buildup3 = new Array();	var sec3 =0;		for(nn3=0; nn3<JSmadeMenuMaster.length; nn3++){		if(nn3==0){			buildup3.push('<h1>FOOD</h1><a href="#" onclick="addsection()">Add Section</a><br /><br>');		}		if(nn3==1){			buildup3.push('<hr width="70%" /><h1>DRINKS</h1><a href="#" onclick="addsection()">Add Section</a><br /><br>');		}			for(lq3=0; lq3<JSmadeMenuMaster[nn3].length; lq3++){				buildup3.push('<table width="600" cellpadding="5" cellspacing="5" border="0" bgcolor="#eeeeee">');		buildup3.push('<tr><td>Section Name: <input type=text" size="30" name="sections[]" value="'+JSmadeMenuMaster[nn3][lq3][0]+'"> ----- <a href="#" onclick="additem('+nn3+','+lq3+');">Add Item</a><input type="hidden"  name="pics[]" value="'+JSmadeMenuMaster[nn3][lq3][1]+'"></td></tr>');		for(gp3=2; gp3<JSmadeMenuMaster[nn3][lq3].length; gp3++){						var theitem3 = JSmadeMenuMaster[nn3][lq3][gp3];					buildup3.push('<tr><td>'+menuchoices(sec3,theitem3,nn3,lq3,gp3)+'</td></tr>');		}sec3++;		buildup3.push('</table><br /><br />');	}}var additup3 = buildup3.join("");document.getElementById('thesections').innerHTML = additup3.toString();}/////////////function additem(y,z){	//alert("block "+y+"..........section "+z);	////////////////JSmadeMenuMaster[y][z].push("item");	//////////////	redraw();}function deleteitem(arrNum,secNum,itNum){	var removeitem = JSmadeMenuMaster[arrNum][secNum].splice(itNum,1);	redraw();		}/**************************---------MENU UPDATER-------------********************///for picture load upvar JPICS = new Array();var CUR_PIC = new Array();var thisevent = new Array(0);var shrink = new Array();function what(a){	for(m=0; m< JPICS.length; m++){		if(a == JPICS[m]){			CUR_PIC.unshift(m);		}	}	var gh = '<img src="'+a+'" />';	document.getElementById('pic').innerHTML = gh;	}		function selctor(g){		alert('"'+g+'"');	}		function NextPic(){		if(CUR_PIC[0]<JPICS.length-1){		var nxt = CUR_PIC[0]+1;		var df = '<img src="'+JPICS[nxt]+'" />';	document.getElementById('pic').innerHTML = df;	CUR_PIC.unshift(nxt);	}else{		"";	}	}		function PrevPic(){			if(CUR_PIC[0]>0){		var prv = CUR_PIC[0]-1;		var ff = '<img src="'+JPICS[prv]+'" />';	document.getElementById('pic').innerHTML = ff;	CUR_PIC.unshift(prv);	}else{		"";	}		}		//////---this is the thing that gets triggered when you select something out of the option dropdown.		function whichshow(w){		for(u=0; u<Jevents.length; u++){		if(Jevents[u][0]['eventtitle'] == w.value){			thisevent.unshift(u);		}else{			"";		}		}		//alert(Jevents[thisevent[0]][6]['pictureblurb']);		var np = Jevents[thisevent[0]][1]['picturefile'];		np2 = "<img src=\""+np+"\" />";		document.getElementById('pic').innerHTML = np2;		}		/******************************************************************  BREAKING THE PHP ARRAYS INTO JAVASCRIPT ARRAYS**************************/		var Jevents = new Array();				