function init()
{
	//var test = new Image();
	//var tmp = new Date();
	//var suffix = tmp.getTime();
	//test.src = "image.php?text=Food&timestamp="+suffix;
	imageReplacement();
	//test.onload = imageReplacement();
	//alert("testing 123");
}

function imageReplacement()
{	
	var sizeB = 18; 	// Menu Text
	var sizeH2 = 22; 	// Item Names
	var file = parseUri(document.URL).fileName;
	if(			file == "artdeco.php"){		font = "./Coprgtl.ttf";}
	else if(	file == "painted.php"){		font = "./PORCELAI.TTF";	 sizeB = 26; sizeH2 = 32;	}
	else{			var font = "./FloralOne.ttf";			 sizeB = 16; sizeH2 = 20;	}
	//alert(font . " - " . file);
	replaceThem(document.getElementsByTagName('h2'), sizeH2, font);
	replaceThem(document.getElementsByTagName('b'), sizeB, font);
}

function replaceThem(x, elem, font)
{
	var replace = document.createElement('img');
	for (var i=0;i<x.length;i++)
	{
		if (x[i].title)
		{
			var y = replace.cloneNode(true);
			//y.src = 'pix/' + x[i].id + '.png';
			y.src = '/image.php?text=' + x[i].title + '&size=' + elem + '&font=' + font; 
			y.alt = x[i].firstChild.nodeValue;
			x[i].replaceChild(y,x[i].firstChild);
		}
	}
}
// JavaScript Document
// here you place the ids of every element you want.

function switchid(id, elem){	
	if(document.getElementById(id).style.display != 'none'){			
		document.getElementById(id).style.display = 'none';
		elem.src = 'images/chevron_open.gif';
	}else{
		document.getElementById(id).style.display = 'block';
		elem.src = 'images/chevron_closed.gif';
	}
}

// open larger page
// larger page is PHP page which takes the thumbnail image path
//
function openLargerImage(imageElement){
	var pth = imageElement.getAttribute('src').replace("/thumbs/","/");
	pth = '/includes/openLargerImage.php?path=' + pth;
	window.open(pth, "largerImageWindow" ,"menubar=1,resizable=1,width=500,height=400");
}



// No spam function: 
var user;
var domain;
var suffix;
function jemail1(user, domain, suffix){
document.write('<a href="' + 'ma' + 'ilto:' + 'davidfkane' + '@' + 'gm' + 'ail' + '.' + 'co' + 'm' + '">');
document.write('<img style="border:0;width:88px;margin: 5px;height:31px; float: right;" src="/images/site_by.gif" alt="Created by: David Kane" />');
document.write('</a>');
}
function jemail(i){
document.write('<a href="' + 'ma' + 'ilto:' + i + '@' + 'frenchcountryinteriors' + '.' + 'i' + 'e' + '"><img src="/includes/graphics/menu_email.gif" alt="email" border="0px" /></a>');
}

// usage: 
//<script language="JavaScript"> jemail("webmaster", "javascriptsource", "com"); < /scr ipt>
// The code looks slightly odd so as to foil even smart spam
// No spam code borrowed from: http://javascript.internet.com/miscellaneous/no-spam-e-mail.html

/* parseUri JS v0.1, by Steven Levithan (http://badassery.blogspot.com)
Splits any well-formed URI into the following parts (all are optional):
----------------------
• source (since the exec() method returns backreference 0 [i.e., the entire match] as key 0, we might as well use it)
• protocol (scheme)
• authority (includes both the domain and port)
    • domain (part of the authority; can be an IP address)
    • port (part of the authority)
• path (includes both the directory path and filename)
    • directoryPath (part of the path; supports directories with periods, and without a trailing backslash)
    • fileName (part of the path)
• query (does not include the leading question mark)
• anchor (fragment)
*/
function parseUri(sourceUri){
    var uriPartNames = ["source","protocol","authority","domain","port","path","directoryPath","fileName","query","anchor"];
    var uriParts = new RegExp("^(?:([^:/?#.]+):)?(?://)?(([^:/?#]*)(?::(\\d*))?)?((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[\\?#]|$)))*/?)?([^?#/]*))?(?:\\?([^#]*))?(?:#(.*))?").exec(sourceUri);
    var uri = {};
    
    for(var i = 0; i < 10; i++){
        uri[uriPartNames[i]] = (uriParts[i] ? uriParts[i] : "");
    }
    
    // Always end directoryPath with a trailing backslash if a path was present in the source URI
    // Note that a trailing backslash is NOT automatically inserted within or appended to the "path" key
    if(uri.directoryPath.length > 0){
        uri.directoryPath = uri.directoryPath.replace(/\/?$/, "/");
    }
    
    return uri;
}