// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function updateEmbedCode(host, w, h) {
	var frame_start = '<div style="margin-top:2px;margin-bottom:2px;width:' + w + 'px;font-family:Lucida Grande,Bitstream Vera Sans,Lucida Sans Unicode,sans-serif;font-size:9px;color:#2E4C2D;background-color:#ffffff;border:2px solid #3C7606;font-style:normal;text-align:right;padding:0px;"><iframe src="';
 
	var frame_end = '" width="' + w + '" height="' + h + '" border="0" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"></iframe><br />Ein Service von <a style="color:#47830E; text-decoration:underline;" href="http://www.biodieselinfo.at/" target="_top">Biodieselinfo.at</a>&nbsp;</div>'
        
	var frame_src = host + '/widget?width=' + w + '&height=' + h;

	$('embed_link').value =  frame_start + frame_src + frame_end ;
}


function changeSize(host, width, height) {
	$('map_canvas').style.width = width+'px';
	$('map_canvas').style.height = height+'px';
	$('preview').style.width = width+'px';
	$('preview').style.height = height+'px';
	updateEmbedCode(host, width, height);
	MapToolkit.maps['map_canvas'].config.map.size.width = width;
	MapToolkit.maps['map_canvas'].config.map.size.height = height;
	MapToolkit.maps['map_canvas'].resize();
}


function changeCustom(host) {
	if ($('size-custom').checked) {
		changeSize(host, $('width_field').value, $('height_field').value);
	}
}



