
//===========================================================================================

		function checkLength(o,n,min,max, tipObject) {

			if ( o.val().length > max || o.val().length < min ) {
				o.addClass('ui-state-error');
				updateTips("Length of " + n + " must be between "+min+" and "+max+".",tipObject);
				return false;
			} else {
				return true;
			}

		}

//===========================================================================================

		function checkRegexp(o,regexp,n,tipObject) {

			if ( !( regexp.test( o.val() ) ) ) {
				o.addClass('ui-state-error');
				updateTips(n, tipObject);
				return false;
			} else {
				return true;
			}

		}

//===========================================================================================
		function updateTips(t, tipObject) {
			tipObject.text(t).effect("highlight",{},1500);
		}		



//===========================================================================================	
function getObjectProperties(passedobject){

var str = "";

for(prop in passedobject)
    str += prop + "value: " + passedobject[prop] + "\n";
console.log(str);
//alert(str); 
}


function fourdaf_dev_errorTrap ( atype, aHint, aMessage ){
	RRS_ErrorTrap ( aHint, aMessage );
}



// number formatting function
// copyright Stephen Chapman 24th March 2006, 22nd August 2008
// permission to use this function is granted provided
// that this copyright notice is retained intact

function formatNumber(num,dec,thou,pnt,curr1,curr2,n1,n2) {var x = Math.round(num * Math.pow(10,dec));if (x >= 0) n1=n2='';var y = (''+Math.abs(x)).split('');var z = y.length - dec; if (z<0) z--; for(var i = z; i < 0; i++) y.unshift('0'); if (z<0) z = 1; y.splice(z, 0, pnt); if(y[0] == pnt) y.unshift('0'); while (z > 3) {z-=3; y.splice(z,0,thou);}var r = curr1+n1+y.join('')+n2+curr2;return r;}


//===========================================================================================
//  ******* Choice List define object
function objChoiceList(name){
	this.name = name;
	this.ids = [];
	this.values = [];	
	this.findbyid = function(queryid) {
		for(var i = 0; i < this.ids.length; i++){
			if(this.ids[i] == queryid) {return i;}
		}
		return -1;
	}
}

//  ******* Choice List assign to select 
function buildSelectElement(theChoiceArray, theChoiceListObject,theSelectElementArray) {   
	for(var j = 0; j < theSelectElementArray.length; j++){
		for(var i = 0; i < theChoiceArray.values.length; i++){
			theChoiceListObject.ids[i] = theChoiceArray.values[i].split(':')[0];
		  	theChoiceListObject.values[i] = theChoiceArray.values[i].split(':')[1];
			jQuery("#"+theSelectElementArray[j]).append("<option value='"+theChoiceListObject.ids[i]+"'>"+theChoiceListObject.values[i]+"</option>");
		}
	}
}

