function slideLeftToggle(selector, speed)
	{
	type = $(selector).css('display') == 'none' ? 'in' : 'out';	

	if(type == 'in')
		{
		$(selector).animate({width: "toggle"},speed);
		//$(selector).css('visibility', 'hidden');
		//$(selector).css('display', 'block');
		}
	else
		{
		$(selector).animate({width: "toggle"},speed); 
		//$(selector).css('display', 'none');
		//$(selector).css('visibility', 'visible');
		}
	return false;
	}





//Functions to scroll the screen to anchor links instead of the JUMP
var scrollInt;
var scrTime, scrSt, scrDist, scrDur, scrInt;
function replaceAnchorLinks()
{
	var anchors, i, targ, targarr;
	if (!document.getElementById)
		return;
	// get all anchors
	anchors = document.getElementsByTagName("a");
	for (i=0;i<anchors.length;i++)
	{
		// check if href links to an anchor on this page
		if ( anchors[i].href.indexOf("#") != -1 && anchors[i].href.indexOf( document.URL ) != -1 )
		{
			// get name of target anchor
			targ = anchors[i].href.substring( anchors[i].href.indexOf("#")+1 );
			
			// find target anchor
			targarr = document.getElementsByName( targ );
			
			if (targarr.length)
			{
				anchors[i].className = (targarr[0].offsetTop < anchors[i].offsetTop) ? "up" : "down";
				anchors[i].id = "__" + targ;	// save target as id with prefix (used in onclick function below)
				anchors[i].onmousedown = function () { scrollToAnchor( this.id.substring( 2 ) ); return false; };
				anchors[i].href = "#";			// rewrite href
			}
		}
		
	}
}

/*
SCROLL FUNCTIONS
*/
function scrollPage()
{
	scrTime += scrInt;
	if (scrTime < scrDur) {
		window.scrollTo( 0, easeInOut(scrTime,scrSt,scrDist,scrDur) );
	}else{
		window.scrollTo( 0, scrSt+scrDist );
		clearInterval(scrollInt);
	}
}

function scrollToAnchor(aname)
{
	var anchors, i, ele;

	if (!document.getElementById)
		return;
	
	// get anchor
	anchors = document.getElementsByTagName("a");
	for (i=0;i<anchors.length;i++) {
		if (anchors[i].name == aname) {
			ele = anchors[i];
			i = anchors.length;
		}
	}
	
	// set scroll target
	if (window.scrollY)
		scrSt = window.scrollY;
	else if (document.documentElement.scrollTop)
		scrSt = document.documentElement.scrollTop;
	else
		scrSt = document.body.scrollTop;

	scrDist = ele.offsetTop - scrSt;
	scrDur = 500;
	scrTime = 0;
	scrInt = 10;
	
	// set interval
	clearInterval(scrollInt);
	scrollInt = setInterval( scrollPage, scrInt );
}

/*
EASING FUNCTIONS
*/
function easeInOut(t,b,c,d)
{
	return c/2 * (1 - Math.cos(Math.PI*t/d)) + b;
}

//Pops up href location in a new centered window using the specified attributes.
function popupwin(thehref, win, xwidth, yheight, attrib )
	{
	//figure out the center position
	var scrW = screen.availWidth;
	var scrH = screen.availHeight;
	if (xwidth > scrW)
		{
		pW = scrW - 10;
		}
	else
		{
		pW = xwidth;
		}
	if (yheight > scrH)
		{
		pH = scrH - 40;
		}
	else
		{
		pH = yheight;
		}
	scrX = (scrW - pW - 10) * .5;
	scrY = (scrH - pH - 30) * .5; 
	
	var windowatts = "width=" + xwidth + ",height=" + yheight + ",left=" + scrX + ",top=" + scrY + ",screenX=" + scrX + ",screenY=" + scrY;
  windowatts += "," + attrib;
	window.open( thehref, win, windowatts);
	return false;
	}
	
//***************************************************************************
// PRE-LOAD functions using JQuery
// LEAVE THESE LAST IN THE FILE SO THEY ARE EASY TO FIND PLEASE
$(document).ready(function()
	{
	$("img.rdropshadow")
		.wrap("<div class='alpha-shadow' style='float:right'><div></div></div>");		

	$("img.ldropshadow")
		.wrap("<div class='alpha-shadow' style='float:left'><div></div></div>");		

	$("img.dropshadow")
		.wrap("<div class='alpha-shadow'><div></div></div>");
		
	$("a.popup").click( function()
		{
			var address = this.href;
			popupwin(address, '', 800, 600, 'statusbar=1,status=1,toolbar=1,scrollbars=1,resizable=1,location=1,address=1,directories=1,menubar=1' );
			return false;
		});
	$("a.popup_bigger").click( function()
		{
			var address = this.href;
			popupwin(address, '', 860, 750, 'statusbar=1,status=1,toolbar=1,scrollbars=1,resizable=1,location=1,address=1,directories=1,menubar=1' );
			return false;
		});
	$("a.popup_form").click( function()
		{
			var address = this.href;
			popupwin(address, '', 650, 750, 'statusbar=1,status=1,toolbar=1,scrollbars=1,resizable=1,location=1,address=1,directories=1,menubar=1' );
			return false;
		});		
	});	
// LEAVE THESE LAST IN THE FILE SO THEY ARE EASY TO FIND PLEASE
//********************************************************************************