function sylvester(c) {
	this.ie6=/MSIE 6/.test(navigator.userAgent);
	this.gallery=new gal(this);
	this.dim=new dim(this);
	new businesses(this);
	this.load=new load(this);
	this.c=c;
}
sylvester.prototype={
}

function dim(p) {
	this.p=p;
	this.div=false;
	this.calllist=[];
}
dim.prototype={
show:function() {
	var o=this;
	if(this.p.ie6) $(window).scrollTop(0);
	if(this.div==false) {
		this.div=$('<div id="dim"></div>');
		this.div.css('opacity','0').appendTo('body');
		this.div.bind('click',function(){ o.hide(); });
	}
	this.div.stop(true).show().animate({opacity:0.6},200);
},
hide:function() {
	var o=this;
	this.div.stop(true).animate({opacity:0},200,function(){ $(this).css('display','none'); o.tell(); });
},
tell:function() {
	for(x=0;x<this.calllist.length;x++) {
		this.calllist[x].told();
	}
},
register:function(o) {
	this.calllist[this.calllist.length]=o;
}
}
function load(p) {
	this.div=false;
	p.dim.register(this);
	this.p=p;
}
load.prototype={
show:function() {
	if(this.p.ie6) $(window).scrollTop(0);
	var o=this;
	if(this.div==false) {
		this.div=$('<div id="load"><div class="inner">Please Wait...<br/><img src="/sylvester/style/images/loading.gif" width="220" height="19" alt=""/></div></div>');
		this.div.appendTo('body');
		$(window).bind('resize',function(){
			o.div.css({
				top:Math.floor(($(window).height()-o.div.height())/2),
				left:Math.floor(($(window).width()-o.div.width())/2)
			});
		});
		this.div.css({
			top:Math.floor(($(window).height()-this.div.height())/2),
			left:Math.floor(($(window).width()-this.div.width())/2)
		});
	}
	this.div.show();
},
hide:function() {
	if(this.div) {
		this.div.hide();
	}
},
told:function() {
	this.hide();
}
}

function gal(p) {
	this.p=p;
	var obj=this;
	this.init=false;
	this.hidedim=false;
	this.strip=new strip(this);
	$(window).bind('resize',function() {
		obj.resize();
	});
}
gal.prototype={
resize:function() {
	if(this.init) {
		var winW=$(window).width(),winH=$(window).height();
		this.left=Math.floor(winW/2)-350;
		$('#popup').css({
			top:Math.ceil(winH/2)-263,
			left:this.left
		});
	}
},
shownext:function(b,id){
	$('#popup div.right').css('visibility',b?'visible':'hidden').attr('iid',id);
},
showprev:function(b,id){
	$('#popup div.left').css('visibility',b?'visible':'hidden').attr('iid',id);
},
createpopup:function() {
	var obj=this,winW=$(window).width(),winH=$(window).height();
	this.init=true;
	this.left=(Math.floor(winW/2)-350);
	$('<div id="popup" style="top:'+(Math.ceil(winH/2)-263)+'px;left:'+this.left+'px"><div class="image"></div><div class="closebtn">X</div><div class="left">◄</div><div class="right">►</div><div class="up">▲</div><div class="strip"></div><div class="loading"><img src="/sylvester/style/images/loading.gif" width="220" height="19" alt=""/></div></div>').appendTo('body');
	$('#popup div.close,#popup div.closebtn').bind('click',function() {
		obj.close(false);
	});
	this.p.dim.register(this);
	$('#popup div.closebtn,#popup div.left,#popup div.right').bind('mouseover',function() {
		$(this).stop(true).animate({'opacity':1},400);
	});
	$('#popup div.closebtn,#popup div.left,#popup div.right').bind('mouseout',function() {
		$(this).stop(true).animate({'opacity':0.7},400);
	});
	$('#popup div.left,#popup div.right').bind('click',function() {
		obj.strip.select($(this).attr('iid'));
	});
	this.strip.attach($('#popup div.strip'),$('#popup div.up'));
},
told:function(){ 
	this.close(true);
},
hideall:function() {
	$('#popup div.closebtn,#popup div.left,#popup div.right,#popup div.up,#popup div.loading').stop(true).css({visibility:'hidden'});
},
close:function(fromtold) {
	if(!fromtold) {
		if(this.hidedim) {
			this.p.dim.hide();
		}
	}
	this.hideall();
	$('#popup').css({display:'none'});
},
showall:function() {
	$('#popup div.closebtn,#popup div.left,#popup div.right,#popup div.up').css({
		opacity:0,
		visibility:'visible'
	}).animate({'opacity':0.7},400);
	$('#popup div.loading').css({opacity:0,visibility:'visible'});
},
view:function(id) {
	if(this.hidedim){
		this.p.dim.show();
	}
	var obj=this;
	if(!this.init) this.createpopup();
	$('#popup').css('display','block');
	this.showall();
	this.strip.select(id);
	return false;
},
show:function(list,id) {
	var x,ct;
	this.strip.empty();
	for (x=0,ct=list.length;x<ct;x++) {
		this.strip.register(list[x]);
	}
	this.view(id);
},
loadimage:function(id) {
	var nextimg=new Image(),obj=this;
	if(typeof(nextimg.complete) != 'undefined') {
		nextimg.onload=function(){ obj.showimage(this); }
		$("#popup div.loading").stop(true).animate({'opacity':0.5},500);
		nextimg.src=this.strip.prefix+'?nb%5Bop%5D=image&nb%5Bsize%5D=6&nb%5Bid%5D='+id;
	} else {
		nextimg.src=this.strip.prefix+'?nb%5Bop%5D=image&nb%5Bsize%5D=6&nb%5Bid%5D='+id;
		$('#popup div.image').append(nextimg);
	}
},
showimage:function(i) {
	$("#popup div.loading").stop(true).animate({'opacity':0.0},400);
	$('#popup div.image img').remove();
	$('#popup div.image').css({visibility:'hidden'})
	.append(i)
	.css({
		top:Math.floor((525-$(i).height())/2)+'px',
		left:Math.floor((700-$(i).width())/2)+'px',
		opacity:0,
		visibility:'visible'
	})
	.animate({'opacity':1},300);
}
}

function strip(app) {
	this.app=app;
	this.div=false;
	this.visible=false;
	this.floater=$('<div></div>');
	this.timeout=false;
	this.width=0;
	this.prefix='/business.nb';
}
strip.prototype={
attach:function(ss,bb){
	var obj=this;
	this.div=ss;
	this.div.css({opacity:0.8});
	this.floater.appendTo(this.div);
	$(this.div).bind('mousemove',function(e) {
		if(obj.width>700) {
			$(obj.div).scrollLeft(Math.floor((e.pageX-obj.app.left)/700*obj.maxoff));
		}
	});
	this.bb=bb;
	this.bb.bind('mouseover',function() {
		obj.show();
	});
	this.div.bind('mouseover',function() {
		obj.show();
	});
	this.div.bind('mouseout',function() {
		obj.hide();
	});
},
register:function(id) {
	var obj=this,i=$('<img src="'+this.prefix+'?nb%5Bop%5D=image&nb%5Bsize%5D=3&nb%5Bid%5D='+id+'" width="120" iid="'+id+'" height="80"/>');
	i[0].iid=id;
	i.bind('mouseover',function() {
		$(this).addClass('hover');
	});
	i.bind('mouseout',function() {
		$(this).removeClass('hover');
	});
	i.bind('click',function() {
		if(!$(this).hasClass('active')) {
			obj.select(this.iid);
		}
	});
	i.appendTo(this.floater);
	this.width+=130;
	this.maxoff=this.width-700;
},
empty:function() {
	this.width=0;
	this.floater.empty();
},
select:function(id) {
	$('img',this.floater).removeClass('active');
	var ic=$('img[iid='+id+']',this.floater);
	ic.addClass('active');
	var look=ic.nextAll();
	this.app.shownext(look.length,look.length?look[0].iid:0);
	look=ic.prevAll();
	this.app.showprev(look.length,look.length?look[0].iid:0);
	this.app.loadimage(id);
},
show:function() {
	if(!this.visible) {
		if(this.timeout) clearTimeout(this.timeout);
		this.timeout=false;
		this.visible=true;
		this.bb.stop(true).animate({'opacity':0},200);
		this.div.stop(true).animate({'height':84},500);
	}
},
hide:function() {
	if(this.visible) {
		this.visible=false;
		if(this.timeout) clearTimeout(this.timeout);
		var obj=this;
		this.timeout=setTimeout(function() {
			obj.timeout=false;
			obj.div.stop(true).animate({'height':0},1500,function() {
				obj.bb.stop(true).animate({'opacity':0.7},200);
			});
		},2000);
	}
}
}

function businesses(p) {
	var o=this;
	this.p=p;
	this.div=false;
	this.contact=new contact(this);
	$('#businesses a').bind('click',function() {
		return o.open(this);
	});
	this.confidentiality=new confidentiality(this);
	this.noextra=new noextra(this);
	this.extra=new extra(this);
	this.anim=new anim(this);
	if(/\.info/.test(document.location.href)) {
		var id=/(^|\/)(\d+)_/.exec(document.location.href);
		this.contact.hidedim=true;
		$('#img img').each(function(i) {
			o.anim.start(eval(this.getAttribute('images')));
		});
		this.p.gallery.hidedim=true;
		id=id[2];
		$('#contact').empty().append(
			$('<a href="">Email Us<br/>About this business</a>').bind('click',function(){
				this.blur();
				o.p.dim.show();
				o.contact.show(id,true);
				return false;
			})
		);
	}
}
businesses.prototype={
creatediv:function() {
	var o=this;
	this.p.dim.register(this);
	this.div=$('<div id="businessdetailsouter"><div id="businessdetails"><h1></h1><div id="img"></div><dl></dl><div id="details"></div><div id="moredetails"><a href="">Click here for More Details...</a></div><div class="foot"><div id="agent"></div><div id="contact"></div></div></div><div id="close">X close</div></div>');
	this.div.appendTo('body');
	$(window).bind('resize',function(){
		o.div.css({
			top:Math.floor(($(window).height()-o.div.height())/2),
			left:Math.floor(($(window).width()-o.div.width())/2)
		});
	});
	$('#close',this.div).bind('click',function() {
		o.p.dim.hide();
	});
	$('#moredetails a',this.div).bind('click',function() {
		return o.moredetails();
	});
},
showmore:function(data) {
	this.p.dim.div.css('z-index','10');
	this.p.load.hide();
	if(data['status']=='1') {
		if (data['file'].length==1) {
			window.open('/business/'+data['file']+'/'+data['code']);
		} else {
			this.extra.show(data['file'],data['code']);
		}
	} else if (data['status']=='2') {
		this.noextra.show(data['text']);
	} else {
		this.confidentiality.show(data['text']);
	}
},
moredetails:function() {
	var o=this;
	this.p.dim.div.css('z-index','35');
	this.p.load.show();
	$.ajax({
		url:'/business.nb?moredetails='+o.currentid+'&c='+(this.p.c?1:0),
		dataType:'json',
		error:function() { document.location.href='/business.nb?id='+o.currentid; },
		success:function(data){ o.showmore(data); },
		timeout:10000
	});
	return false;
},
details:function(details,id) {
	if(!this.div) {
		this.creatediv();
	}
	var o=this;
	$('#businessdetails h1',this.div).html(details['name']+' - '+details['code']);
	this.anim.start(details['images']);
	var x,dl='<dt>Asking Price:</td><dd'+(details['boldprice']=='1'?' class="bb"':'')+'>'+details['price']+'</dd>';
	for(x=0;x<details['specs'].length;x++) {
		dl+='<dt>'+details['specs'][x][0]+'</dt><dd>'+details['specs'][x][1]+'</dd>';
	}
	$('#businessdetails dl',this.div).html(dl);
	$('#details',this.div).html(details['description']);
	if(details['agent'].length) {
		var txt='';
		for (x=0;x<details['agent'].length;x++) {
			txt+='<br/>'+details['agent'][x]+' - '+details['phone'][x];
		}
		$('#agent',this.div).html('Listing Agent'+txt);
	} else {
		$('#agent',this.div).html('');
	}
	$('#contact',this.div).empty().append(
		$('<a href="">Email Us<br/>About this business</a>').bind('click',function(){
			this.blur();
			o.contact.show(id);
			return false;
		})
	);
	$('#moredetails',this.div).css('display',details['more']=='1'?'block':'none');
	this.currentid=id;
	this.div.css('visibility','hidden');
	this.div.show();
	this.div.css({
		top:Math.floor(($(window).height()-o.div.height())/2),
		left:Math.floor(($(window).width()-o.div.width())/2),
		visibility:'visible'
	});
	this.p.load.hide();
},
told:function() {
	if(this.div) {
		this.anim.stop();
		this.div.hide();
		this.p.dim.div.css('z-index','10');
	}
},
open:function(e) {
	var o=this,id;
	e.blur();
	id=e.href.replace(/.*\/([0-9]*)_.*$/,'$1');
	this.p.dim.show();
	this.p.load.show();
	$.ajax({
		url:'/business.nb?id='+id+'&data=1',
		dataType:'json',
		error:function() { window.location.href=e.href; },
		success:function(data){ o.details(data,id); },
		timeout:10000
	});
	return false;
}
}

function extra(p) {
	this.p=p;
	this.div=false;
}
extra.prototype={
resized:function(){
	this.div.css({
		top:Math.floor(($(window).height()-this.div.height())/2),
		left:Math.floor(($(window).width()-this.div.width())/2)
	});
},
creatediv:function() {
	var o=this;
	this.p.p.dim.register(this);
	this.div=$('<div id="extra"><div class="inner"><div class="icons"></div><form method="get"><div class="submit"><input type="button" name="close" value="Close"/></div></form></div></div>');
	this.div.appendTo('body')
	$('input[name="close"]',this.div).bind('click',function(){
		o.hide();
	});
	$('form',this.div).bind('submit',function(){
		return false;
	});
	this.icons=$('div.icons',this.div);
	$(window).bind('resize',function(){
		o.resized();
	});
	this.div.css('visibility','visible');
},
show:function(files,codes) {
	if(this.div==false){
		this.creatediv();
	}
	var x,txt='';
	for(x=0;x<files.length;x++) {
		txt+='<a href="/business/'+files[x]+'/'+codes[x]+'" target="_blank">'+codes[x]+'</a>';
	}
	this.icons.html(txt);
	this.resized();
	this.div.show();
	this.p.p.dim.div.css('z-index',35);
},
hide:function() {
	this.div.hide();
	this.p.p.dim.div.css('z-index',10);
},
told:function() {
	this.hide();
}
}

function noextra(p) {
	this.p=p;
	this.div=false;
}
noextra.prototype={
htmlcode:function(){
	return '<div class="info"><div class="inner"><div class="text"></div><form method="get" action="/business.nb"><div class="submit"><input type="button" name="cancel" value="Close"/></div></form></div></div>'
},
createhook:function(){
	var o=this;
	$('form',this.div).bind('submit',function(){
		o.hide();
		return false;
	});
},
resized:function(){
	this.div.css({
		top:Math.floor(($(window).height()-this.div.height())/2),
		left:Math.floor(($(window).width()-this.div.width())/2)
	});
},
creatediv:function() {
	var o=this;
	this.p.p.dim.register(this);
	this.div=$(this.htmlcode());
	this.div.appendTo('body')
	$('input[name="cancel"]',this.div).bind('click',function(){
		o.hide();
	});
	this.text=$('div.text',this.div);
	this.createhook();
	$(window).bind('resize',function(){
		o.resized();
	});
	this.div.css('visibility','visible');
},
show:function(txt) {
	if(this.div==false){
		this.creatediv();
	}
	this.text.html(txt);
	this.resized();
	this.div.show();
	this.p.p.dim.div.css('z-index',35);
},
hide:function() {
	this.div.hide();
	this.p.p.dim.div.css('z-index',10);
},
told:function() {
	this.hide();
}
}

function confidentiality(p) {
	this.p=p;
	this.div=false;
}
confidentiality.prototype=new noextra;
confidentiality.prototype.htmlcode=function(){
	return '<div class="info"><div class="inner"><div class="text scrolled"></div><form method="post" action="/business.nb"><div><label for="name"><span>Your Name:</span><input type="text" class="ti" name="name" id="name"/></label></div><div><label for="email"><span>Email Address:</span><input type="text" class="ti" name="email" id="email"/></label></div><div><label for="phone"><span>Phone Number:</span><input type="text" class="ti" name="phone" id="phone"/></label></div><input type="hidden" name="business" value=""/><div><label for="agree"><input type="checkbox" name="agree" id="agree"/>I agree to the confidentiality agreement</label></div><div><label for="register"><input type="checkbox" name="register" checked="checked" id="register"/>Please send me regular business alerts about businesses for<br/>sale. Untick this box if you do not wish to receive this information.</label></div><div class="submit"><input type="button" name="cancel" value="Cancel"/> <input type="submit" value="Continue"/></div><input type="hidden" name="op" value="agree"/></form></div></div>'
}
confidentiality.prototype.send=function(){
	var cc={
		'name':[/./,'your Name'],
		'email':[/^([-a-zA-Z0-9_.+]+@[-a-zA-Z0-9_]+(\.[-a-zA-Z0-9_]+)+)?$/,'your Email Address'],
		'phone':[/^(\+?[0-9 ]*(\(\d+\))?[0-9 ]+)?$/,'your Phone Number']
	};
	var frm=$('form',this.div).get(0),err='',foc=false;

	if(!frm['agree'].checked) {
		alert("Sorry, you must agree to the confidentiality agreement before you can proceed.");
		return;
	}
	frm=frm.elements;
	for (x=0; x<frm.length; x++) {
		if(frm[x].type=='text') {
			if(frm[x].value=='') {
				err+="\nPlease enter "+cc[frm[x].name][1];
				if(!foc) foc=frm[x];
			} else {
				if(!cc[frm[x].name][0].exec(frm[x].value)) {
					err+="\nPlease enter "+cc[frm[x].name][1]+" again. There appears to be a problem with it";
					if(!foc) foc=frm[x];
				}
			}
		}
	}
	if(foc){
		alert("Sorry, please correct the following and then try again:"+err);
		foc.focus();
		return;
	}
	frm[3].value=this.p.currentid;
	var o=this;
	this.p.p.load.show();
	this.p.p.dim.div.css('z-index','60');
	$.ajax({
		type:'POST',
		url:'/business.nb',
		data:{
			name:frm[0].value,
			email:frm[1].value,
			phone:frm[2].value,
			business:frm[3].value,
			register:frm[5].checked?1:0,
			op:'agree',
			agree:1,
			data:1
		},
		dataType:'json',
		error:function(){ frm[0].form.submit(); },
		success:function(data){ o.p.p.c=true; o.p.p.load.hide(); o.hide(); o.p.showmore(data); },
		timeout:10000
	});
}
confidentiality.prototype.createhook=function(){
	var o=this;
	$('form',this.div).bind('submit',function(){
		o.send();
		return false;
	});
}

function anim(p){
	this.p=p;
	this.timeout=false;
	this.initted=false;
}
anim.prototype={
step:function(){
	var obj=this;
	this.image++;
	if(this.image>=this.images.length){
		this.image=0;
	}
	this.next=this.frame;
	this.frame=1-this.frame;
	this.frames[this.frame].css('z-index',33);
	this.frames[this.next].css('z-index',32);
	this.frames[this.frame].empty().append(this.images[this.image]);
	this.frames[this.frame].fadeIn(2000,function() { obj.frames[obj.next].hide(); });
	this.timeout=setTimeout(function(){ obj.step(); },5000);
},
stop:function(){
	if(this.timeout) {
		clearTimeout(this.timeout);
		this.timeout=false;
		this.frames[this.next].hide();
		this.frames[this.frame].hide();
	}
},
start:function(i){
	var x,ct,obj=this;
	this.i=i;
	if (!this.initted) {
		this.initted=true;
		this.frames=[];
		this.frames[0]=$('<div/>');
		this.frames[1]=$('<div/>');
		var l=$('#img');
		$.each(this.frames,function(j) {
			this.addClass('flash');
			this.appendTo(l);
			this.bind('click',function() {
				obj.showgallery();
			});
		});
	}
	this.images=[];
	for(x=0,ct=i.length;x<ct;x++){
		this.images[x]=new Image();
		this.images[x].src='/business.nb?nb%5Bop%5D=image&nb%5Bsize%5D=4&nb%5Bid%5D='+i[x];
	}
	this.image=0;
	this.frame=1;
	this.next=0;
	this.frames[1].css('z-index',33);
	this.frames[0].css('z-index',32);
	this.frames[1].empty().append(this.images[0]);
	this.frames[1].show();
	this.frames[0].hide();
	$('<div class="overlay"></div>').appendTo(l).bind('click',function(){
		obj.showgallery();
	});
	if(this.images.length>1) {
		this.timeout=setTimeout(function(){ obj.step(); },3000);
	}
},
showgallery:function() {
	this.p.p.gallery.show(this.i,this.i[this.image]);
}
}
function contact(p) {
	this.p=p;
	this.div=false;
	this.hidedim=false;
}
contact.prototype={
creatediv:function() {
	o=this;
	this.p.p.dim.register(this);
	this.div=$('<div id="contactwin"><div class="inner"><h1>Contact Us</h1><form method="post" action="/business.nb"><div><label for="name"><span>Your Name:</span><input type="text" name="name" id="name"/></label></div><div><label for="email"><span>Email Address:</span><input type="text" name="email" id="email"/></label></div><div><label for="phone"><span>Phone Number:</span><input type="text" name="phone" id="phone"/></label></div><div><label for="enquiry">Message:</label></div><div><textarea name="enquiry" id="enquiry"></textarea></div><input type="hidden" name="business" value=""/><div class="submit"><input type="button" value="Cancel"/> <input type="submit" value="Send"/></div></form></div></div>');
	this.div.appendTo('body');
	$(window).bind('resize',function(){
		o.div.css({
			top:Math.floor(($(window).height()-o.div.height())/2),
			left:Math.floor(($(window).width()-o.div.width())/2)
		});
	});
	$('input[value="Cancel"]',this.div).bind('click',function(){
		if(confirm('Do you wish to discard this message?')) {
			o.hide();
		}
		return false;
	});
	$('input[value="Send"]',this.div).bind('click',function(){
		o.send();
		return false;
	});
	this.div.css({
		top:Math.floor(($(window).height()-this.div.height())/2),
		left:Math.floor(($(window).width()-this.div.width())/2),
		visibility:'visible'
	});
},
show:function(id){
	if(!this.div) {
		this.creatediv();
	}
	$('input[name="name"]',this.div).get(0).value='';
	$('input[name="email"]',this.div).get(0).value='';
	$('input[name="phone"]',this.div).get(0).value='';
	$('textarea',this.div).get(0).value='';
	$('input[name="business"]',this.div).get(0).value=id;
	this.div.show();
	this.p.p.dim.div.css('z-index','35');
},
hide:function(){
	this.p.p.dim.div.css('z-index','10');
	this.div.hide();
	if(this.hidedim) this.p.p.dim.hide();
},
told:function(){
	this.hide();
},
send:function(){
	var cc={
		'name':[/./,'your Name'],
		'email':[/^([-a-zA-Z0-9_.+]+@[-a-zA-Z0-9_]+(\.[-a-zA-Z0-9_]+)+)?$/,'your Email Address'],
		'phone':[/^(\+?[0-9 ]*(\(\d+\))?[0-9 ]+)?$/,'your Phone Number'],
		'enquiry':[/./,'your Message']
	};
	var frm=$('form',this.div).get(0).elements,err='',foc=false;
	for (x=0; x<frm.length; x++) {
		if(frm[x].type=='text' || frm[x].type=='textarea') {
			if(frm[x].value=='') {
				err+="\nPlease enter "+cc[frm[x].name][1];
				if(!foc) foc=frm[x];
			} else {
				if(!cc[frm[x].name][0].exec(frm[x].value)) {
					err+="\nPlease enter "+cc[frm[x].name][1]+" again. There appears to be a problem with it";
					if(!foc) foc=frm[x];
				}
			}
		}
	}
	if(foc){
		alert("Sorry, please correct the following and then try again:"+err);
		foc.focus();
		return;
	}
	var o=this;
	this.p.p.load.show();
	this.p.p.dim.div.css('z-index','60');
	$.ajax({
		type:'POST',
		url:'/business.nb',
		data:{
			name:frm[0].value,
			email:frm[1].value,
			phone:frm[2].value,
			enquiry:frm[3].value,
			business:frm[4].value
		},
		dataType:'text',
		error:function(){ frm[0].form.submit(); },
		success:function(){ o.p.p.load.hide(); o.hide(); alert("Thankyou, your message has been sent."); },
		timeout:10000
	});
}
}
function initmap() {
	var ele=$('#map div').get(0);
	if(ele) {
		var center=new google.maps.LatLng(-32.668127,151.587285);
		var map=new google.maps.Map(ele,{
			zoom:10,
			center:center,
			mapTypeId:google.maps.MapTypeId.ROADMAP,
			mapTypeControl:false
		});
		var mkr=new google.maps.Marker({
			position:center,
			map:map
		});
		function printcontrol(map) {
			this.div=$('<div class="print"><span>Print</span></div>');
			this.div.bind('click',function() {
				var ll=map.getCenter();
				window.open("/contact_us.form?p="+ll.lat()+","+ll.lng()+","+map.getZoom(),'printlocation','width=300,height=100,scrollbars=no');
			});
			this.div.appendTo('#map');
		}
		new printcontrol(map);
		function expandcontrol(map) {
			var o=this;
			this.map=map;
			this.ie6=/MSIE 6/.test(navigator.userAgent);
			this.dim=new dim(this);
			this.state=false;
			this.dim.register(this);
			this.div=$('<div class="expand"><span>Expand</span></div>');
			this.div.bind('click',function() {
				o.toggle();
			});
			$(window).bind('resize',function() {
				if(o.state) {
					$('#map').css({
						top:Math.floor(($(window).height()-452)/2),
						left:Math.floor(($(window).width()-502)/2)
					});
				}
			});
			this.div.appendTo('#map');
		}
		expandcontrol.prototype={
			toggle:function(){
				if(this.state) {
					this.dim.hide();
				} else {
					this.open();
				}
			},
			open:function(){
				this.state=true;
				this.dim.show();
				var ll=this.map.getCenter();
				$('#map').css({
					position:'fixed',
					top:Math.floor(($(window).height()-452)/2),
					left:Math.floor(($(window).width()-502)/2),
					width:500,
					height:450,
					zIndex:100
				});
				$('#map div.inner').css({
					width:500,
					height:450
				});
				$('span',this.div).addClass('down');
				google.maps.event.trigger(this.map,'resize');
				this.map.setCenter(ll);
			},
			told:function(){
				this.close();
			},
			close:function(){
				this.state=false;
				var ll=this.map.getCenter();
				$('#map').css({
					position:'relative',
					top:0,
					left:0,
					width:210,
					height:290
				});
				$('#map div.inner').css({
					width:210,
					height:290
				});
				$('span',this.div).removeClass('down');
				google.maps.event.trigger(this.map,'resize');
				this.map.setCenter(ll);
			}
		}
		new expandcontrol(map);
	}
}
function submitconf(frm){
	var cc={
		'name':[/./,'your Name'],
		'email':[/^([-a-zA-Z0-9_.+]+@[-a-zA-Z0-9_]+(\.[-a-zA-Z0-9_]+)+)?$/,'your Email Address'],
		'phone':[/^(\+?[0-9 ]*(\(\d+\))?[0-9 ]+)?$/,'your Phone Number']
	};
	var err='',foc=false;

	if(!frm['agree'].checked) {
		alert("Sorry, you must agree to the confidentiality agreement before you can proceed.");
		return false;
	}
	frm=frm.elements;
	for (x=0; x<frm.length; x++) {
		if(frm[x].type=='text') {
			if(frm[x].value=='') {
				err+="\nPlease enter "+cc[frm[x].name][1];
				if(!foc) foc=frm[x];
			} else {
				if(!cc[frm[x].name][0].exec(frm[x].value)) {
					err+="\nPlease enter "+cc[frm[x].name][1]+" again. There appears to be a problem with it";
					if(!foc) foc=frm[x];
				}
			}
		}
	}
	if(foc){
		alert("Sorry, please correct the following and then try again:"+err);
		foc.focus();
		return false;
	}
	return true;
}

