var PreloadFlag = false;
var expDays = 90;
var exp = new Date(); 
var tmp = '';
var tmp_counter = 0;
var tmp_open = 0;

exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function SetCookie(name, value) 
{
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape(value) +
		((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
		((path == null) ? "" : ("; path=" + path)) +
		((domain == null) ? "" : ("; domain=" + domain)) +
		((secure == true) ? "; secure" : "");
}

function getCookieVal(offset) 
{
	var endstr = document.cookie.indexOf(";",offset);
	if (endstr == -1)
	{
		endstr = document.cookie.length;
	}
	return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie(name) 
{
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) 
	{
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
			return getCookieVal(j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0)
			break;
	} 
	return null;
}

function ShowHide(id1, id2, id3) 
{
	var res = expMenu(id1);
	if (id2 != '') expMenu(id2);
	if (id3 != '') SetCookie(id3, res, exp);
}
	
function expMenu(id) 
{
	var itm = null;
	if (document.getElementById) 
	{
		itm = document.getElementById(id);
	}
	else if (document.all)
	{
		itm = document.all[id];
	} 
	else if (document.layers)
	{
		itm = document.layers[id];
	}
	if (!itm) 
	{
		// do nothing
	}
	else if (itm.style) 
	{
		if (itm.style.display == "none")
		{ 
			itm.style.display = ""; 
			return 1;
		}
		else
		{
			itm.style.display = "none"; 
			return 2;
		}
	}
	else 
	{
		itm.visibility = "show"; 
		return 1;
	}
}

function showMenu(id)
{
	var itm = null;
	if (document.getElementById) 
	{
		itm = document.getElementById(id);
	}
	else if (document.all)
	{
		itm = document.all[id];
	} 
	else if (document.layers)
	{
		itm = document.layers[id];
	}
	if (!itm) 
	{
		// do nothing
	}
	else if (itm.style) 
	{
		if (itm.style.display == "none")
		{ 
			itm.style.display = ""; 
			return true;
		}
		else
		{
//			itm.style.display = "none"; 
			return true;
		}
	}
	else 
	{
		itm.visibility = "show"; 
		return true;
	}
}

function hideMenu(id)
{
	var itm = null;
	if (document.getElementById) 
	{
		itm = document.getElementById(id);
	}
	else if (document.all)
	{
		itm = document.all[id];
	} 
	else if (document.layers)
	{
		itm = document.layers[id];
	}
	if (!itm) 
	{
		// do nothing
	}
	else if (itm.style) 
	{
		if (itm.style.display == "none")
		{ 
//			itm.style.display = ""; 
			return true;
		}
		else
		{
			itm.style.display = "none"; 
			return true;
		}
	}
	else 
	{
		itm.visibility = "hide"; 
		return true;
	}
}

/*

   "Resize Avatars Based on Max Width and Height" 1.0.1
   A phpBB MOD originally created by Christian Fecteau.

   This MOD is copyright (c) Christian Fecteau 2005

   This MOD is released under the Creative Commons licence:
   http://creativecommons.org/licenses/by-nc-sa/2.0/
   Read carefully this licence before making any use of my code.

   Credits must be given with my full name (Christian Fecteau)
   and a link to my portfolio: http://portfolio.christianfecteau.com/

   Removal or alteration of this notice is strongly prohibited.

*/

// don't change anything below
if (document.getElementsByTagName && document.createElement) // W3C DOM browsers
{
	rmwa_pop_features = 'top=0,left=0,width=' + String(window.screen.width-80) + ',height=' + String(window.screen.height-190) + ',scrollbars=1,resizable=1';
	rmwa_count = 1;
	if (!window.opera)
	{
		rmwa_pop = new Object();
		rmwa_pop.closed = true;
		rmwa_old_onunload = window.onunload;
		window.onunload = function()
		{
			if (rmwa_old_onunload)
			{
				rmwa_old_onunload();
				rmwa_old_onunload = null;
			}
			if (!rmwa_pop.closed)
			{
				rmwa_pop.close();
			}
		}
	}
}
function rmwa_img_loaded(rmwa_obj, rmwa_max_width, rmwa_max_height)
{
	if (!document.getElementsByTagName || !document.createElement)
	{
		return;
	}
	var rmwa_real_width = rmwa_real_height = rmwa_offset_width = rmwa_offset_height = false;
	if (rmwa_obj.width && rmwa_obj.height)
	{
		rmwa_real_width = rmwa_obj.width;
		rmwa_real_height = rmwa_obj.height;
	}
	if (!rmwa_real_width || isNaN(rmwa_real_width) || (rmwa_real_width <= 0) || !rmwa_real_height || isNaN(rmwa_real_height) || (rmwa_real_height <= 0))
	{
		var rmwa_rand1 = String(rmwa_count++);
		eval("rmwa_retry" + rmwa_rand1 + " = rmwa_obj;");
		eval("rmwa_x" + rmwa_rand1 + " = rmwa_max_width;");
		eval("rmwa_y" + rmwa_rand1 + " = rmwa_max_height;");
		eval("window.setTimeout('rmwa_img_loaded(rmwa_retry" + rmwa_rand1 + ",rmwa_x" + rmwa_rand1 + ",rmwa_y" + rmwa_rand1 + ")',1000);");
		return;
	}
	if (rmwa_real_width > rmwa_max_width)          { rmwa_offset_width = rmwa_real_width - rmwa_max_width; }
	if (rmwa_real_height > rmwa_max_height)        { rmwa_offset_height = rmwa_real_height - rmwa_max_height; }
	if (!rmwa_offset_width && !rmwa_offset_height) { return; }

	if (rmwa_offset_width > rmwa_offset_height)    { rmwa_make_pop(rmwa_obj, rmwa_max_width, null); }
	else                                           { rmwa_make_pop(rmwa_obj, null, rmwa_max_height); }
}
function rmwa_make_pop(rmwa_ref, rmwa_x, rmwa_y)
{
	(rmwa_x == null) ? rmwa_ref.style.height = String(rmwa_y) + 'px' : rmwa_ref.style.width = String(rmwa_x) + 'px';
	if (!window.opera)
	{
		rmwa_ref.onclick = function()
		{
			if (!rmwa_pop.closed)
			{
				rmwa_pop.close();
			}
			rmwa_pop = window.open('about:blank','spooky2280',rmwa_pop_features);
			rmwa_pop.resizeTo(window.screen.availWidth,window.screen.availHeight);
			rmwa_pop.moveTo(0,0);
			rmwa_pop.focus();
			rmwa_pop.location.href = this.src;
		}
	}
	else
	{
		var rmwa_rand2 = String(rmwa_count++);
		eval("rmwa_pop" + rmwa_rand2 + " = new Function(\"rmwa_pop = window.open('" + rmwa_ref.src + "','christianfecteaudotcom','" + rmwa_pop_features + "'); if (rmwa_pop) {rmwa_pop.focus();}\")");
		eval("rmwa_ref.onclick = rmwa_pop" + rmwa_rand2 + ";");
	}
	document.all ? rmwa_ref.style.cursor = 'hand' : rmwa_ref.style.cursor = 'pointer';
}

