try {
var lt = ''; var ssclosed = false;
var ipm = {skroll:new Fx.ScrollWindow({duration: 1000, wait: false, transition: Fx.Transitions.sineInOut})};

ipm.site = {
	
	bookmark: function(title,url) {
		
		if (window.sidebar) { // Mozilla Firefox Bookmark
			window.sidebar.addPanel(title, url,"");
		} else if( window.external ) { // IE Favorite
			window.external.AddFavorite( url, title); 
		} else if(window.opera && window.print) { // Opera Hotlist
			alert('Press Ctrl + D to bookmark this page');
		} else { // Other
			alert('Press Ctrl + D to bookmark this page');
		}
	},
	
	compat: function() {
		if(window.ie6) {
			new Element('div',{'width':'1024','height':'25'}).setStyles({'width':'1024px','height':'25px','background-color':'#FF3333','color':'#ffffff','padding':'10px','display':'block','position':'absolute','float':'left','top':'0px','font-size':'10px'}).setOpacity(0.7).setHTML('Hi, we noticed you are using Internet Explorer 6 or below. Our site requires a few features that are not supported 100% by Internet Explorer 6.<br /><a href="http://www.microsoft.com/Downloads/details.aspx?familyid=9AE91EBE-3385-447C-8A30-081805B2F90B&displaylang=en">Upgrade today to Internet Explorer 7</a> to enjoy all the features of PropertyExtra.com.au').injectTop($('ipm_wrapper'));
		}
	}
	
};

if(window.ie6) window.addEvent('domready',ipm.site.compat);

ipm.ajax = {
	
	onRequest: function(fieldID) {
		if($(fieldID)) $(fieldID).addClass('ipm_loader');
		$('docBody').setStyle('cursor','wait');
	},
	
	onComplete: function(fieldID) {
		if($(fieldID)) $(fieldID).removeClass('ipm_loader');
		$('docBody').setStyle('cursor','default');
	},
	
	addOption: function(selectId, txt, val, defSel){
		// if Safari/Konqueror
		if(window.webkit) {	
			var element = $(selectId);
			var newone = new Option(txt,val,defSel);
			element.add(newone,element.options[element.options.length]);
		// if Internet Explorer (any)
		} else if(window.ie) {
			var objOption = new Option(txt, val, defSel, defSel);
			$(selectId).options.add(objOption);
		// if Mozilla/Gecko/Opera
		} else {
			var objOption = new Option(txt, val, defSel);
			$(selectId).options.add(objOption);
		}
	},
	
	clearOptionList: function(selectId){
		if($(selectId)) $(selectId).empty();
	}
	
};

ipm.site.header = {
	
	init: function(v) {
		var gKey = 'ABQIAAAAHL_fPK6cui_rpxVXcAi4ZhTuzdeO2Ju1pAmL5eZ4-8yYQpSMbxTfHzY_u15Cc3yB4eMYxkAUQfnr0A';
	},
	
	show_feature: function() {
		
		if($('ipm_show_feature')&&$('ipm_feature_scroll_ajax')) {
			var sstate = false;
			var ssajax = null;
			var origHeight = $('ipm_feature_scroll').getStyle('height');
			$('ipm_show_feature').addEvent('click',function() {
				if(!sstate) {
					ssclosed = false;
					$('ipm_show_feature').setHTML('hide feature listings');
					ssajax = new Ajax('/?xhr', { method: 'post', update: $('ipm_feature_scroll_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'homepage','xhr':'feature.listings','sid':ipm_session_id}), onRequest: function() { $('ipm_feature_scroll').addClass('ajaxloader'); if($$('.yoo-tooltip')) { $$('.yoo-tooltip').each(function(el) { el.remove(); }); } }, onComplete: function() { $('ipm_feature_scroll_ajax').removeClass('hide'); $('ipm_feature_scroll').removeClass('ajaxloader'); $('ipm_feature_scroll').setStyle('height','270px');  if($('leftmenubar')) { offSet = '425'; ipm.site.results.pageFX(); }  new Fx.Style('ipm_feature_scroll_ajax', 'opacity').start(0,1); }}).request();
					sstate = true;
				} else {
					if(ssajax) {
						ssajax.cancel(); if($('leftmenubar')) { offSet = '181'; ipm.site.results.pageFX(); }
						$('ipm_feature_scroll_ajax').empty().addClass('hide'); ssclosed = true;
						sstate = false; $('ipm_feature_scroll').setStyle('height',origHeight)
						$('ipm_show_feature').setHTML('show feature listings');
					}
				}
			});
		}
		
	},
	
	searchLoader: function(state) {
		if(state) { $('ipm_search_string').addClass('autocompleter-loader'); } else { $('ipm_search_string').removeClass('autocompleter-loader'); }
	},
	
	search: function() {	
		var code = null;
		new Autocompleter.Ajax.Xhtml($('ipm_search_string'), '/?xhr', {
			postData: {'tpl':'header','xhr':'quick.search','sid':ipm_session_id}, postVar: 'q',
			onSelect: function(e,i) {
				code = e.getProperty('value'); e.setProperty('value','')
				if(code) window.location.href='/lookup/' + code + '/';
			},
			parseChoices: function(el,i) {
				var value = el.getText();
				code = (el.getElement('input[type=hidden]') ? el.getElement('input[type=hidden]').getProperty('value') : '');
				el.inputValue = code;
				this.addChoiceEvents(el);
			},
			onRequest: function() {
				ipm.site.header.searchLoader(true);
			},
			onComplete: function() {
				ipm.site.header.searchLoader(false);
			}
		});
	},
	
	menu: function() {
		
		$$('#ipm_menu ul li').each(function(el) {el.addEvent('mouseover',function() { el.addClass('over'); }).addEvent('mouseout',function() { el.removeClass('over'); }).addEvent('click',function() { $$('#ipm_menu ul li').removeClass('on'); el.addClass('on'); el.fireEvent('mouseout'); window.location.href = el.getElement('a').getProperty('href'); }); });
	},
	
	togglemenu: function(e) {
		if($('ipm_menu_' + e)) { $$('#ipm_menu ul li').removeClass('on'); $('ipm_menu_' + e).addClass('on'); };
	},
	
	change_lt_bc: function(e) {
		if($('ipm_breadcrumbs_lt')) {
			var s = {'sale':'Real Estate For Sale','rent':'Real Estate For Rent','auction':'Real Estate For Auction','business':'Business For Sale'}
			$('ipm_breadcrumbs_lt').setHTML(s[e]);
		}
	}
		
};

if(!_unload_header_search) window.addEvent('load',ipm.site.header.search);

ipm.site.homepage = {	

	init: function() {	
		var xhr;
		$('ipm_feature_scroll_ajax').setOpacity(0);
		ipm.site.header.menu();
		ipm.site.homepage.feature();
		if($('ipm_searchbar_ajax')) ipm.site.homepage.qsearch();
		ipm.site.homepage.latest();
		if($('ipm_faabtn')) { $('ipm_faabtn').addEvent('mouseover',function() { this.setProperty('src','/images/infobar/find_an_agent_over.jpg'); }).addEvent('mouseout',function() { this.setProperty('src','/images/infobar/find_an_agent.jpg'); }); }
		/*if(_ipm_welcome) {
			ipm.site.homepage.welcome();
		}*/
	},
	
	welcome: function() {
		try { Lightbox.show('/images/home/welcome_new.jpg',0); } catch(err) { }
	},
	
	feature: function(rID) {
		new Ajax('/?xhr', { method: 'post', update: $('ipm_feature_scroll_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'homepage','xhr':'feature.listings','sid':ipm_session_id,'regionID':rID}), onRequest: function() { $('ipm_feature_scroll').addClass('ajaxloader'); if($$('.yoo-tooltip')) { $$('.yoo-tooltip').each(function(el) { el.remove(); }); } }, onComplete: function() { $('ipm_feature_scroll').removeClass('ajaxloader'); new Fx.Style('ipm_feature_scroll_ajax', 'opacity').start(0,1); }}).request();
	},
	
	feature_pre: function(rID) {
		new Ajax('/?xhr', { method: 'post', update: $('ipm_preloader'), data: Object.toQueryString({'tpl':'homepage','xhr':'feature.listings','sid':ipm_session_id,'regionID':rID})}).request();
	},
	
	qsearch: function() {
		new Ajax('/?xhr', { method: 'post', evalResponse: true, data: Object.toQueryString({'select':'','xhr':'listingtype','fieldID':'ipm_ajax_listingtype','lt':lt,'sid':ipm_session_id})}).request();
		new Ajax('/?xhr', { method: 'post', update: $('ipm_searchbar_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'homepage','xhr':'search.sale','sid':ipm_session_id})}).request();
		lt = ($('ipm_ajax_listingtype').getProperty('value') ? $('ipm_ajax_listingtype').getProperty('value') : 'sale');
		$('ipm_ajax_listingtype').addEvent('change',function() {
				if(this.getProperty('value')) {
					if(lt!=this.getProperty('value')) {
						new Ajax('/?xhr', { method: 'post', update: $('ipm_searchbar_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'homepage','xhr':'search.' + $('ipm_ajax_listingtype').getProperty('value'),'sid':ipm_session_id})}).request();
					}
					lt = this.getProperty('value');
					$$('#ipm_searchbar_ajax select').each(function(el) { el.removeProperty('disabled'); });
				} else {
					if(lt!='sale') {
						new Ajax('/?xhr', { method: 'post', update: $('ipm_searchbar_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'homepage','xhr':'search.sale','sid':ipm_session_id})}).request();
					}
					lt = 'sale';
					$$('#ipm_searchbar_ajax select').each(function(el) { el.setProperty('disabled','disabled'); });
				}
				lt = (this.getProperty('value') ? this.getProperty('value') : 'sale');
		 });
	},
	
	latest: function(p,lt) {
		new Ajax('/?xhr', { method: 'post', update: $('ipm_latestbar_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'homepage','xhr':'latest.listings','sid':ipm_session_id,'page':p,'lt':lt}), onRequest: function() { $('ipm_latestbar').addClass('ajaxloader'); }, onComplete: function() { $('ipm_latestbar').removeClass('ajaxloader'); new Fx.Style('ipm_latestbar_ajax', 'opacity').start(0,1); }}).request();
	}
	
};

ipm.site.search = {	

	init: function(lt,data) {	
		
		ipm.site.header.menu();
		ipm.site.homepage.latest(1,lt);
		//ipm.site.search.fsearch(lt,data);
		//ipm.site.search.ssearch(lt);
		ipm.site.search.mapinit();
		if(!window.ie) ipm.site.header.show_feature();
		
		if($('ipm_faabtn')) { $('ipm_faabtn').addEvent('mouseover',function() { this.setProperty('src','/images/searchbar/find_an_agent_over.jpg'); }).addEvent('mouseout',function() { this.setProperty('src','/images/searchbar/find_an_agent.jpg'); }); }
		
		if($('ipm_suburb_finder')) { $('ipm_suburb_finder').focus(); };
		
	},
	
	mapinit: function(id) {
		if(!id) id = 'ipm_map_img';	
		if(!$(id)) return false;
		var maps = ['qld','nsw','wa','sa','nt','act','tas','vic'];
		maps.each(function(v) {
			$(id + '_' + v).addEvent('mouseover',function() { $(id).setProperty('src','/images/searchbar/map' + v + '.gif'); }).addEvent('mouseout',function() { $(id).setProperty('src','/images/searchbar/map.gif'); }).addEvent('click',function() { ipm.site.search.triggerState(v); });
		});
		$(id).addEvent('mouseout',function() { $(id).setProperty('src','/images/searchbar/map.gif'); });
	},
	
	triggerState: function(s) {
		if(!$('ipm_ajax_state')) return false;
		$('ipm_ajax_state').getChildren().each(function(el) { if(el.getProperty('value')==s) { el.selected = true; el.setProperty('selected','selected'); $('ipm_ajax_state').fireEvent('change'); }; });
	},
	
	fsearch: function(lt,data) {
		new Ajax('/?xhr', { method: 'post', evalResponse: true, data: Object.toQueryString({'select':'','xhr':'listingtype','fieldID':'ipm_ajax_listingtype','value':lt,'sid':ipm_session_id,'pso':(!lt ? 1 : 0)})}).request();
		lt = (lt ? lt : 'sale'); ipm.site.header.togglemenu(lt); ipm.site.header.change_lt_bc(lt);
		new Ajax('/?xhr', { method: 'post', update: $('ipm_searchbar_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'search','xhr':'search.'+lt,'sid':ipm_session_id,'data':data}), onRequest: function() { $('ipm_searchbar_ajax').addClass('ajaxloader'); }, onComplete: function() { $('ipm_searchbar_ajax').removeClass('ajaxloader'); }}).request();
		$('ipm_ajax_listingtype').addEvent('change',function() {
				if(this.getProperty('value')) {
					if(this.getProperty('value')=='business'&&$('suburb_start')) { $('suburb_start').addClass('hide'); } else { $('suburb_start').removeClass('hide'); }
					ipm.site.header.togglemenu(this.getProperty('value'));
					ipm.site.header.change_lt_bc(this.getProperty('value'));
					if(lt!=this.getProperty('value')) {
						new Ajax('/?xhr', { method: 'post', update: $('ipm_searchbar_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'search','xhr':'search.' + $('ipm_ajax_listingtype').getProperty('value'),'sid':ipm_session_id,'data':data})}).request();
					}
					lt = this.getProperty('value');
					$$('#ipm_searchbar_ajax select').each(function(el) { el.removeProperty('disabled'); });
				} else {
					if(lt!='sale') {
						new Ajax('/?xhr', { method: 'post', update: $('ipm_searchbar_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'search','xhr':'search.sale','sid':ipm_session_id,'data':data})}).request();
					}
					lt = 'sale';
					$$('#ipm_searchbar_ajax select').each(function(el) { el.setProperty('disabled','disabled'); });
				}
				lt = (this.getProperty('value') ? this.getProperty('value') : 'sale');
		 });
	},
	
	searchLoader: function(state,field) {
		if(state) { $((field ? field : 'ipm_suburb_search')).addClass('autocompleter-loader'); } else { $((field ? field : 'ipm_suburb_search')).removeClass('autocompleter-loader'); }
	},
	
	// quick search
	ssearch: function(lt) {	
		if(lt=='business') return false;
		var code = null;
		new Autocompleter.Ajax.Xhtml($('ipm_suburb_search'), '/?xhr', {
			postData: {'tpl':'search','xhr':'quick.search','sid':ipm_session_id,'lt':lt}, postVar: 'q',
			onSelect: function(e,i) {
				code = e.getProperty('value'); e.setProperty('value','')
				if(code) window.location.href='/lookup/' + code + '/';
			},
			parseChoices: function(el,i) {
				var value = el.getText();
				code = (el.getElement('input[type=hidden]') ? el.getElement('input[type=hidden]').getProperty('value') : '');
				el.inputValue = code;
				this.addChoiceEvents(el);
			},
			onRequest: function() {
				ipm.site.search.searchLoader(true,'ipm_suburb_search');
			},
			onComplete: function() {
				ipm.site.search.searchLoader(false,'ipm_suburb_search');
			}
		});
	},
	
	// suburb finder
	qsearch: function() {	
		var code = null;
		new Autocompleter.Ajax.Xhtml($('ipm_suburb_finder'), '/?xhr', {
			postData: {'tpl':'search','xhr':'suburb.finder','sid':ipm_session_id}, postVar: 'q',
			onSelect: function(e,i) {
				code = e.getProperty('value'); e.setProperty('value','')
				var result = code.split('-');
				ipmNewLi(result[0],result[1],true)
			},
			parseChoices: function(el,i) {
				var value = el.getText();
				code = (el.getElement('input[type=hidden]') ? el.getElement('input[type=hidden]').getProperty('value') : '');
				el.inputValue = code;
				this.addChoiceEvents(el);
			},
			onRequest: function() {
				ipm.site.search.searchLoader(true,'ipm_suburb_finder');
			},
			onComplete: function() {
				ipm.site.search.searchLoader(false,'ipm_suburb_finder');
			}
		});
	}
	
}

var overlay = null;
var leftmenubar = null;
var qenquiry = null;
var offSet = null;
var mhs = null;

ipm.site.results = {	

	init: function(lt,data,fx) {	
		
		ipm.site.header.menu();
		ipm.site.results.pagination(lt,data);
		if(!window.ie) ipm.site.header.show_feature();
		offSet = parseInt($('ipm_container_right').getTop());
		mhs = $('ipm_container_right').getSize();
		if($('leftmenubar')) $('leftmenubar').setStyles({'position':'absolute','top':'181px'});
		if(fx!='1') ipm.site.results.pageFX();
		
		/* poa filter */
		if($('ipm_poa_disable')) {
			$('ipm_poa_disable').addEvent('click',function() { $('ipm_filterpoa').checked = false; $('ipm_filterpoa').removeProperty('checked'); $('ipm_search_btn_side').fireEvent('click'); });
		}
		if($('ipm_poa_enable')) {
			$('ipm_poa_enable').addEvent('click',function() { $('ipm_filterpoa').checked = true; $('ipm_filterpoa').setProperty('checked','checked'); $('ipm_search_btn_side').fireEvent('click'); });
		}
		
	},
	
	history: function(total,a) {	
		var pagi = new PaginationClass('p', total);
		$$('div.pagination').getElements('a[class=pglnx]').each(function(el) { el.addEvent('click',function() { var e = this; window.location.hash = 'pg(' + e.getProperty('rel') + ')'; }); });
	},
	
	gotoPage: function(pg,lt,data) {
		new Ajax('/?xhr', { method: 'post', update: $('ipm_resultsbar_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'results','xhr':'list.results','sid':ipm_session_id,'ipm_page':pg,'ipm_postData':$('ipm_postData').getProperty('value')}), onRequest: function() { ipm.site.results.onRequest(); $$('select').setProperty('disabled','disabled'); $$('input').setProperty('disabled','disabled'); }, onComplete: function() { $('ipm_resultsbar_ajax').setOpacity(1); ipm.site.results.pagination(lt,data); $$('select').setProperty('disabled',''); $$('input').setProperty('disabled',''); ipm.skroll.toElement('ipm_resultsbar'); }}).request();
	},
	
	pageFX: function() {
		//if(!window.ie) {
			if($('leftmenubar')) {
				if( leftmenubar ){ leftmenubar.stop(); };
				if( qenquiry ){ qenquiry.stop(); };
				leftmenubar = new Fx.Style('leftmenubar','top',{duration:1000,transition:Fx.Transitions.Quad.easeInOut}).start(parseInt($('leftmenubar').style.top),((parseInt(window.getScrollTop())<offSet) ? parseInt(offSet) : parseInt(window.getScrollTop())));
				if($('ipm_quickEnquiryForm')) {
					qenquiry = new Fx.Style('ipm_quickEnquiryForm','top',{duration:1500,transition:Fx.Transitions.Back.easeInOut}).start(parseInt($('ipm_quickEnquiryForm').style.top),parseInt((window.getScrollTop().toInt())+200));
				}
			}
			//leftmenubar = new Fx.Style('leftmenubar','top',{duration:1000,transition:Fx.Transitions.Quad.easeInOut}).start(parseInt($('leftmenubar').style.top),(window.getScrollTop()>offSet ? ((mhs['size']['y']>window.getHeight())&&((window.getScrollTop()+mhs['size']['y'])>window.getScrollHeight()) ? (window.getScrollHeight()-(mhs['size']['y']+35)) : window.getScrollTop()) : offSet));	
		//}
	},
	
	resultOrder: function(lt,data) {
		if(lt=='undefined'||!lt) lt = 'sale';
		if($('ipm_ajax_order_top')) { 
			new Ajax('/?xhr', { method: 'post', evalResponse: true, data: Object.toQueryString({'select':'','xhr':'order','fieldID':'ipm_ajax_order_top','lt':lt,'sid':ipm_session_id,'data':$('ipm_postData').getProperty('value')})}).request();
			new Ajax('/?xhr', { method: 'post', evalResponse: true, data: Object.toQueryString({'select':'','xhr':'order','fieldID':'ipm_ajax_order_bot','lt':lt,'sid':ipm_session_id,'data':$('ipm_postData').getProperty('value')})}).request();
			var oldData = null;
			if($('ipm_ajax_order_top')) $('ipm_ajax_order_top').addEvent('change',function() { oldData = $('ipm_ajax_order_top').getProperty('value'); var e = this; new Ajax('/?xhr', { method: 'post', update: $('ipm_resultsbar_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'results','xhr':'list.results','sid':ipm_session_id,'ipm_order':e.getProperty('value'),'ipm_reset':'1','ipm_postData':$('ipm_postData').getProperty('value')}), onRequest: function() { ipm.site.results.onRequest(); $$('select').setProperty('disabled','disabled'); $$('input').setProperty('disabled','disabled'); }, onComplete: function() { $('ipm_resultsbar_ajax').setOpacity(1); ipm.site.results.pagination(lt,oldData); $$('select').setProperty('disabled',''); $$('input').setProperty('disabled',''); ipm.skroll.toElement('ipm_resultsbar'); }}).request(); });
			if($('ipm_ajax_order_bot')) $('ipm_ajax_order_bot').addEvent('change',function() { oldData = $('ipm_ajax_order_bot').getProperty('value'); var e = this; new Ajax('/?xhr', { method: 'post', update: $('ipm_resultsbar_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'results','xhr':'list.results','sid':ipm_session_id,'ipm_order':e.getProperty('value'),'ipm_reset':'1','ipm_postData':$('ipm_postData').getProperty('value')}), onRequest: function() { ipm.site.results.onRequest(); $$('select').setProperty('disabled','disabled'); $$('input').setProperty('disabled','disabled'); }, onComplete: function() { $('ipm_resultsbar_ajax').setOpacity(1); ipm.site.results.pagination(lt,oldData); $$('select').setProperty('disabled',''); $$('input').setProperty('disabled',''); ipm.skroll.toElement('ipm_resultsbar'); }}).request(); });
		}
	},
	
	onRequest: function() {
		$$('.pagination').setHTML().addClass('ajaxloader');
		$$('.results').remove();
		//overlay = new Element('div',{'id':'ipm_overlay'}).setStyles({'left':'auto','margin':'-1px','position':'absolute','top':'auto','background-color':'#333','padding-right':'2px','padding-bottom':'8px','height':$('ipm_resultsbar_ajax').getStyle('height'),'width':$('ipm_resultsbar_ajax').getStyle('width')}).setOpacity(0.6).injectTop($('ipm_resultsbar_ajax'));
		//overlay.removeClass('hide');
	},
	
	refine: function(lt,data) {
		//var ipm_refine_top = new Fx.Slide('ipm_refine_top', {duration: 500}).hide();
		var s = '0'; var x = '';
		$$('li.refine a[rel=ipm_refine_top]').addEvent('click',function() {if(x) { x.cancel(); }$('ipm_refine_top').toggleClass('hide'); if(s=='0') { s = '1'; } else { s = '0'; $('ipm_refine_top').setHTML(); } if(s=='1') { var e = this; x = new Ajax('/?xhr', { method: 'post', update: $('ipm_refine_top'), evalScripts: true, data: Object.toQueryString({'tpl':'results','xhr':'refine.results','sid':ipm_session_id,'ipm_postData':$('ipm_postData').getProperty('value')}), onRequest: function() { $('ipm_refine_top').setHTML().addClass('ajaxloader'); }, onComplete: function() { $('ipm_refine_top').removeClass('ajaxloader'); }}).request(); } });
	},
	
	onComplete: function() {
		//overlay.addClass('hide');
	},
	
	pagination: function(lt,data) {
		ipm.site.results.resultOrder(lt,data);
		ipm.site.results.refine(lt,data);
		//$$('div.pagination').getElements('a[class=pglnx]').each(function(el) { el.addEvent('click',function() { var e = this; new Ajax('/?xhr', { method: 'post', update: $('ipm_resultsbar_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'results','xhr':'list.results','sid':ipm_session_id,'ipm_page':e.getProperty('rel'),'ipm_postData':$('ipm_postData').getProperty('value')}), onRequest: function() { ipm.site.results.onRequest(); $$('select').setProperty('disabled','disabled'); $$('input').setProperty('disabled','disabled'); }, onComplete: function() { $('ipm_resultsbar_ajax').setOpacity(1); ipm.site.results.pagination(lt,data); $$('select').setProperty('disabled',''); $$('input').setProperty('disabled',''); ipm.skroll.toElement('ipm_resultsbar'); }}).request(); }); });
	},
	
	quickEnquiry: function() {
	
		$$('a.ipm_sendEnquiry').each(function(el) {
			el.addEvent('click',function() {
				if(!$('ipm_quickEnquiry')) {
					var qe = new Element('div',{'id':'ipm_quickEnquiry','width':'100%'}).setStyles({'top':'0','left':'0','height':window.getScrollHeight().toInt() + 'px','width':window.getScrollWidth().toInt() + 'px','background':'#000','background-color':'#000','position':'absolute','display':'inline'}).setOpacity(0.8).setHTML('&nbsp;').injectInside($('docBody'));
					var qef = new Element('div',{'id':'ipm_quickEnquiryForm','class':'ipm_quickEnquiryForm'}).setStyles({'width':'1004px','height':'330px','position':'absolute','display':'inline','background-color':'#5E6D70','top':((window.getScrollTop().toInt()/2)+200) + 'px','left':(((window.getScrollWidth().toInt()/2)-517) + 'px'),'border':'solid 11px #0F1212','margin-left':'4px'}).injectInside($('docBody'));
					qe.addEvent('click',function() {
						qe.setStyle('display','none');
						qef.setStyle('display','none');
					});
					window.addEvent('resize',function() {
						qe.setStyles({'height':window.getScrollHeight().toInt() + 'px','width':window.getScrollWidth().toInt() + 'px'});
  				    	qef.setStyles({'left':(((window.getScrollWidth().toInt()/2)-517) + 'px')});
					});
					window.fireEvent('scroll');
					if(window.ie) { window.onscroll(); }
				} else {
					$('ipm_quickEnquiry').setStyle('display','inline');
					$('ipm_quickEnquiryForm').setHTML('').setStyle('display','block').addClass('ajaxloader2');
					window.fireEvent('scroll');
					if(window.ie) { window.onscroll(); }
				}
				$('ipm_quickEnquiryForm').setHTML('').setStyle('display','inline').addClass('ajaxloader2');
				/* ajaxitize */
				new Ajax('/?xhr', { method: 'post', update: $('ipm_quickEnquiryForm'), evalScripts: true, data: Object.toQueryString({'tpl':'listing','xhr':'quick.contact','ipm_pid':el.getParent().getProperty('rel'),'sid':ipm_session_id}), onComplete: function() { $('ipm_quickEnquiryForm').removeClass('ajaxloader2'); }}).request();
			});
		});
		if($('ipm_quickEnquiry')) {
			$('ipm_quickEnquiry').addEvent('click',function() {
				$('ipm_quickEnquiry').setStyle('display','none');
				$('ipm_quickEnquiryForm').setStyle('display','none');
				$('ipm_quickEnquiry').setStyles({'height':window.getScrollHeight().toInt() + 'px','width':window.getScrollWidth().toInt() + 'px'});
				$('ipm_quickEnquiryForm').setStyles({'left':(((window.getScrollWidth().toInt()/2)-517) + 'px')});
			});
		}
	
	}
	
}

ipm.site.agents = {	

	init: function(lt,data,fx) {	
		
		ipm.site.header.menu();
		ipm.site.agents.pagination(lt,data);
		if(fx!='1') ipm.site.agents.pageFX();
		
		ipm.site.agents.contact_btn();
		
		if($('ipm_showMap')) { $('ipm_showMap').addEvent('click',function() { $('ipm_gmap').toggleClass('hide'); setCenter(); }); }
		
	},
	
	pageFX: function() {
		if(!window.ie) {
			if($('leftmenubar')) {
				if( leftmenubar ){ leftmenubar.stop(); }; 
				leftmenubar = new Fx.Style('leftmenubar','top',{duration:1000,transition:Fx.Transitions.Quad.easeInOut}).start(parseInt($('leftmenubar').style.top),(window.getScrollTop()-(window.getScrollTop()>200 ? 200 : 0)));	
			}
		}
			if( qenquiry ){ qenquiry.stop(); };
			if($('ipm_quickEnquiryForm')) {
				qenquiry = new Fx.Style('ipm_quickEnquiryForm','top',{duration:1500,transition:Fx.Transitions.Back.easeInOut}).start(parseInt($('ipm_quickEnquiryForm').style.top),parseInt((window.getScrollTop().toInt())+200));
			}
		//}
	},
	
	history: function(total,a) {	
		var pagi = new PaginationClassAgents('p', total);
		$$('div.pagination').getElements('a[class=pglnx]').each(function(el) { el.addEvent('click',function() { var e = this; window.location.hash = 'pg(' + e.getProperty('rel') + ')'; }); });
	},
	
	gotoPage: function(pg,lt,data) {
		new Ajax('/?xhr', { method: 'post', update: $('ipm_resultsbar_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'agents','xhr':'list.results','sid':ipm_session_id,'ipm_page':pg,'ipm_postData':$('ipm_postData').getProperty('value')}), onRequest: function() { ipm.site.results.onRequest(); $$('select').setProperty('disabled','disabled'); $$('input').setProperty('disabled','disabled'); }, onComplete: function() { $('ipm_resultsbar_ajax').setOpacity(1); ipm.site.agents.pagination(lt,data); $$('select').setProperty('disabled',''); $$('input').setProperty('disabled',''); ipm.skroll.toElement('ipm_resultsbar_ajax'); }}).request();
	},
	
	contact_btn: function() {
		/* contact form */
		if($('ipm_send_agent_contact')) {
			$('ipm_send_agent_contact').addEvent('click',function() {
				ipm.site.agents.contact();
				$('ipm_send_agent_contact').setStyle('color','#cccccc');
			});
		}
	},
	
	contact: function() {
		new Ajax('/?xhr', { method: 'post', evalScripts: true, data: Object.toQueryString({'form':'agents','xhr':'contact','sid':ipm_session_id,'name':$('ipm_name').getProperty('value'),'email':$('ipm_email').getProperty('value'),'phone':$('ipm_phone').getProperty('value'),'msg':$('ipm_msg').getProperty('value'),'agentID':ipm_agent_id}), onComplete: function() { $('ipm_send_agent_contact').setStyle('color','#ffff00'); }}).request();
	},
	
	onRequest: function() {
		$$('.pagination').setHTML().addClass('ajaxloader');
		$$('.results').remove();
	},
	
	onComplete: function() {
		
	},
	
	pagination: function(lt,data) {
		$$('#ipm_resultsbar_ajax ul.resultsNav li').each(function(el) { el.addEvent('click',function() { window.location.href = this.getProperty('rel'); }); });
		//$$('div.pagination').getElements('a[class=pglnx]').each(function(el) { el.addEvent('click',function() { var e = this; new Ajax('/?xhr', { method: 'post', update: $('ipm_resultsbar_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'agents','xhr':'list.results','sid':ipm_session_id,'ipm_page':e.getProperty('rel'),'ipm_postData':$('ipm_postData').getProperty('value')}), onRequest: function() { ipm.site.results.onRequest(); $$('select').setProperty('disabled','disabled'); $$('input').setProperty('disabled','disabled'); }, onComplete: function() { $('ipm_resultsbar_ajax').setOpacity(1); ipm.site.agents.pagination(lt,data); $$('select').setProperty('disabled',''); $$('input').setProperty('disabled',''); ipm.skroll.toElement('ipm_resultsbar_ajax'); }}).request(); }); });
	},
	
	search: function(agentID,lt) {	
		var code = null;
		new Autocompleter.Ajax.Xhtml($('ipm_search_string'), '/?xhr', {
			postData: {'tpl':'header','xhr':'agent.search','sid':ipm_session_id,'agentID':agentID,'listingType':lt}, postVar: 'q',
			onSelect: function(e,i) {
				code = e.getProperty('value'); e.setProperty('value','')
				if(code) window.location.href='agency_lookup.inc.php?parse=' + code + '/';
			},
			parseChoices: function(el,i) {
				var value = el.getText();
				code = (el.getElement('input[type=hidden]') ? el.getElement('input[type=hidden]').getProperty('value') : '');
				el.inputValue = code;
				this.addChoiceEvents(el);
			},
			onRequest: function() {
				ipm.site.header.searchLoader(true);
			},
			onComplete: function() {
				ipm.site.header.searchLoader(false);
			}
		});
	}
	
}

ipm.site.listing = {	

	init: function(lt,data) {	
		
		ipm.site.header.menu();
		
		$('ipm_panoClose').addEvent('click',function() {
		 	$('ipm_gmap').removeClass('hide');
			$('ipm_pano').addClass('hide');
			$('ipm_panoClose').addClass('hide');
		 });
		
		if(_ipm_rule!='print') {
			
			$$('#ipm_slider ul li').each(function(el) {
				el.addEvent('click',function(e) {
					var i = el.getElement('img').getProperty('id');
					$$('div.listing_mainphoto').setStyle('background-image','url(/images/listing/' + ipm_encPath + '/' + i + '/' + ipm_listing_id + '/)');
					ipm_current_img = '/images/listing/' + ipm_encPath + '/' + i + '/' + ipm_listing_id + '/';
				});
			});
		
			if($('ipm_slider')) {
				var ipm_slider = new Scroller('ipm_slider', {area: 50, velocity: 1, transition: Fx.Transitions.Quad.easeOut});
				$('ipm_slider').addEvent('mouseover', ipm_slider.start.bind(ipm_slider));
				$('ipm_slider').addEvent('mouseout', ipm_slider.stop.bind(ipm_slider));
			}
		
		}
		
		$$('a[rel=bookmark]').addEvent('click',function(e) { var e = new Event(e); ipm.site.bookmark(this.getProperty('title'),this.getProperty('href')); e.stop(); });
		
		ipm.site.listing.contact_btn();
		ipm.site.listing.staf_btn();
		
		if(window.ie) { 
		
			$$('ul.recently_viewed li').each(function(el) { el.addEvent('mouseover',function() { el.addClass('hover'); }).addEvent('mouseout',function() { el.removeClass('hover'); }); }); 
			$$('ul.listing_options li').each(function(el) { el.addEvent('mouseover',function() { el.addClass('hover'); }).addEvent('mouseout',function() { el.removeClass('hover'); }); }); 
		
		};
		
		if($('ipm_lightbox')) {
			
			//$('ipm_lightbox').addEvent('click',function() { try { Lightbox.show(ipm_current_img.replace('/listing/','/listingfull/'),0); } catch(err) {  } });
			
		}
		
		if($('ipm_rimages')) {
			$('ipm_rimages').addEvent('click',function(e) { var e = new Event(e).stop(); if($('ipm_msg')) { $('ipm_msg').setText('Please send me more images regarding this listing.').focus(); } });
		}

	},
	
	surrounding: function(sID) {
		new Ajax('/?xhr', { method: 'post', update: $('ipm_surrounding_scroll_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'listing','xhr':'surrounding.listings','sid':ipm_session_id,'ipm_sid':sID,'ipm_pid':ipm_listing_id}), onRequest: function() { $('ipm_surrounding_scroll').addClass('ajaxloader'); if($$('.yoo-tooltip')) { $$('.yoo-tooltip').each(function(el) { el.remove(); }); } }, onComplete: function() { $('ipm_surrounding_scroll').removeClass('ajaxloader'); new Fx.Style('ipm_surrounding_scroll_ajax', 'opacity').start(0,1); }}).request();
	},
	
	businesses: function(id) {
		new Ajax('/?xhr', { method: 'post', update: $('ipm_surrounding_scroll_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'listing','xhr':'surrounding.businesses','sid':ipm_session_id,'ipm_id':id}), onRequest: function() { $('ipm_surrounding_scroll').addClass('ajaxloader'); }, onComplete: function() { $('ipm_surrounding_scroll').removeClass('ajaxloader'); new Fx.Style('ipm_surrounding_scroll_ajax', 'opacity').start(0,1); }}).request();
	},
	
	contact_btn: function() {
		/* contact form */
		if($('ipm_send_contact')) {
			$('ipm_send_contact').addEvent('click',function() {
				ipm.site.listing.contact();
				$('ipm_send_contact').setStyle('color','#cccccc');
			});
		}
	},
	
	staf_btn: function() {
		/* contact form */
		if($('ipm_send_staf')) {
			$('ipm_send_staf').addEvent('click',function() {
				ipm.site.listing.staf();
				$('ipm_send_staf').setStyle('color','#cccccc');
			});
		}
	},
	
	contact: function() {
		new Ajax('/?xhr', { method: 'post', evalScripts: true, data: Object.toQueryString({'form':'listing','xhr':'contact','sid':ipm_session_id,'name':$('ipm_name_q').getProperty('value'),'email':$('ipm_email_q').getProperty('value'),'phone':$('ipm_phone_q').getProperty('value'),'msg':$('ipm_msg_q').getProperty('value'),'listingID':ipm_listing_id}), onComplete: function() { $('ipm_send_contact').setStyle('color','#ffff00'); }}).request();
	},
	
	staf: function() {
		new Ajax('/?xhr', { method: 'post', evalScripts: true, data: Object.toQueryString({'form':'listing','xhr':'staf','sid':ipm_session_id,'name':$('ipm_name').getProperty('value'),'email':$('ipm_email').getProperty('value'),'fname':$('ipm_fname').getProperty('value'),'femail':$('ipm_femail').getProperty('value'),'listingID':ipm_listing_id}), onComplete: function() { $('ipm_send_contact').setStyle('color','#ffff00'); }}).request();
	}
	
}

var magID 	= [];
var magIDs 	= [];
var magPack = [];

ipm.site.publications = {

	init: function() {
		
		ipm.site.header.menu();
		//ipm.site.homepage.feature();
		ipm.site.homepage.latest();
		ipm.site.publications.order_btn();
		
		var ipm_total = '0';
		var ipm_total_a = '0';
		var ipm_total_b = '0';
		var i = 0;
		
		$$('input[type=checkbox]').each(function(el) { 
			el.addEvent('click',function() { 
				if(el.checked) { 
					ipm_total_a = ipm_total_a.toInt() + magID[el.getProperty('value')].toInt(); 
					el.setProperty('checked','checked'); magIDs.include(el.getProperty('value'));
					i++;
				} else {
					ipm_total_a = ipm_total_a.toInt() - magID[el.getProperty('value')].toInt();
					el.removeProperty('checked'); magIDs.remove(el.getProperty('value'));
					i--;
				};
				if(magPack[i]) { ipm_total = magPack[i].toInt(); } else { ipm_total = ipm_total_a; };
				$('ipm_total_div').setHTML('Total: $' + ipm_total.toFixed(2) + ' AUD');
				$('ipm_total').setProperty('value',ipm_total.toFixed(2));
			}); 
		});
	
		$('ipm_paymentType').addEvent('change',function() {
														
			if(!i) {
				alert('Please select a least one magazine publication.');
				$('ipm_paymentType').selectedIndex = 0;
				return false;
			}
			
			if(this.getProperty('value')) {
			
				var v = this.getProperty('value');
				
				if(v==1) { $('ipm_cheque').removeClass('hide'); $('ipm_paypal').addClass('hide'); };
				if(v==2) { $('ipm_paypal').removeClass('hide'); $('ipm_cheque').addClass('hide'); };
				
				$('ipm_form').removeClass('hide'); ipm.skroll.toElement('ipm_form');
			
			} else {
				
				$('ipm_cheque').addClass('hide'); $('ipm_paypal').addClass('hide');
				$('ipm_form').addClass('hide');
				
			}
			
		});
	
	},
	
	order_btn: function() {
		/* order form */
		if($('ipm_submit')) {
			$('ipm_submit').addEvent('click',function() {
				ipm.site.publications.order();
				$('ipm_submit').setProperty('disabled','disabled');
			});
		}
	},
	
	order: function() {
		new Ajax('/?xhr', { method: 'post', evalScripts: true, data: Object.toQueryString({'form':'publications','xhr':'order','sid':ipm_session_id,'name':$('ipm_name').getProperty('value'),'email':$('ipm_email').getProperty('value'),'phone':$('ipm_phone').getProperty('value'),'address1':$('ipm_address1').getProperty('value'),'address2':$('ipm_address2').getProperty('value'),'suburb':$('ipm_suburb').getProperty('value'),'state':$('ipm_state').getProperty('value'),'postcode':$('ipm_postcode').getProperty('value'),'orderID':$('ipm_orderID').getProperty('value'),'total':$('ipm_total').getProperty('value'),'magIDs':magIDs}), onComplete: function() { $('ipm_submit').removeProperty('disabled'); }}).request();
	}

}

ipm.site.contact = {	

	init: function() {	
		var xhr;
		$('ipm_feature_scroll_ajax').setOpacity(0);
		ipm.site.header.menu();
		//ipm.site.contact.feature();
		ipm.site.contact.latest();
		ipm.site.contact.contact_btn();
		
		if(window.ie) { 
		
			$$('ul.navigation li').each(function(el) { el.addEvent('mouseover',function() { el.addClass('hover'); }).addEvent('mouseout',function() { el.removeClass('hover'); }); }); 
		
		};
		
		if($('ipm_name')) { $('ipm_name').focus(); };
		
	},
	
	feature: function(rID) {
		new Ajax('/?xhr', { method: 'post', update: $('ipm_feature_scroll_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'homepage','xhr':'feature.listings','sid':ipm_session_id,'regionID':rID}), onRequest: function() { $('ipm_feature_scroll').addClass('ajaxloader'); }, onComplete: function() { $('ipm_feature_scroll').removeClass('ajaxloader'); new Fx.Style('ipm_feature_scroll_ajax', 'opacity').start(0,1); }}).request();
	},
	
	latest: function(p,lt) {
		new Ajax('/?xhr', { method: 'post', update: $('ipm_latestbar_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'homepage','xhr':'latest.listings','sid':ipm_session_id,'page':p,'lt':lt}), onRequest: function() { $('ipm_latestbar').addClass('ajaxloader'); }, onComplete: function() { $('ipm_latestbar').removeClass('ajaxloader'); new Fx.Style('ipm_latestbar_ajax', 'opacity').start(0,1); }}).request();
	},
	
	contact_btn: function() {
		/* contact form */
		if($('ipm_send_contact')) {
			$('ipm_send_contact').addEvent('click',function() {
				ipm.site.contact.contact();
				$('ipm_send_contact').setStyle('color','#cccccc');
			});
		}
	},
	
	contact: function() {
		new Ajax('/?xhr', { method: 'post', evalScripts: true, data: Object.toQueryString({'form':'contact','xhr':'contact','sid':ipm_session_id,'name':$('ipm_name').getProperty('value'),'email':$('ipm_email').getProperty('value'),'phone':$('ipm_phone').getProperty('value'),'msg':$('ipm_msg').getProperty('value')}), onComplete: function() { $('ipm_send_contact').setStyle('color','#ffff00'); }}).request();
	}
	
}

ipm.site.feedback = {	

	init: function() {	
		var xhr;
		$('ipm_feature_scroll_ajax').setOpacity(0);
		ipm.site.header.menu();
		ipm.site.feedback.feature();
		ipm.site.feedback.latest();
		ipm.site.feedback.feedback_btn();
		
		if(window.ie) { 
		
			$$('ul.navigation li').each(function(el) { el.addEvent('mouseover',function() { el.addClass('hover'); }).addEvent('mouseout',function() { el.removeClass('hover'); }); }); 
		
		};
		
		if($('ipm_name')) { $('ipm_name').focus(); };
		
	},
	
	feature: function(rID) {
		new Ajax('/?xhr', { method: 'post', update: $('ipm_feature_scroll_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'homepage','xhr':'feature.listings','sid':ipm_session_id,'regionID':rID}), onRequest: function() { $('ipm_feature_scroll').addClass('ajaxloader'); }, onComplete: function() { $('ipm_feature_scroll').removeClass('ajaxloader'); new Fx.Style('ipm_feature_scroll_ajax', 'opacity').start(0,1); }}).request();
	},
	
	latest: function(p,lt) {
		new Ajax('/?xhr', { method: 'post', update: $('ipm_latestbar_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'homepage','xhr':'latest.listings','sid':ipm_session_id,'page':p,'lt':lt}), onRequest: function() { $('ipm_latestbar').addClass('ajaxloader'); }, onComplete: function() { $('ipm_latestbar').removeClass('ajaxloader'); new Fx.Style('ipm_latestbar_ajax', 'opacity').start(0,1); }}).request();
	},
	
	feedback_btn: function() {
		/* contact form */
		if($('ipm_send_contact')) {
			$('ipm_send_contact').addEvent('click',function() {
				ipm.site.feedback.contact();
				$('ipm_send_contact').setStyle('color','#cccccc');
			});
		}
	},
	
	contact: function() {
		new Ajax('/?xhr', { method: 'post', evalScripts: true, data: Object.toQueryString({'form':'feedback','xhr':'feedback','sid':ipm_session_id,'name':$('ipm_name').getProperty('value'),'email':$('ipm_email').getProperty('value'),'phone':$('ipm_phone').getProperty('value'),'vote1':$('ipm_vote1').getElements('input[checked=checked]').getProperty('value'),'vote2':$('ipm_vote2').getElements('input[checked=checked]').getProperty('value'),'vote3':$('ipm_vote3').getElements('input[checked=checked]').getProperty('value'),'msg':$('ipm_msg').getProperty('value')}), onComplete: function() { $('ipm_send_contact').setStyle('color','#ffff00'); }}).request();
	}
	
}

ipm.site.findagent = {	

	init: function() {	
		var xhr;
		$('ipm_feature_scroll_ajax').setOpacity(0);
		ipm.site.header.menu();
		//ipm.site.findagent.feature();
		ipm.site.findagent.latest();
		
		ipm.site.search.qsearch();
		
		if(window.ie) { 
		
			$$('ul.navigation li').each(function(el) { el.addEvent('mouseover',function() { el.addClass('hover'); }).addEvent('mouseout',function() { el.removeClass('hover'); }); }); 
		
		};

		
	},
	
	post: function() {
		
		ipm.site.findagent.pagination();
		
	},
	
	pagination: function(lt,data) {
		$$('#ipm_resultsbar_ajax ul.resultsNav li').each(function(el) { el.addEvent('click',function() { window.location.href = this.getProperty('rel'); }); });
		$$('div.pagination').getElements('a[class=pglnx]').each(function(el) { el.addEvent('click',function() { var e = this; new Ajax('/?xhr', { method: 'post', update: $('ipm_resultsbar_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'find','xhr':'list.results','sid':ipm_session_id,'ipm_page':e.getProperty('rel'),'ipm_postData':$('ipm_postData').getProperty('value')}), onRequest: function() { ipm.site.results.onRequest(); $$('select').setProperty('disabled','disabled'); $$('input').setProperty('disabled','disabled'); }, onComplete: function() { $('ipm_resultsbar_ajax').setOpacity(1); ipm.site.findagent.pagination(lt,data); $$('select').setProperty('disabled',''); $$('input').setProperty('disabled',''); ipm.skroll.toElement('ipm_resultsbar_ajax'); }}).request(); }); });
	},
	
	feature: function(rID) {
		new Ajax('/?xhr', { method: 'post', update: $('ipm_feature_scroll_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'homepage','xhr':'feature.listings','sid':ipm_session_id,'regionID':rID}), onRequest: function() { $('ipm_feature_scroll').addClass('ajaxloader'); }, onComplete: function() { $('ipm_feature_scroll').removeClass('ajaxloader'); new Fx.Style('ipm_feature_scroll_ajax', 'opacity').start(0,1); }}).request();
	},
	
	latest: function(p,lt) {
		new Ajax('/?xhr', { method: 'post', update: $('ipm_latestbar_ajax'), evalScripts: true, data: Object.toQueryString({'tpl':'homepage','xhr':'latest.listings','sid':ipm_session_id,'page':p,'lt':lt}), onRequest: function() { $('ipm_latestbar').addClass('ajaxloader'); }, onComplete: function() { $('ipm_latestbar').removeClass('ajaxloader'); new Fx.Style('ipm_latestbar_ajax', 'opacity').start(0,1); }}).request();
	}
		
}

ipm.site.bnd = {	

	init: function(data) {	
	
		if($('ipm_ajax_state')) {
			$('ipm_ajax_state').addEvent('change',function() {
				$('ipm_ajax_region').setProperty('disabled','disabled');
				ipm.ajax.clearOptionList('ipm_ajax_region');
				ipm.ajax.addOption('ipm_ajax_region','Loading','','');
				new Ajax('/?xhr', { method: 'post', evalResponse: true, data: Object.toQueryString({'select':'','xhr':'bnd.region','fieldID':'ipm_ajax_region','sid':ipm_session_id,'data':data,'state':$('ipm_ajax_state').getProperty('value'),'pso':'1'})}).request();
			});
		};
		
		if($('ipm_bndbar')) {
			new Ajax('/?xhr', { method: 'post', update: $('ipm_bndbar'), evalScripts: true, data: Object.toQueryString({'xhr':'bnd','tpl':'bnd','sid':ipm_session_id,'data':data}), onComplete: function() { $('ipm_bndbar').removeClass('ajaxLoader'); }}).request();
		}
	
	}
		
}
} catch(err) {}