//##################################################################################
//# Title: include.js
//##################################################################################
//#
//# Author: Dave Bizant D&J Bizant Pty T/as Biztech
//# Description: Poll Administration Page
//#	Copyright D & J Bizant Pty Ltd. 1st June 2005.
//#All rights reserved. It is an offence to copy, use or modify scripts without
//# the express permmission of the author.
//#
//#  Contact: Dave Bizant 61 2 62806998			
//#
//#
//# Date Created: 08//01/2006
//# Inputs: 
//# Outputs:
//#
//# Database: 
//#
//# Change History:
//# Author   Date    	Description
//#----------------------------------------------------------------------------
//# SRM      08/01/2006  Creation
//#
//##################################################################################


//##################################################################################
//#  MAIN: This is where the program begins.
//#  All the sub (procedures) above are called from this main section.
//##################################################################################
// A puzzle
function _puzzle( str , key , method ){// boyscout codec
// takes a string and shift key and codes or decodes based on method
// method param default is code = 0
// decode = 1
// returns string
var returnStr = '' ;
var codeArr = new Array();
	for(c=0;c<str.length;c++){
		codeArr[c] = str.charCodeAt(c) ;
		if ( method > 0 ) codeArr[c] += key ;
		else codeArr[c] -= key	;
	}
	for(c=0;c<codeArr.length;c++){
		returnStr += String.fromCharCode( codeArr[c] ) ;
		//returnStr += codeArr[c] + "," ;
	}

	return returnStr ;
}
/*##################################################################################*/
function _complexStr( str ){
// return true if str is 5 characters and contains numbers
var re = /[0-9]/;
var re1 = /[a-zA-Z]/;
var re3 = /\W/;
	if ( re.test(str) && re1.test(str) && str.length > 5 && !re3.test(str) ){
	return true ;
	}
	else {
	return false ;
	}
}
/*##################################################################################*/
// accepts a string and returns same string stripped of any trailing spaces
function _ltrim( str ){
	while ( str.charAt(0) == " " ){
		str = str.slice(1);
	}
return str
}		
/*##################################################################################*/
// accepts a string and returns same string stripped of any trailing spaces
function _rtrim( str ){
	while ( str.charAt( str.length-1 ) == " " ){
		str = str.slice(0,str.length-1);
	}
return str
}		
/* ************************************************************************************/
/* Formating functions used on client side
/* ************************************************************************************/
function _menuSelect(obj){ //alter class definition for object
		document.getElementById( obj.id ).className='menuSelected';
	}
function _menuUnSelect(obj){
		document.getElementById( obj.id ).className='menu';
}
/* *************************************************************************************/
