function openPopup(url, name, width, height)
{
	var oTarget = window.open(url, name, 'scrollbars=yes, toolbar=no, resizable=yes, menubar=no, status=no, width=' + width + ', height=' + height + ' top=250, left=350');
	oTarget.focus();
	return false;
}

function openScrolledPopup(url, name, width, height)
{
	var oTarget = window.open(url, name, 'scrollbars=yes, toolbar=no, resizable=yes, menubar=no, status=no, width=' + width + ', height=' + height + ' top=250, left=350');
	oTarget.focus();
	return false;
}

function openScrolledPopupPos(url, name, width, height, xpos, ypos)
{
	var oTarget = window.open(url, name, 'scrollbars=yes, toolbar=no, resizable=yes, menubar=no, status=no, width=' + width + ', height=' + height + ' top=' + ypos + ', left=' + xpos);
	oTarget.focus();
	return false;
}

function nextFieldFocus(curObj, prevObj, nextObj, length, event)
{
	if( event.keyCode == '37' || event.keyCode == '39' )
	{
		return;
	}
  if(nextObj != null && curObj.value.length == length && event.keyCode != '9' && event.keyCode != '16')
  {
    nextObj.focus();
    nextObj.select();
  }
  if(event.keyCode == '8' && curObj.value.length == 0)
  {
    prevObj.focus();
    rng = prevObj.createTextRange(); 
    rng.collapse(false); 
    rng.select(); 
    prevObj.click(); 
  }
}

function GetSelectValue(controlID)
{
	return document.getElementById(controlID).options[document.getElementById(controlID).options.selectedIndex].value;
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

//************************************************************* 
function Trim (str)  
{ 
	return RTrim(LTrim(str)); 
} 
//************************************************************* 	
function LTrim (str) { 
var ret_str = str; 
for (var i=0; i<str.length; i++){ 
	if (str.charAt(i) == ' ') {;} 
	else  
	{ 
		ret_str = str.substring(i); 
		return ret_str; 
	} 
} 
ret_str=''; 
return ret_str; 
} 
//************************************************************* 
function RTrim (str) { 
	var ret_str = str; 
	for (var i=(str.length-1); i>=0; i--) 
	{ 
		if (str.charAt(i) == ' ') {;} 
		else  
		{ 
			ret_str = str.substring(0,(i+1)); 
			return ret_str; 
		} 
	} 
	ret_str=''; 
	return ret_str; 
} 
//************************************************************* 
function onUnloadHandler(){
	if(self.VBArray){
		var e = self.event, s = self.screen;
  	if (e.clientX + s.width < 0	&& e.clientY + s.height < 0 && typeof(window.onclose) == "function") {
			window.onclose();
		};
	};
};

onunload =onUnloadHandler;


function onclose(){
	//window.open('/survey.html' ,'_blank', 'width=550, height=550,scrollbars=yes, toolbar=no, resizable=yes');
};
