
<!--

/************************************************
/		function setCookie(name,value,days)
/	
************************************************/

function setCookie(name,value,days){

	var expires, date;
	if(value == "") {return;}
	if(days){
		date = new Date();
		date.setTime(date.getTime()+(parseInt(days)*24*60*60*1000));
		expires = "; expires=" + date.toGMTString();
	}
	else expires = "";
	document.cookie = name + "=" + value + expires + "; path=/";
}

/************************************************
/		function getCookie(name)
/	
************************************************/

function getCookie(name){

	var nameEQ = name + "=";
	var c, ca = document.cookie.split(';');
	var re = new RegExp;
	for(var i=0;i<ca.length;i++){
		c = ca[i];
		while(/^(\s{1})(\b[\w\W]*)$/.test(c)) {c = c.ltrim();}
		re.compile(nameEQ,'');
		if(re.test(c)) {return c.replace(re,"");}
	}
	return null;
}

/************************************************
/		function eraseCookie(name))
/	
************************************************/

function eraseCookie(name){

	var string = "=\"\""; 
	if(getCookie(name)) {
		var date = new Date();
		date.setTime(date.getTime()+(parseInt(-1)*24*60*60*1000));
		var expires = "; expires=" + date.toGMTString();
		document.cookie = name + string + expires + "; path=/";
	}

}

/************************************************
/		function checkCookie()
/	
************************************************/

function checkCookie(s){
	
	if(!bCookies) {return false;}
	var y = getCookie(s) ? true : false;
	return y;
}


/***************************************************
/		 function getObjectHeight(obj)
/		 Retrieve the rendered height of an element
/        
/**************************************************/

function getObjectHeight(obj){
    var elem = getRawObject(obj);
    var result = 0;
    if (elem.offsetHeight) {
        result = elem.offsetHeight;
    } else if (elem.clip && elem.clip.height) {
        result = elem.clip.height;
    } else if (elem.style && elem.style.pixelHeight) {
        result = elem.style.pixelHeight;
    }
    return parseInt(result);
    
}	

/***************************************************
/		getObjPosition(obj)
/		bottom of chrome to element and left edge to element
/
/**************************************************/

function getObjPosition(id){

	var obj = (isObject(id)) ? id : gObj(id);
	var offsetLeft = 0, offsetTop = 0;
	while(obj){
		offsetLeft += obj.offsetLeft;
		offsetTop += obj.offsetTop;
		obj = obj.offsetParent;
	}
	if(is.MAC && typeof(document.body.leftMargin) != "undefined"){
		offsetLeft += document.body.leftMargin;
		offsetTop += document.body.topMargin;
	}
	//return(left:offsetLeft, top:offsetTop);  //we only need top
	return offsetTop;
	
}

/***************************************************
/		function getInsideWindowHeight()
/		top of status bar to bottom of chrome in pixels
/
/**************************************************/

function getInsideWindowHeight(){

	if(window.innerHeight) {return window.innerHeight;}
	else if(is.IE6CSS) {return document.body.parentElement.clientHeight;}
	else if(document.body && document.body.clientHeight) {return document.body.clientHeight;}
	return 0;
	
}

/***************************************************
/		function shiftTo(obj,x,y)
/		move obj or obj name(id) to coords (x,y)
/		
/**************************************************/

function shiftTo(obj,x,y){
	
	var tmpObj = getStyleObject(obj);
	if(tmpObj){
		if(is.CSS){
            var units = ((typeof tmpObj.left == "string")) ? "px" : 0;
            tmpObj.left = x + units;
            tmpObj.top = y + units;
        } 
        else if(is.NS4){tmpObj.moveTo(x,y)}
	}
	
}

/***************************************************
/		function getRawObject(obj)
/
/**************************************************/

function getRawObject(obj){

	if(!isString(obj)) {return obj;}
	var testObj = gObj(obj);
	if(isString(testObj) && testObj == 'Object not found') {return false;}
	return testObj;
	
}

/***************************************************
/		function getStyleObject(obj)
/
/**************************************************/

function getStyleObject(obj){

	var tmpObj = getRawObject(obj);
	if(!tmpObj) {return false;}
	else if(tmpObj && is.CSS){
		tmpObj = tmpObj.style;
		return tmpObj;
	}

}

/************************************************
/		setFocus(field)
/	
************************************************/

function setFocus(field){

	if(isObject(field)) {if(field.focus) field.focus();}
	else{
		if(Field.form[field].focus) Field.form[field].focus();
		if(Field.form[field].type!="select-one" || Field.form[field].type!="select-multiple") Field.form[field].select();
	}
	
}

/************************************************
/		function resetPage()
/	
************************************************/

function resetPage(){location.replace(currURL);}


/************************************************
/		function getTargetElement(e)
/	
************************************************/

function getTargetElement(e){
	var src;
	if(e.target){
		src = (e.target.nodeType == 3) ? e.target.parentNode : e.target;
	}
	else{
		src = e.srcElement;
	}
	return src;
	
}

/************************************************
/		object and string functions
/	
************************************************/

Function.prototype.method = function (name, func) {
    this.prototype[name] = func;
    return this;
};
function isNull(a) {
    return typeof a == 'object' && !a;
};
function isObject(a) {
    return (a && typeof a == 'object') || isFunction(a);
};
function isString(a) {
    return typeof a == 'string';
};
function isFunction(a) {
    return typeof a == 'function';
};
function isArray(a) {
    return isObject(a) && a.constructor == Array;
};
function isBoolean(a) {
    return typeof a == 'boolean';
};
function isBlank(v) {
	if(v.match(/^s+$/) || v == "") {return true;} return false;
};
String.method('ltrim', function () {
    return this.replace(/^(\s*)(\b[\w\W]*)$/, "$2");
}); 
String.method('trim', function () {
    return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1");
});

//-->