	var env = window.env = new (function() {
	var ack="env - Thanks to dojo";
	var n=navigator, ua = n.userAgent, av = n.appVersion, t = this;
	t.debug=false;
	t.safari = av.indexOf("Safari") >= 0;
	var g = ua.indexOf("Gecko");
	t.moz = (g >= 0)&&(!t.khtml);
	t.ie = (document.all)&&(!t.opera);
	t.ieVer = parseFloat(av.substr(av.indexOf("MSIE")+4));
	t.oldIE = t.ie && t.ieVer < 6;
	t.mozVer = (g>=0)?parseFloat(ua.substr(ua.indexOf("Firefox")+8)):0;
	t.ver = parseFloat(av);
	t.ie6up = (t.ie && t.ieVer >= 6.0);
	t.XH_IDS = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'];
	t.newXHO = function(){
		var xh = null;
		try{xh = new XMLHttpRequest(); }catch(e){}
		if(!xh){
			for(var i=0; i<3; ++i){
				var progid = env.XH_IDS[i];
				try{
					xh = new ActiveXObject(progid);
				}catch(e){}

				if(xh){
					env.XH_IDS = [progid];
					break;
				}
			}
		}
		return xh;
	}
	t.keys={
		LEFT_ARR:37,
		RIGHT_ARR:39,
		TAB:9,
		ESCAPE: 27
	};
	return this;
})();

//Inbuilt Object customization
var doc = document, w = window;
doc.byId = function(id) {
	if (doc[ELBI]) return doc[ELBI](id);
	else if (doc.all) return doc.all[id];
	else return null;
}

function defineScrollIntoView() {
if(!env.ie) {
	Object.prototype.scrollIntoView = function() {
		var coords = js.pos.toCoords(this);
		window.scrollTo(coords.x,coords.y);
	}
}
}

if(env.ieVer<8) {
}

Array.contains = function(arr, val) {
	for (var i=0;i<arr.length;i++) {
		if (arr[i] == val) return true;
	}
	return false;
}
String.prototype.trim = function() {
	return this.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}

//Consts
var ack="All consts, js, jsevt, jsui, ajax - Thanks to agodika.com, parivaar.info";
var OW="offsetWidth",OH="offsetHeight",OL="offsetLeft",OT="offsetTop",
CHN='childNodes',PN='parentNode',FC='firstChild',LC='lastChild',
APP='appendChild',
IH='innerHTML',CN='className',
InW='innerWidth',InH='innerHeight',DOCEL='documentElement',
CW='clientWidth',CH='clientHeight',
ELBI='getElementById',ELBT='getElementsByTagName',
D='disabled',CHK='checkbox',RAD="radio",C='checked',
LOADING_HTML="<table style='height:100%'><tr><td class='b' style='vertical-align:middle'><img width='50px' height='48px' src='http://www.moneysaverprime.com/img/home/loading.gif'/>Loading...</td></tr></table>";
var js = {
	body: function() {
		return doc.body || doc[ELBT]("BODY")[0];
	},
	cp:function(from,to) {
		var eo = js.empty;
		for (var p in from) {
			if ((typeof eo[p] == "undefined") || (eo[p] != from[p]))
			try{to[p] = from[p];}catch(e){};
		}
	},
	dom: {
		find:function(par,tag) {
			var cn = par[CHN];
			for (var i=0;i<cn.length;i++) {
				if (/*cn[i].nodeType == 1 && */cn[i].tagName == tag) return cn[i];
			}
		},
		findParent:function(el,tag) {
			var cn = el;
			while(cn = cn[PN]) {
				if(cn.tagName==tag)return cn;
			}
		},
		findAll:function(par,tagarr){
			var cn = par[CHN], retarr = [];
			if (js.isStr(tagarr)) tagarr = [tagarr];
			for (var i=0;i<cn.length;i++) {
				if (cn[i].nodeType == 1) {
					if(Array.contains(tagarr, cn[i].tagName)) {retarr.push(cn[i]);}
					retarr = retarr.concat(js.dom.findAll(cn[i],tagarr));
				}
			}
			return retarr;
		},

		create:function(tag,props,style) {
			var o = doc.createElement(tag);
			js.cp(props,o);
			js.cp(style,o.style);
			return o;
		},
		isNode:function(n){
			return n.nodeType>0?true:false; //we'll assume that if there's a nodeType property, its a node
		},
		append:function(n,to){to.appendChild(n);return n;},
		add:function(n){if(!env.ie || env.ieVer>=8)return js.dom._add(n);if(doc.readyState=="complete" || w.domLoaded){return js.dom._add(n);}else{if(doc.byId('ieLyrPrnt')) js.dom.append(n,doc.byId('ieLyrPrnt')); else throw "ie";}},
		_add:function(n){js.body().appendChild(n);return n;},
		/*addall:function(n){for(var o in n){js.body().appendChild(o);}},*/
		insert:function(n,old){old.parentNode.insertBefore(n,old);return n;},
		insertAfter:function(n,old){if(old.nextSibling){old.parentNode.insertBefore(n,old.nextSibling)}else{old.parentNode.appendChild(n)}return n;}
	},
	win:{
		size:function(){
			if(typeof(w[InW]) == 'number') {
				//Non-IE
				return {wd:w[InW],ht:w[InH]};
			} else if(doc[DOCEL] && (doc[DOCEL][CW] || doc[DOCEL][CH]) ) {
				//IE 6+ in 'standards compliant mode'
				return {wd:doc[DOCEL][CW],ht:doc[DOCEL][CH]};
			} else {
				//IE 4 compatible
				return {wd:doc.body[CW],ht:doc.body[CH]};
			}
		},
		scroll:function(){
			if(typeof(window.pageYOffset)=='number') {
				//FF
				return {y:window.pageYOffset,x:window.pageXOffset};
			} else {
				//IE
				var d = doc[DOCEL];
				return {y:d.scrollTop,x:d.scrollLeft};
			}
		}
	},
	pos:{
		/*Calculates and returns the position from 0,0 and width,height of node as object {x,y,w,h}*/
		toCoords:function(node){
			var cn = node;
			var r={x:0,y:0,w:cn[OW],h:cn[OH]};
			while(cn != null) {
				var x = cn[OL];
				r.x += isNaN(x)?0:x;
				x = cn[OT];
				r.y += isNaN(x)?0:x;
				cn = cn.offsetParent;
			}
			return r;
		},
		origin:function(node){
			var r={x:0,y:0},found=false;
			while (node != null) {
				node = node.offsetParent;
				if(!found) {
					try{
						var s = jsui.getStyle(node);
						switch(s.position){
							case "absolute": case "relative": found=true;
						}
					} catch(ex){}
				}
				if(node && found) {
					var x = node[OL];
					r.x += isNaN(x)?0:x;
					x = node[OT];
					r.y += isNaN(x)?0:x;
				}
			}
			return r;
		}
	},
	/*isFunctionPointer*/
	isFP:function(fp) {
		return (fp instanceof Function || typeof fp == "function");
	},
	isStr:function(s) {
		return (typeof s == "string" || s instanceof String);
	},
	isArr:function(a) {
		return (typeof a == "array" || a instanceof Array);
	},
	/*from list of arguments, pick and return first non-null value*/
	pick:function() {
		var a = arguments;
		for(var i=0;i<a.length;i++) {
			if (a[i]!=null) return a[i];
		}
	},
	setTimeout:function(ctx,fp,delay /*[, ...]*/){
		if (!ctx) ctx = window;
		if(js.isStr(fp)){fp = ctx[fp]}

		var args = [], a = arguments;
		for (var i = 3; i < a.length; i++){args.push(a[i])}
		return w.setTimeout(function(){ fp.apply(ctx, args); }, delay);
	},
	empty:{}
};
/*Function aliases*/
var JD = js.dom, F_APP = JD.append, F_CR = JD.create;

var ajax = window.ajax = {
	pool : {
		pool: [],
		get: function() {
			var p = this.pool;
			if (p.length > 0) return p.pop();
			return env.newXHO();
		},
		put: function(xho) {
			this.pool.push(xho);
		}
	},
	getText: function(/*url or object*/rp, /*callback_func*/cf, /*err_func*/ef) {
		function _readText(r) {
			if (js.isFP(cf)) {
				try { cf.call(rp.ctx,r.responseText); }
				catch (ex) {
					if (js.isFP(ef)) {
						ef.call(rp.ctx,-1,r?r.responseText:"",rp.params,ex);
					}
				}
			}
		}
		var req = this.Request((rp.url?rp.url:rp), rp.params, !rp.sync, rp.ctx, _readText, ef, rp.method?rp.method:"POST");
	},
	parseParams:function(params) {
		if (params) {
			if (js.isStr(params)) {
				return params;
			} else {
				var query = [];
				var obj = js.empty;
				for(var x in params){
					if(typeof obj[x] == "undefined" && js.isFP(params[x]) == false) {
						var str = params[x];
						if(js.isArr(str)) {
							for(var i=0;i<str.length;i++) {
								query.push(x + "=" + escape(str[i]).replace(/\+/g,"%2B"));
							}
						} else query.push(x + "=" + escape(str).replace(/\+/g,"%2B"));
					}
				}
				return query.join("&");
			}
		} else {
			return null;
		}
	},

	Request : function(url, params, async, ctx, cf, ef, method) {

		var reqNo = -1;
		var req = ajax.pool.get();
		if (req) {
			//if(env.debug) reqNo = ajax.log.Register(params);

			if (async !== false) async = true;
			var rbody = this.parseParams(params);
			if (method == "GET") {
				url = url + "?" + rbody;
				rbody = null;
			} else if (method == "POST" && rbody == null) {
				//Bug fix for Mozilla 3+ browsers for 411 - Length required error
				rbody = "dummy=1";
			}
			req.open(method, url, async);
			req.onreadystatechange = processResponse; //IE bug for reusing XmlHttp Object, needs this only after open()

			if (method == "POST") {
				req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			}

			req.send(rbody);

			if (env.moz && !async) {
				processResponse();
			}
			return req;
		}
		return null;

		function processResponse() {
			if (req.readyState == 4) {
				try{req.status}
				catch(ex){
					if (js.isFP(ef)) { ef.call(ctx?ctx:req,-3,req.responseText,params); }
					return;
				}
				switch (req.status) {
					//case 0:
					case 200:
					case 304:
					if (js.isFP(cf)) { cf.call(ctx?ctx:req,req); }
					break;
					default:
					if (js.isFP(ef)) { ef.call(ctx?ctx:req,req.status,req.responseText,params); }
					break;
				}
				ajax.pool.put(req);
				//if(env.debug) ajax.log.update(reqNo, "response", req.responseText);
			}
		}
	}
};
var jsui = {
	makeIframe:function(noadd){
		if(env.ie){
			var html="<iframe src='javascript:\"\"'"
			+ " style='position:absolute;left:0px;top:0px;"
			+ "z-index:-1;filter:Alpha(Opacity=\"0\");'>";
			iframe = doc.createElement(html);
		}else{
			iframe = /*js.dom.create*/F_CR("iframe",{},{opacity:0,position:"absolute",left:0,top:0});
			iframe.src = 'javascript:""';
		}
		iframe.tabIndex = -1; // Magic to prevent iframe from getting focus on tab keypress.
		if(!noadd) js.dom.add(iframe);
		return iframe;
	},
	bg:{
		ieifrfix:function(ifr,clr){
			var bg = ifr?ifr:jsui.bg.el;
			try {
				var oDoc = bg.contentWindow || bg.contentDocument;
				if (oDoc.document) { oDoc = oDoc.document; }
				oDoc.body.style.backgroundColor = clr?clr:"#000";
			}catch(ex){	jsui.setOpacity(bg,0.60); }
		},
		init:function(){
			var bg;
			if (env.ie) {
				bg = jsui.bg.el = jsui.makeIframe();
				bg.style.zIndex = 1000;
				js.setTimeout(w,jsui.bg.ieifrfix,100); //need to do this on a timeout for IE to take the fix
			} else {
				bg = jsui.bg.el = js.dom.add(/*js.dom.create*/F_CR("DIV",{},{position:"absolute",backgroundColor:"#000",zIndex:1000}));
			}
			bg.style.left = bg.style.top = "0px";
			jsui.setOpacity(bg,0.30);
		},
		greyOut:function(){
			var t/*this*/ = jsui;
			if(!t.bg.el) t.bg.init();
			t.size(t.bg.el, js.body());
			t.show(t.bg.el, "block");
		},
		ungreyOut:function(){
			var t/*this*/ = jsui;
			t.hide(t.bg.el);
		}
	},
	setOpacity:function(n,o){
		if(env.ie) {
			var o = "Alpha(Opacity="+ o * 100 +")";
			n.style.filter = o;
		} else {n.style.opacity=o;}
	},
	/* Get current style of node n
	*/
	getStyle:function(/*DomNode*/n){
		var f, dv = doc.defaultView;
		if(env.safari){
			f = function(/*DomNode*/n){
				var s = dv.getComputedStyle(n, null);
				if(!s && n.style){
					n.style.display = "";
					s = dv.getComputedStyle(n, null);
				}
				return s || {};
			};
		}else if(env.ie){
			f = function(n){
				return n.currentStyle;
			};
		}else{
			f = function(n){
				return dv.getComputedStyle(n, null);
			};
		}
		return (jsui.getStyle = f)(n);
	},
	/*show n as a Layer - records n as currently open layer and shows it*/
	showL:function(n,dval){
		jsui.hide(jsui.curlyr);
		jsui.curlyr = n;
		if (!jsui.b) {jsui.b=true;jsevt.setHandlers([[js.body(),'click',site.bodyclick],[js.body(),'keyup',site.keyup]]);}
		return jsui.show(n,dval?dval:"block");
	},
	/*hide n and sets current layer to null*/
	hideL:function(n) {
		if(n==jsui.curlyr) jsui.curlyr = null;
		if (n) n.style.display="none";
		return n;
	},
	hideCurLyr:function() {
		if(jsui.curlyr) jsui.curlyr.style.display="none";
		jsui.curlyr = null;
	},
	show:function(n,dval){
		if(js.isStr(n)) n = doc.byId(n);
		if(n) n.style.display = dval;
		return n;
	},
	/* shows all object in array arr. Destroys arr.*/
	showAll:function(arr,dval){
		var n;
		while(n=arr.pop()) jsui.show(n,dval);
	},
	hide:function(n){
		if(n) n.style.display = "none";
		return n;
	},
	styleByAttr:function(p,attr,val,sprop,sval) {
		var chs=p[CHN];
		for (var i=0;i<chs.length;i++) {
			if (chs[i].nodeType==1 && chs[i].getAttribute(attr) == val) chs[i].style[sprop]=sval;
		}
	},
	/* shows a node at an anchor node. Has options to choose which corners are matched and what is the offset after matching corners*/
	showAt:function(n/*node to show*/,a/*anchor node*/,pos/*anchorTo [node corner, mesg corner]*/,offset/*[x,y]*/){
		var c = js.pos.toCoords(a),x,y,p=js.pick(pos,["lb","lt"]),o=js.pick(offset,[0,0]),cxn/*correction*/=js.pos.origin(n);
		if(n[PN]==a) { c.x=c.y=0; } else {c.x-=cxn.x; c.y-= cxn.y;}
		c.x+=o[0];c.y+=o[1];
		n.style.display="block";
		switch(p[0]) {//popup anchor
			case "lt": x=c.x;y=c.y;break;
			case "rb": x=c.x+c.w;y=c.y+c.h;break;
			case "rt": x=c.x+c.w;y=c.y;break;
			case "lb": default: x=c.x;y=c.y+c.h;break;
		}
		switch(p[1]) {//node anchor
			case "rb": x-=n[OW];y-=n[OH];break;
			case "rt": x-=n[OW];break;
			case "lb": y-=n[OH];break;
			case "lt": default: break;
		}
		return jsui.showAtPt(n,{x:x,y:y});
	},
	showAtPt:function(n,pt){
		//TODO viewport compensation
		n.style.left=pt.x+"px";
		n.style.top=pt.y+"px";
		n.pt = pt;
		return n;
	},
	center:function(node){
		var ws = js.win.size(), scr=js.win.scroll(), s=node.style;
		s.left = 340+ "px";
        s.top = 100+ "px";
		return node;
	},
	grow:function(n,by) {
		n.style.height = n[OH]+by+"px";
		n.style.width = n[OW]+by+"px";
	},
	incBy:function(n,by){
		n.style.height = n[OH]+by.t+"px";
		n.style.width = n[OW]+by.l+"px";
	},
	offset:function(n,by) {
		var ctop = parseInt(n.style.top), cleft = parseInt(n.style.left);
		n.style.top = (isNaN(ctop)?0:ctop) + by.t + "px";
		n.style.left = (isNaN(cleft)?0:cleft) + by.l + "px";
	},
	/*size a node acc to another node or coords. You can choose which dimension to size, width or height*/
	size:function(node /* node to size */, c /*node or coords*/, wd/*whichdim*/){
		var dims = js.dom.isNode(c)?js.pos.toCoords(c):c;
		var s = node.style;
		if (!wd || wd.w) s.width = dims.w + "px";
		if (!wd || wd.h) s.height = dims.h + "px";
		return node;
	},
	/**creates a shadow like div/iframe as a child of n to grey it out.
	The shadow can be used as a "shadow" or to grey out the node, as in clusters.
	To use as shadow, set zindex. Node n must already be absolutely or relatively positioned.*/
	greyThis:function(n/*node*/,clr,o) {
		if (!n.bg) {
			if (env.ie) {
				n.bg = jsui.makeIframe(true);
				js.setTimeout(w,jsui.bg.ieifrfix,100,n.bg,clr);
			} else {
				n.bg = /*js.dom.create*/F_CR("DIV",{},{position:"absolute",backgroundColor:clr?clr:"#000",zIndex:1000});
			}
			jsui.setOpacity(n.bg,o?o:0.15);
			/*js.dom.append*/F_APP(n.bg, n);
		}
		jsui.size(n.bg, n);
		var s = n.bg.style; s.left = "-2px"; s.top = "-2px";
		jsui.show(n.bg,"block");
	},
	ungreyThis:function(n/*node*/){
		if(n.bg) {
			jsui.hide(n.bg);
		}
	},
	/** Use the greyThis function to create a dropShadow for any node n. N must already be absolutely or relatively positioned.
	*/
	dropShadow:function(n/*node*/,off/*shadow offset-default=3,3*/,clr/*color-default=000*/,o/*opacity-default=0.15*/) {
		jsui.greyThis(n,clr,o);
		n.bg.style.zIndex="-1";
		if(env.ie && (!(!off) && !off.skipIE)) jsui.incBy(n.bg,off?off:{l:5,t:5});
		else jsui.offset(n.bg,off?off:{l:3,t:3});
	}
};


var on_load = {
	onRcvData:function(data){
		//on receiving data
		//alert("Success Retrieving Data" + data);
		doc.byId('fp_layers_data').innerHTML = data;
	}
}

var site = {
	bodyclick:function(evt){
		if(jsui.curlyr) {
			var src = evt.target?evt.target:evt.srcElement;
			while (src != null && src != js.body()) {
				if (src == jsui.curlyr || src == jsui.bg.el) return;
				src = src[PN];
			}
			jsui.curlyr.style.display="none";
		}
	},
	keyup:function(evt){
		if(evt.keyCode==env.keys.ESCAPE) {
			jsui.hideCurLyr();
			pg.closeModalLayer();
		}
	},
	//Fix hiding rescom in IE
	fixrc: function(){
		//try {doc.all.rescom.style.display='none';doc.all.rescom.style.display='block';}catch(ex){}
		try {doc.all.rcfix.style.display='block';doc.all.rcfix.style.display='none';}catch(ex){}
	},
	fixLoadImg:function(){
		if(!w.domLoaded) {
			if(!site._1) site._1=1; else site._1 = 0;
			try{doc.all.pgldimg.style.bottom=site._1+"px";}catch(ex){}
			window.setTimeout("site.fixLoadImg()",100);
		}
	},
	iehvrfix:function(){
		switch(document.readyState) {
			case "loaded":
			case "complete":
			site.hvrloop(js.body());
			break;
			default:window.setTimeout("site.iehvrfix()",100);
		}
	},
	hvrloop:function(n){
		for(var i=0;i<n[CHN].length;i++){
			var node = n[CHN][i];
			if (node.nodeType == 1) {
				hf = node.getAttribute("iehf");
				if (hf) {
					node._hf = hf;
					node.onmouseover = site.hover;
					node.onmouseout = site.hout;
				}
				site.hvrloop(node);
			}
		}
	},
	/*hoverMouseOver*/hover: function() {
		this.className += (" "+this._hf+"hover");
	},
	/*hoverMouseOut*/hout: function() {
		this.className = this.className.replace(" "+this._hf+"hover", "");
	}
};
if(env.ieVer==7.0) window.setInterval("site.fixrc()",100);
if(env.ieVer<7.0) window.setTimeout("site.fixLoadImg()",100);

var cluster = {
	ids: ['cl_fur','cl_bud','cl_area','cl_type','cl_from','cl_loc','cl_prop_type','cl_r_c'],
	objs: null,
	getAll:function(){
		var t = cluster, s="state", o="orig"+s, tmp, _s = "onStateChanged";
		if(t.objs == null) {
			t.objs=new Array();
			for(var i=0;i<t.ids.length;i++) {
				var c = doc[ELBI](t.ids[i]);
				if (c) {
					t.objs.push(c);
					if (tmp = c.getAttribute(s)) c[o] = c[s] = cstates[tmp];
					else c[o] = c[s] = cstates[1];
				}
			}
			if(tmp = doc.byId('cl_loc')) tmp[_s]=t.onLocStateChanged;
			if(tmp = doc.byId('cl_bud')) tmp[_s]=t.onBudStateChanged;
			if(tmp = doc.byId('cl_prop_type')) tmp[_s]=t.onPropTypeStateChanged;
		}
		return t.objs;
	},
	find:function(which) {
		var cs = this.getAll();
		for (var i=0;i<cs.length;i++) {
			if (cs[i] == which || cs[i].id == which) return cs[i];
		}
		return null;
	},
	close:function(c) {
		jsui.greyThis(c,'#777');
		var l = c.bg;
		l.style.zIndex="10";
		c[CN]="cl_closed "+c[CN];
	},
	open:function(c) {
		jsui.ungreyThis(c);
		c[CN]=c[CN].replace(/cl_closed/g,"");
	},
	enableAll:function(c/*except*/) {/*enable all other clusters*/
		var t = cluster, cs = t.getAll();
		for (var i=0;i<cs.length;i++) {
			if (cs[i] != c) {cs[i].state.moveTo(cs[i].origstate.sid, cs[i]);}
		}
	},
	disableAll:function(c/*except*/) {/*disable all other clusters*/
		var t = cluster, cs = t.getAll();
		for (var i=0;i<cs.length;i++) {
			if (cs[i] != c) {cs[i].state.moveTo(4, cs[i]);}
		}
	},
	setElem:function(el,sid,shown) {
		if (!el) return;
		try{
			if (sid == 3 && shown) { el[D]/*disabled*/ = el[C]/*checked*/ = true; }
			else if(sid == 3) { el[D]/*disabled*/ = true; }
			else if (sid == 1) { el[D]/*disabled*/ = el[C]/*checked*/ = false; }
			else if (sid == 5) { el[D]/*disabled*/ = false;}
		}catch(ex){}
	},
	changeView:function(c,sid) {
		var chs = c[CHN];
		for (var i=0;i<chs.length;i++) {
			var ch = chs[i];
			if (ch.nodeType == 1) {
				if (ch.getAttribute("showin")) {
					if (ch.getAttribute("showin").indexOf(sid+"") >= 0) {
						if (ch[CN] == 'hid') ch[CN] = "";
						else ch[CN] = ch[CN].replace(' hid','');
						if (ch.tagName == "LABEL") { cluster.setElem(doc[ELBI](ch['htmlFor']),sid,true); }
					} else if (ch[CN].indexOf(' hid') < 0 && ch[CN] != 'hid') ch[CN] += ' hid';
				} else {
					var chk = (ch.tagName=="INPUT"&&(ch.type=="text"||ch.type == CHK))||ch.tagName=="SELECT"?ch:null;
					if (chk) cluster.setElem(chk,sid,false);
					else cluster.changeView(ch, sid);
				}
			}
		}
	},
	showMoreBud:function(evt) {
		var t = cluster;
		var lc = doc.byId('cl_bud');
		if (!lc.more) {
			lc.more = /*js.dom.append*/F_APP(/*js.dom.create*/F_CR("DIV",{className:"morebud"},{position:"absolute",width:"460px",zIndex:10}),lc);
			lc.mb = /*js.dom.append*/F_APP(/*js.dom.create*/F_CR("DIV",{},{background:"#fff",zIndex:10}),lc.more);
			lc.mb[IH] = "<IMG class='floatr mlx' onclick='return cluster.closeMoreBud(event)' src='/images/icons/close.gif'/><div class='ttl'><div class='f12 b orng1'>More Budget Ranges</div></div>";
			lc.mdiv = /*js.dom.append*/F_APP(/*js.dom.create*/F_CR("DIV",{},{margin:"2px"}),lc.mb);
			for (var i=0;i<morebud.length-1;i++) {
				var l = morebud[i];
				var lbl = /*js.dom.append*/F_APP(/*js.dom.create*/F_CR("DIV",{className:"buditem"}),lc.mdiv);
				var ih = "<A href='search?sid="+doc.byId('cl_sid').value+"&budget="+l[0]+"'>"+l[1]+"</a> <span class='f10 grey1'>(" + l[2] + ")</span>";
				lbl[IH] = ih;
			}
		}
		/*js.dom.append*/F_APP(/*js.dom.create*/F_CR("DIV",{},{clear:"both"}),lc.mb);
		jsui.showAt(lc.more,lc,["lb","lt"],[-4,4]);
		jsui.showL(lc.more);
		jsui.dropShadow(lc.more,{l:-3,t:0});
		jsui.grow(lc.more.bg,env.ie?7:5);
		if (evt) return jsevt.stopEvt(evt);
	},
	closeMoreBud:function(evt){
		var lc = doc.byId('cl_bud');
		if (lc.more) jsui.hideL(lc.more);
		if (evt) return jsevt.stopEvt(evt);
	},
	onBudStateChanged:function(){
		switch(this.state.sid) {
			case 5: cluster.showMoreBud(); break;
			case 4: case 3: cluster.closeMoreBud(); break;
		}
	}
};
function ClusterState(sid, vs/*valid transition states*/, mfp /*call these funcs on move*/) {
	this.vs = vs;
	this.sid = sid;
	this.mfp = mfp;
	this.moveTo = function(ns/*newstate*/,cl) {
		if (Array.contains(this.vs, ns)) {
			cl.state = cstates[ns];
			cluster.changeView(cl, cl.state.sid);
			var fp = cl.state.mfp;
			if (fp) {
				if (js.isFP(fp)) fp.call(cl,cl);
				else {
					for (var k=0;k<fp.length;k++) {
						fp[k].call(cl,cl);
					}
				}
			}
			try{cl.onStateChanged.call(cl)}catch(ex){}
			return true;
		}
		return false;
	}
	return this;
}

var cstates = [
{},
new ClusterState(1,[2,4],cluster.open),
new ClusterState(2,[1,4]),
new ClusterState(3,[4,5],cluster.open),
new ClusterState(4,[1,3],cluster.close),
new ClusterState(5,[3,4])
];

//default useractionparams params in case if l1 header not present.
var userActionParams = {
	lstAcn: '',
	lstAcnId:''
};


var layers = {
	sizeShadow:function(n){
		if (!n) n = this;
		jsui.size(n.bg, n);
		if (env.ie) jsui.incBy(n.bg,{l:5,t:5});
	},
	fixShadows:function(){
		if (jsui.curlyr) {try{layers.sizeShadow(jsui.curlyr);}catch(ex){}}
		if (pg.curMLyr) {try{layers.sizeShadow(pg.curMLyr);}catch(ex){}};
	}
};
/** End Site JS**/


var pg = {
	valRegFrm:function(evt,frm) {
		return pg.validate(evt,frm);
	},
	/*Validates a form with inline error display*/
	validate:function(evt,frm,keepLayerOpen) {
		if (!jsval.vf(frm)) {
			jsval.inlineErrs(frm,pg.esdiv);
			return jsevt.stopEvt(evt);
		}
		if(frm.target && !keepLayerOpen) {
			jsui.hideCurLyr();
			pg.closeModalLayer();
		}
		return true;
	},
      openModalLayer:function(p/*props*/) {
            var l = pg["l-"+p.id];
            if (!l) {
                  l = pg["l-"+p.id] = js.dom.add(/*js.dom.create*/F_CR("DIV",{className:"srpmodal"},{position:"absolute",zIndex:1100 }));
                  l[IH] = "<div class='ttl'>"+p.ttl+"</div>" + "<div class='body' style='z-index:10;zoom:1;'></div>";
                  jsui.dropShadow(l,{t:5,l:5,skipIE:1},0,0.3);
                  if (p.html) l[CHN][1][IH] = p.html;
            }
            var size = p.size?p.size:{};
            if(!size.h) size.h="250";
            else if(size.h!="auto")size.h+="px";
            if(!size.w) size.w="400";
            else if(size.w!="auto")size.w+="px";
            l.style.width = size.w;
            l[CHN][1].style.height = size.h;
            l.size = p.size;
            l.cbk = p.cbk;
            jsui.hideCurLyr();
            pg.closeModalLayer();
            jsui.center(jsui.show(l,"block"));
            jsui.bg.greyOut();
            pg.curMLyr = l;

            if (!l.gotData || p.reload) {
                  l[CHN][1][IH] = p.html?p.html:LOADING_HTML;
                  if(p.dataUrl) ajax.getText({url:p.dataUrl,ctx:l,params:(p.params?p.params:userActionParams)},pg.onRcv,pg.onRcvErr);
            } else {
                  if (p.size && p.size.h1) l[CHN][1].style.height = p.size.h1;
            }

            // action function : function to be called when from the current ajax call data another ajax call is done and it is successful
            l.action = p.action;

            jsui.size(l.bg, l);
            return l;
      },
	onRcv:function(txt){
		var l = this;
		l.gotData = true;

		if(l.actionOnSuccess != undefined)
		{
			var actionName = l.actionOnSuccess;
			var functionName = actionName+'("'+escape(txt)+'")';

			eval(functionName);
			l.actionOnSuccess = null;
		}
		else if(l.actionOnSuccess == undefined)
		{
			l[CHN][1][IH] = txt;
			if (l.size && l.size.h1) l[CHN][1].style.height = l.size.h1;
			jsui.size(l.bg, l);
		}

		try{if(l.cbk/*callback*/) l.cbk.call(l);}catch(ex){}
	},
	onRcvErr:function(code,txt){

		if(txt)
		this[CHN][1][IH] = txt;
		else
		this[CHN][1][IH] = 'Error Occured. Try Again.';
	},
	closeModalLayer:function(){
		js.body().onkeyup=null;
		if (pg.curMLyr) {
			jsui.bg.ungreyOut();
			jsui.hide(pg.curMLyr);
		}
	},

	opensnapdealhomepageLayer:function(evt){
		var lyr = pg.openModalLayer({id:'newp',ttl:"",size:{w:400,h:500,h1:"auto"},dataUrl:'http://www.moneysaverprime.com/showlayer'});//http://localhost/htm_layer.php
		//return jsevt.stopEvt(evt);
	}
};






function _toggle(arr) {
	var el = doc.byId(arr[0]);
	el[D]/*disabled*/ = true; jsval.hideFld(el);
	el = doc.byId(arr[1]);
	el[D]/*disabled*/ = false; jsval.showFld(el,'inline');
}

var ct={
	onFocusEvent:function(divobj){
		if( ( (divobj.name == 'area_min') && (divobj.value == 'Min') ) || ( (divobj.name == 'area_max') && (divobj.value == 'Max') ) )
		divobj.value = '';
	},
	onBlurEvent:function(divobj){
		if( (divobj.name == 'area_min') && (divobj.value == '') )
		divobj.value = 'Min';
		else if( (divobj.name == 'area_max') && (divobj.value == '') )
		divobj.value = 'Max';
	}
};

/* Old code that needs to be carried - should be phased out soon*/
function open_new_window(path){w.open(path,'','width=770,height=570,scrollbars=yes,resizable=1');return false;}

/*From shoshkele_func.js - which is being retired*/
function findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&top.frames.length) {
		d=top.frames[n.substring(p+1)].document; n=n.substring(0,p);}
		if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
		for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
		if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function showHideLayers() { //v6.0
	var i,p,v,obj,args=showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	obj.visibility=v; }
}
function resizeHeight(the_iframe)
{
	var t = document.getElementById(the_iframe);
	if(t.contentWindow.document.body.innerHTML!="")
	t.height=t.contentWindow.document.body.scrollHeight;
}

function resizeHeight_Banner(the_iframe)
{
	var t = document.getElementById(the_iframe);
	if(t.contentWindow.document.body.innerHTML!="" && t.contentWindow.document.body.scrollHeight >= 50) {
		t.height=t.contentWindow.document.body.scrollHeight;
	}
}

function showpopup()
{
	pg.opensnapdealhomepageLayer(window.onload);
}
function chkemail()
{
	var reg =/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
	var e_address = document.getElementById("email").value;
	if(e_address.match(reg)==null)
	{
		document.getElementById("emailerr").innerHTML = "Please enter valid email";
		document.getElementById("emailerr").style.color='#ff0000';
		document.getElementById("vcardno").value = 'No';
		return false;
	}
	else
	{
		document.getElementById("vcardno").value = 'Yes';
		return true;
	}	
}
function chkadd()
{
	var reg =/[a-z]{1,10}/;
	var address = document.getElementById("address").value;
	if(address.match(reg)==null)
	{
		document.getElementById("adderr").innerHTML = "Please enter valid address";
		document.getElementById("adderr").style.color='#ff0000';
		document.getElementById("vcardno").value='No';
		return false;
	}
	else
	{
		document.getElementById("vcardno").value = 'Yes';
		return true;
	}
}
function chkpass()
{
	var reg =/[a-z0-9]{6,15}/;
	var pass = document.getElementById("password").value;
	if(pass.match(reg)==null)
	{
		document.getElementById("passerr").innerHTML = "Please enter valid password, should contain 6-15 character.";
		document.getElementById("passerr").style.color='#ff0000';
		document.getElementById("vcardno").value='No';
		return false;
	}
	else
	{
		document.getElementById("vcardno").value = 'Yes';
		return true;
	}
}

function chkpasscode()
{
	var pass = document.getElementById("password").value;
	var cpass = document.getElementById("cpassword").value;
	if(pass != cpass)
	{
		document.getElementById("cpasserr").innerHTML = "New password and Confirm password do not match.";
		document.getElementById("cpasserr").style.color='#ff0000';
		document.getElementById("vcardno").value='No';
		return false;
	}
	else
	{
		document.getElementById("vcardno").value = 'Yes';
		return true;
	}
}

function chkdata()
{
	var cardreg =/^(5100011|5126011|5125011|5100000)[0-9]{9}$/;
	var emailreg=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
	var mobile=/([0-9]{10})/;
	var cardno = document.getElementById("username").value;
	var str=document.getElementById("vcardno").value;
	if(cardno.match(cardreg)==null)
	{
		document.getElementById("errmsg").innerHTML = "Card no should be numeric.";
		document.getElementById("username").value="";
		document.getElementById("username").focus();
		return false;
	}
	else
	{
		if(str == 'No')
		{
			return false;
		}
		else
		{
			return true;
		}
	}
	
}



function reseterr(str)
{
	document.getElementById(str).innerHTML = "";
}
 
function chkcardno()
{
	var username = document.getElementById("username").value;
	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else
	{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	xmlhttp.onreadystatechange=function()
	{
		//document.getElementById("errmsg").innerHTML = "<img src='img/home/ajax-loader.gif'>";
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			var msg = xmlhttp.responseText;
			if(msg !='')
			{
				document.getElementById("errmsg").innerHTML = msg;
				
				if(msg=="Invalid Card Number.")
				{
					document.getElementById("vcardno").value = 'No';
					document.getElementById("errmsg").style.color='#ff0000';
				}
				else
				{
					document.getElementById("vcardno").value = 'Yes';
					document.getElementById("errmsg").style.color='#009900';
				}
			}
		}
		else
		{
			document.getElementById("errmsg").innerHTML = "<img src='http://www.moneysaverprime.com/img/home/ajax-loader.gif'>";
		}
		
	}
	xmlhttp.open("GET","http://www.moneysaverprime.com/checkcardno.php?username="+username,true);
	xmlhttp.send();	
}

function chkmobile()
{
	var phone_no = document.getElementById("phone_no").value;
	var username = document.getElementById("username").value;
	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else
	{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	xmlhttp.onreadystatechange=function()
	{
		//document.getElementById("errmsg").innerHTML = "<img src='img/home/ajax-loader.gif'>";
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			var phonemsg = xmlhttp.responseText;
			if(phonemsg !='')
			{
				document.getElementById("phoneerr").innerHTML = phonemsg;
				if(phonemsg=="Invalid Phone Number.")
				{
					document.getElementById("vcardno").value = 'No';
					document.getElementById("phoneerr").style.color='#ff0000';
				}
				else
				{
					document.getElementById("vcardno").value = 'Yes';
					document.getElementById("phoneerr").style.color='#009900';
				}
			}
		}
		else
		{
			document.getElementById("phoneerr").innerHTML = "<img src='http://www.moneysaverprime.com/img/home/ajax-loader.gif'>";
		}
		
	}
	xmlhttp.open("GET","http://www.moneysaverprime.com/checkphone.php?phone="+phone_no+"&username="+username,true);
	xmlhttp.send();	
}

function chkcode()
{
	var username = document.getElementById("username").value;
	var code = document.getElementById("smscode").value;
	
	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else
	{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	xmlhttp.onreadystatechange=function()
	{
		//document.getElementById("errmsg").innerHTML = "<img src='img/home/ajax-loader.gif'>";
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			var codemsg = xmlhttp.responseText;
			if(codemsg !='')
			{
				document.getElementById("codeerr").innerHTML = codemsg;
				if(codemsg=="Incorrect Verification Password")
				{
				
					document.getElementById("vcardno").value = 'No';
					document.getElementById("codeerr").style.color='#ff0000';
				}
				else if(codemsg=="Invalid Password")
				{
					document.getElementById("vcardno").value = 'No';
					document.getElementById("codeerr").style.color='#ff0000';
				}
				else
				{
					document.getElementById("vcardno").value = 'Yes';
					document.getElementById("codeerr").style.color='#009900';
				}
			}
		}
		else
		{
			document.getElementById("codeerr").innerHTML = "<img src='http://www.moneysaverprime.com/img/home/ajax-loader.gif'>";
		}
		
	}
	xmlhttp.open("GET","http://www.moneysaverprime.com/checkcode.php?username="+username+"&code="+code,true);
	xmlhttp.send();	
}


function validate_subscription(){
		  var reg =/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
          var e_address = document.getElementById("HomeEmail").value;

	   if(e_address.match(reg)==null){
		   alert("Please enter valid email");
   		   document.getElementById("HomeEmail").value="";
    	   document.getElementById("HomeEmail").focus();
		   return false;
		   }

	   return true;
 }

function validatelogin(){
		  var reg =/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
		  var pass=document.getElementById("UserPassword").value;
       	   if(document.getElementById("UserUsername").value==""){
		   alert("Please enter username");
		   document.getElementById("UserUsername").focus();
		   return false;
		   }
		   if(pass ==""){
		   alert("Please enter your Password");
		   document.getElementById("UserPassword").focus();
		   return false;
		   }
		   
		   if(pass.length >10){
		   alert("Password  lenght exceeding");
		   document.getElementById("UserPassword").value="";
		   document.getElementById("UserPassword").focus();
		   return false;
		   }
   }







