function tabIt(from,to)
{
	if (from.getAttribute&&from.value.length==from.getAttribute("maxlength"))
	to.focus()
}

function ShowHideDiv(id)
{	
	var displayed = document.getElementById(id);
	if (displayed.className == '') displayed.className = 'on';
	else if (displayed.className == 'on') displayed.className = 'off';
	else displayed.className = 'on';
}

function ShowDiv(id)
{	
	var displayed = document.getElementById(id).style;
	if (displayed.display == '') displayed.display = 'none';
	else if (displayed.display == 'block') displayed.display = 'none';
	else displayed.display = 'block';
}

function HideDiv(id)
{	
	var displayed = document.getElementById(id).style;
	displayed.display = 'none';
}


/*counter = 0;
function ShowButtonAsProcessing(btn)
{
	counter++;
	
	btn.value = "...processing";
	
	if(counter >= 1) 
	{		
		alert(counter);
		
		if(counter >= 2) 
		{ 
			alert(counter);
			btn.disabled = true;
		}	
	}
}*/

function ShowButtonAsProcessing(btn)
{
	btn.value = "...processing";	
	__doPostBack(btn.name,'');
	btn.disabled = true;
}

// Pop up a new window
function popup(url,width,height,scrollbars) 
{
	var popwidth = width;
	var popheight = height;
	var leftoffset = (screen.width - popwidth - 10)/2;
	var topoffset = (screen.height - popheight - 40)/2;
	window.open(url,'_blank','titlebar=no,resizable=no,scrollbars=' + scrollbars + ',width=' + popwidth + ',height=' + popheight + ',left=' + leftoffset + ',top=' + topoffset);
}


// Flash detection
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if (plugin) 
{
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	for (var i = 0; i < words.length; ++i)
	{
  if (isNaN(parseInt(words[i]))) continue;
  var MM_PluginVersion = words[i]; 
	}
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) 
{
	document.write('<scr' + 'ipt language=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</scr' + 'ipt\> \n');
}



/** Rotation **/
var width1 //image width1
var height1 //image height1
var seconds1 = 4 //number of seconds1 before next image
var pause1 = seconds1 * 1000

var fadeimages1 = new Array()

var ie41=document.all
var dom1=document.getElementById
var curpos1 = 3
//var degree1 = 10
var curcanvasB = "canvasA"
var curimageindex1
var nextimageindex1

function SubpageRotate(paths)
{	
	fadeimages1 = paths.split(',')
	width1='257px'
	height1='386px'
	curimageindex1 = Math.floor(Math.random()*fadeimages1.length)
	nextimageindex1 = Math.floor(Math.random()*fadeimages1.length)
	
	DoRotate()
}


function DoRotate()
{
	var preloadedimages1 = new Array()
	
	for (c=0; c<fadeimages1.length; c++)
	{
		preloadedimages1[c] = new Image()
		preloadedimages1[c].src = fadeimages1[c]
	}
	
	if (ie41||dom1)
		document.write('<div style="position:relative;width:' + width1 + '; height:' + height1 + '; overflow:hidden;"><div id="canvasA" style="position:absolute; width:' + width1 + '; height:' + height1 + '; top:0; left:0; filter:alpha(opacity=10); -moz-opacity:10"></div><div id="canvasB" style="position:absolute; width:' + width1 + '; height:' + height1 + '; top:0; left:0; filter:alpha(opacity=10); -moz-opacity:10; visibility:hidden"></div></div>')
	else
		document.write('<img name="defaultslide" src="'  + fadeimages1[Math.random()*fadeimages1.length-1] + '">')
	
	if (ie41||dom1)
		window.onload=startit2
	else
		setInterval("rotateimage2()",pause1)
}

/*
this method produces the fading effect of the image.
the curpos1 variable is set to the opacity level of the fading.
*/
function fadepic1()
{
	if (curpos1 < 100)
	{
		curpos1 += 3
		if (temp1obj1.filters)
			temp1obj1.filters.alpha.opacity = curpos1
		else if (temp1obj1.style.MozOpacity)
			temp1obj1.style.MozOpacity = curpos1/101
		}
	else
	{
		clearInterval(dropslide1)
		nextcanvas1 = (curcanvasB == "canvasA")? "canvasA" : "canvasB"
		temp1obj1=ie41? eval("document.all." + nextcanvas1) : document.getElementById(nextcanvas1)
		temp1obj1.innerHTML = insertimage2(nextimageindex1)
		nextimageindex1 = (nextimageindex1<fadeimages1.length-1)? nextimageindex1 + 1 : 0
		var temp1obj12=ie41? eval("document.all." + nextcanvas1) : document.getElementById(nextcanvas1)
		temp1obj12.style.visibility = "hidden"
		
		setTimeout("rotateimage2()",pause1)
	}
}

function insertimage2(i)
{
	var temp1container1 = fadeimages1[i] != ""? '<img src="'+fadeimages1[i]+'" border="0">' : ""
	return temp1container1
}

function rotateimage2()
{
	if (ie41||dom1)
	{
		resetit1(curcanvasB)
		var crossobj1 = temp1obj1=ie41? eval("document.all." + curcanvasB) : document.getElementById(curcanvasB)
		crossobj1.style.zIndex++
		temp1obj1.style.visibility = "visible"
		var temp1 = 'setInterval("fadepic1()",50)'
		dropslide1 = eval(temp1)
		curcanvasB = (curcanvasB == "canvasA")? "canvasB" : "canvasA"
	}
	else
		document.images.defaultslide.src = fadeimages1[curimageindex1]
		curimageindex1 = (curimageindex1 < fadeimages1.length-1)? curimageindex1 + Math.floor(Math.random()*fadeimages1.length-1) : 0
}

/*
this allows for a smoth transition when the new 
image is loaded, so the image doesn't blink.
*/
function resetit1(what1)
{
	curpos1 = 4
	var crossobj1=ie41? eval("document.all." + what1) : document.getElementById(what1)
		if (crossobj1.filters)
			crossobj1.filters.alpha.opacity = curpos1
		else if (crossobj1.style.MozOpacity)
			crossobj1.style.MozOpacity = curpos1/101
}

function startit2()
{
	var crossobj1=ie41? eval("document.all." + curcanvasB) : document.getElementById(curcanvasB)
	crossobj1.innerHTML = insertimage2(curimageindex1)
	rotateimage2()
}


/** Address Scrambler **/
var offset = 7;

function encode(str)
{
  var encoded = "";
  for (var i = 0; i < str.length; i++)
  {
    var c = str.charCodeAt(i) + offset;
    encoded += c ;
    if (i < str.length - 1) encoded += ",";
  }
  document.write(encoded); 
}

function decode()
{
  var str = "";
  for (var i = 0; i < arguments.length; i++)
  {
    var p = arguments[i] - offset;
    str += String.fromCharCode(p)
  }
	document.write('<a href="mailto:' + str + '">' + str + '</a>');
}

function decodeWithCustomDisplay(email, display)
{
  var str = "";
	email = email.split(",");
	
  for (var i = 0; i < email.length; i++)
  {
    var p = email[i] - offset;
    str += String.fromCharCode(p)
	}
	document.write('<a href="mailto:' + str + '">' + display + '</a>');
}