//change the amount paid
function changeAmount(obj)
{
	var fld = document.membpay.FinanceAmountpaid;
	var membType = obj.selectedIndex;
	var membVal = amount[membType];
	fld.value = membVal;
}//changeAmount



// change the fields which the user sees

var curPayMethod = 'cheque';

function fedPayTypeSlide(obj)
{
	var thisMethod = obj.options[obj.selectedIndex].text;

	if (curPayMethod != thisMethod)
	{
		if ((curPayMethod == 'visa' || curPayMethod == 'mastercard') && (thisMethod != 'visa' && thisMethod != 'mastercard'))
		{
			new Effect.SlideUp('paybycc1');
			new Effect.SlideUp('paybycc2');
			new Effect.SlideUp('paybycc3');
		}

		if (curPayMethod == 'cheque')
		{
			new Effect.SlideUp('paybychq1');
			new Effect.SlideUp('paybychq2');
		}
		
	}
	
	if (thisMethod == 'cheque')
	{
		new Effect.SlideDown('paybychq1');
		new Effect.SlideDown('paybychq2');
	}
	else if(thisMethod == 'visa' || thisMethod == 'mastercard')
	{
		new Effect.SlideDown('paybycc1');
		new Effect.SlideDown('paybycc2');
		new Effect.SlideDown('paybycc3');
	}
	curPayMethod = thisMethod;
}//fedPayTypeSlide


function RunSlideShow(id){
	if( document.SlideShowArray[id] )
	{
		if( document.SlideShowArray[id].preLoad[document.SlideShowArray[id].j].complete )
		{
			if (document.all){
				document.SlideShowArray[id].object.style.filter="blendTrans(duration=" + document.SlideShowArray[id].crossFadeDuration + ")"
				document.SlideShowArray[id].object.filters.blendTrans.Apply()      
			}
			document.SlideShowArray[id].object.src = document.SlideShowArray[id].preLoad[document.SlideShowArray[id].j].src
			if (document.all){
				document.SlideShowArray[id].object.filters.blendTrans.Play()
			}
			document.SlideShowArray[id].j = document.SlideShowArray[id].j + 1
			if (document.SlideShowArray[id].j > (document.SlideShowArray[id].p-1)) document.SlideShowArray[id].j=0
		}
		setTimeout('RunSlideShow(\"' + id + '\")', document.SlideShowArray[id].slideShowSpeed)
	}
}

function SlideShowObject(imgObject, arguments)
{
	this.object = imgObject
	this.slideShowSpeed = arguments[1]
	this.crossFadeDuration = arguments[2]
	this.Pic = new Array()
	
	for (i=3; i < (arguments.length); i++) {
		this.Pic[i-3] = arguments[i]
	}
	
	this.j = 0
	this.p = this.Pic.length
	
	this.preLoad = new Array()
	for (i = 0; i < this.p; i++){
	   this.preLoad[i] = new Image()
	   this.preLoad[i].src = this.Pic[i]
	}
}

// Params: imgObject, slideShowSpeed, crossFadeDuration, slideShowImages
// eg: <img src="slideshow1.jpg" onload="CreateSlideShow(this,4000,2,'slideshow2.jpg','slideshow3.jpg','slideshow1.jpg')">
function CreateSlideShow(imgObject, slideShowSpeed, crossFadeDuration)
{
	if( !document.SlideShowArray ) document.SlideShowArray = new Array()
	if( !document.SlideShowCounter ) document.SlideShowCounter = 0;
	
	if( imgObject.name == "" )
	{
		imgObject.name = "slide" + document.SlideShowCounter++;
	}
	
	if( document.SlideShowArray[imgObject.name] == null)
	{
		document.SlideShowArray[imgObject.name] = new SlideShowObject(imgObject, CreateSlideShow.arguments)
		setTimeout('RunSlideShow(\"' + imgObject.name + '\")', ( slideShowSpeed > (crossFadeDuration*1000) ? slideShowSpeed - (crossFadeDuration*1000) : 0))
	}
}

//change the amount paid -- used on finance screens
function changeAmount(obj)
{
	var fld = document.membpay.FinanceAmountpaid;
	var membType = obj.selectedIndex;
	var membVal = amount[membType];
	fld.value = membVal;
}//changeAmount

function fldClear(fld, str)
{
	if (fld.value == str) {fld.value = '';}
}
function fldFill(fld, str)
{
	if (fld.value == '') {fld.value = str;}
}


//http://www.webreference.com/programming/javascript/onloads/
function addLoadEvent(func) { 
  var oldonload = window.onload; 
  if (typeof window.onload != 'function') { 
    window.onload = func; 
  } else { 
    window.onload = function() { 
      if (oldonload) { 
        oldonload(); 
      } 
      func(); 
    } 
  } 
}

function finishOff() { 
  if (typeof doLast == 'function') { 
    doLast(); 
  } 
}