function init_page( ) {

  // png fix
  if ( typeof(pngfix) == 'function' ) {
    pngfix();
  }

}

function open_window( url, width, height, left, top, extra_params ) {

  extra_params = extra_params || 'dependent=no,directories=no,location=no,menubar=no,personalbar=no,status=no,resizable=yes,scrollbars=yes';
  width  = width  || 450;
  height = height || 600;
  if ( !left && !top ) {
    var screenX = 30; var screenY = 30; var screenTop = 30; var screenLeft = 30;
    if ( typeof(window.screenLeft) != 'undefined' ) {
    	left = screenLeft + window.screenLeft;
    	top	 = screenTop + window.screenTop;
    } else {
    	left = screenX + window.screenX;
    	top	 = screenY + window.screenY;
    }
  }

  window.open( url, 'popupWindow', 'width='+width+',height='+height+',left='+left+',top='+top+','+extra_params);

}

function toggle_send_to_friend(bon_id) {
  if ( document.getElementById('bon'+bon_id+'_send_to_friend_div').style.display == 'none')  { 
    document.getElementById('bon'+bon_id+'_send_to_friend_div').style.display='block'; 
  } 
  else {
    document.getElementById('bon'+bon_id+'_send_to_friend_div').style.display='none';
  }
}

function ignore_mouse_down(e) {
  e = (e) ? e : window.event;
  target = e.target || e.srcElement;

  return false;

}



function draw_my_google_map(id,address) {
	var image = '/gfx/marker.gif';
	var geocoder = new google.maps.Geocoder();
	geocoder.geocode( { 'address': address}, function(results, status) {
		if (status == google.maps.GeocoderStatus.OK) {
			var myOptions = {
				zoom: 16,
				center: results[0].geometry.location,
				mapTypeId: google.maps.MapTypeId.ROADMAP
			}
			var map = new google.maps.Map(document.getElementById("map_canvas_"+id), myOptions);
			var marker = new google.maps.Marker({
					position: results[0].geometry.location, 
					map: map,
					animation: google.maps.Animation.DROP,
					icon: image
			});
		}
		else {
			document.getElementById("map_canvas_"+id).innerHTML = status;
		}
	});	
}

function draw_my_google_map_from_lat_lng(id,lat,lng) {
	var image = '/gfx/marker.gif';
	var my_latlng = new google.maps.LatLng(lat, lng); 
	var geocoder = new google.maps.Geocoder();
	var myOptions = {
		zoom: 15,
		center: my_latlng,
		mapTypeId: google.maps.MapTypeId.ROADMAP
	}
	var map = new google.maps.Map(document.getElementById("map_canvas_"+id), myOptions);
	var marker = new google.maps.Marker({
			position: my_latlng, 
			map: map,
			animation: google.maps.Animation.DROP,
			icon: image
	});
}

