//The following can be used to validate jS objects
var types = {
  Function: "function",
  Undefined: "undefined",
  Object: "object",
  Number: "number",
  Boolean: "boolean",

  isFunction: function(v) {
	return this.isDefined(v) && eval('typeof ' + v) == types.Function;
  },
  isObject: function(v) {
	return this.isDefined(v) && eval('typeof ' + v) == types.Object;
  },
  isMap: function(v) {
	return this.isDefined(v) && (eval('typeof ' + v) == types.Function || eval('typeof ' + v) == types.Object);
  },
  isEnumerable: function(v) {
      return types.isMap(v);
  },
  isNumber: function(v) {
	return this.isDefined(v) && eval('typeof ' + v) == types.Number;
  },
  isBoolean: function(v) {
	return this.isDefined(v) && eval('typeof ' + v) == types.Boolean;
  },
  isDefined: function(v) {
	return eval('typeof ' + v) != types.Undefined;
  },
  type: function(v) {
	if (this.isDefined(v)) return eval('typeof ' + v);
	else return types.Undefined;
  }
};

function openWin(url,target,iHeight,iWidth) {
		if (!iHeight) iHeight = 582;
		if (!iWidth) iWidth = 740;
		var iTop = (parseInt((screen.height - iHeight) / 2)) - 60;
		var iLeft = (parseInt((screen.width - iWidth) / 2) - 20);
		var sWinFeatures = "toolbar=1,location=0,top=" + iTop + ",left=" + iLeft + ",directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=" + iWidth + ",height=" + iHeight;

		window.open(url, target, sWinFeatures);
}
function ajax_getASProperties(formID,responseID) {
		
	ajax_submitForm(formID,'as_properties',"getSearchCount","Element.show('as_propertieslabel');")

}
function ajax_getPSProperties(formID,responseID) {
	
	ajax_submitForm(formID,'ps_properties',"getSearchCount","Element.show('ps_propertieslabel');")

}
function ajax_submitForm(formID,responseID,method,onCompleteJS) {
	
	var path = "/ajaxrequests/" + method + ".cfm";
	var ajaxpars = Form.serialize(formID);
	
	if (!onCompleteJS) {
		onCompleteJS = "";	
	}
	
	new Ajax.Updater(responseID,path, { 
		method: 'post', 
		asynchronous: true,
		evalScripts: true,
		parameters: ajaxpars,
		onComplete: eval(onCompleteJS)
		});

}
var behObjects = {
	'.icon' : function(element){
		element.onmouseover = function(){
			this.className = 'iconover';
		};
		element.onmouseout = function(){
			this.className = 'icon';
		}			
	}
};
Behaviour.register(behObjects);



