function popup(url,w, h) {
	window.open(url,"_blank",'width='+w+',height='+h+',scrollbars=no,status=no,menubar=no,location=no,resizable=no');
	return false;
}

$(document).ready(function() {


	/* Page tools */
	
	$("#email").click(function(){
		location.href='mailto:?SUBJECT=Basin Street&BODY=Below%20is%20a%20web%20page%20from%20The%20Theatre%20District%20development%20in%20Petaluma,%20CA%20you%20may%20be%20interested%20in: %0D%0A%0D%0ATo%20view%20the%20page,%20visit%20'+escape(location.href)+'%0D%0A%0D%0A-------------------------------------%0D%0AABOUT%20BASIN%20STREET%20PROPERTIES%0D%0AWith%20more%20than%2030%20years%20of%20experience%20in%20the%20Northern%20California%20Bay%20Area,%20Basin%20Street%20Properties%20is%20recognized%20as%20one%20of%20the%20top%20commercial%20property%20owners%20and%20developers%20in%20Sonoma%20and%20Napa%20counties.%0D%0A%0D%0AContact%20Information%0D%0A201%201st%20Street,%20Suite%20100%0D%0APetaluma,%20CA%2094952%0D%0ATel:%20707.795.4477%0D%0AFax:%20707.795.6283';
		return false;
	});
	$("#print").click(function(){
		print();
		return false;
	});
	
	/* Prepare external links and video pop ups */
	
	$("a").each(function(i){
		if($(this).attr("rel")=="external")
			$(this).attr("target","_blank");
	});
	
	
	/* Linkareas  */
	
	$(".linkarea").hover(function(){
		$(this).css({ cursor: 'pointer' });
	},function(){
	});
	
	$(".linkarea").click(function(){
		document.location = $(this).find("a").attr("href");
	});
	
	if ($("#eventemail").length > 0) {
		$("#eventemail").RSV({ displayType: 'alert-all', rules: ["required,mb-nnkj-nnkj,Please enter your email address.","valid_email,mb-nnkj-nnkj,Please enter a valid email address."]});
	}
	
	/* Facebox */
	
	$.facebox.settings.opacity = 0.15;

	$("a[rel*=facebox]").facebox();
	
	$(document).bind('reveal.facebox', function() { 
		
	
		function pagerFactory(idx, slide) {
			return '<li><a href="#"><img src="images/gallery/'+clicker+'/'+(idx+1)+'_thumb.jpg" alt="" /></a></li>';
		};
	
		$("#facebox div.gallery").cycle({ 
			fx:     'fade', 
			speed:  'fast', 
			timeout: 0, 
			pager:  '#facebox ul.nav',
			pagerAnchorBuilder: pagerFactory
		});
		
		$("#facebox form select").change(function() {
			$("#"+$(this).find("option:selected").val()).click();
		});
	
	});
	
});