function goWindow(iUrl, iTitle, iProps) {
	var topPos = iProps.indexOf("left");
	var leftPos = iProps.indexOf("top");
	var aWidth = iProps.indexOf("width");
	var aHeight = iProps.indexOf("height");
	if(topPos == -1 && leftPos == -1) {
		if(aWidth != -1 && aHeight != -1) {
			var propBits = iProps.split(",");
			var widthVal; var heightVal;
			for(var index = 0; index < propBits.length; index++) {
				var theProp = propBits[index];
				var widthPos = theProp.indexOf("width");
				if(widthPos != -1) {
					var eqPos = theProp.indexOf("=");
					widthVal = theProp.substring(eqPos + 1);
				}
			}
			for(var index = 0; index < propBits.length; index++) {
				var theProp = propBits[index];
				var heightPos = theProp.indexOf("height");
				if(heightPos != -1) {
					var eqPos = theProp.indexOf("=");
					heightVal = theProp.substring(eqPos + 1);
				}
			}

			var coords = getCentreCoords(widthVal, heightVal);
			iProps = iProps + ",top=" + coords[0] + ",left=" + coords[1];
		}
	}
	// Bug fix KUK-1621, prevent blank new window
	if (iUrl != '') {
		var win = window.open(iUrl, iTitle, iProps);
		win.focus();
	}
}

function goSearchProducts() {
	var searchForm = document.getElementById("DesignSearchForm");
	searchForm.submit();
}

function setStatusBarMessage(statusbarmessage)  {
   window.status = statusbarmessage;
}

var message="";
var start=130;
var position=130;
var scrollID;

function addSpaces(count) {
    space="";
    for (i=0; i < count; i=i+1) {space +=" ";}
    return space;
}

function showStatus() {
    if (position < -message.length) position=start;
    position = position - 1;
    if (position < 0) {
        window.status=message.substring(-position);
    } else {
        window.status=addSpaces(position) + message.substring(0, start-position);
    }
}

function scrollStatusBarMessage(statusBarMessage) {
	message = statusBarMessage;
    scrollID=setInterval("showStatus()", 100);
}

function handleSubmission(iCode, iElementIds, iCallBackFunction) {
	if (iCode && iElementIds) {
		var map = {};
		for (var i = 0; i < iElementIds.length; i=i+1) {
			var elId = iElementIds[i];
			var el = document.getElementById(elId);
			map[el.name] = el.value;
		}
		
		/*GenericInputService.processInput(iCode, map, function(iActionSts) {
			alert(iActionSts.actionMessage);
		});*/
		
		GenericInputService.processInput(iCode, map, iCallBackFunction);
	}
}

var onLoads = new Array();

window.onload = function(){
  for(var i = 0; i < onLoads.length; i++)
    eval(onLoads[i]);
}

function onLoadAdd(func){
  onLoads[onLoads.length] = func;
}