function insert_flash (file,width,height,flashvars,winmode,id,classs,alternative) {
	var shockmode = false;
	if(id!=''){
		id=" id=\""+id+"\"";
	}
	if(classs!=''){
		classs=' class="'+classs+'"';
	}
	var mimetype = 'application/x-shockwave-flash';

	if (navigator.mimeTypes) {
		if (navigator.mimeTypes[mimetype] != null) {
			if (navigator.mimeTypes[mimetype].enabledPlugin != null) {
				shockmode = true;
			}
		}
	}
	if (!shockmode && navigator.appVersion.indexOf('MSIE') !=-1) {
		shockmode = true;
	}
	if (shockmode) {
		document.write("<object"+id+" type=\"application/x-shockwave-flash\" data=\""+file+"\""+classs+" width=\""+width+"\" height=\""+height+"\">");
		document.write("<param name=\"movie\" value=\""+file+"\" />");
		document.write("<param name=\"menu\" value=\"false\" />");
		document.write("<param name=\"wmode\" value=\""+winmode+"\" />");
		if(flashvars!=''){
			document.write("<param name=\"flashvars\" value=\""+flashvars+"\" />");
		}
		document.write(alternative);
		document.write("</object>");
	}
	else {
		document.write(alternative);
	}
}

function getFlashMovieObject(movieName)
{
	if (window.document[movieName])
	{
		return window.document[movieName];
	}
	if (navigator.appName.indexOf("Microsoft Internet")==-1)
	{
		if (document.embeds && document.embeds[movieName])
			return document.embeds[movieName];
	}
	else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
	{
		return document.getElementById(movieName);
	}
}

function selectArticlesBox(box)
{
	$('#hp-third-block > .headline > ul > li').each(function(){
		$(this).removeClass('active');
		$('#'+this.id+'-content').hide();
		$('#'+this.id+'-button').hide();
	});
	$('#box-'+box).addClass('active');
	$('#box-'+box+'-content').show();
	$('#box-'+box+'-button').show();

}

function jumpToSite(sl)
{
	if (sl.value != '')	newWin(sl.value);
}

// just new window
function newWin(URL) {
	var okno = window.open(URL,'blank');
	okno.focus();
	return false;
}

function loadGmapScript(callback) {
	var script = document.createElement("script");
	script.type = "text/javascript";
	script.src = "http://maps.google.com/maps/api/js?sensor=false&callback="+callback+"&language="+language;
	document.body.appendChild(script);
}

function display (href, alt) {
	$.fancybox({
		'href': href,
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600,
		'speedOut'		:	200,
		'hideOnContentClick': true,
		'overlayShow'	:	false,
		'title' : alt
	});
}

function cngStationsMapLoader()
{
	var latlng = new google.maps.LatLng(50.082391,14.422112);
	var myOptions = {
		zoom: 11,
		center: latlng,
		mapTypeControl: true,
		mapTypeControlOptions: {
			style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
		},
		navigationControl: true,
		navigationControlOptions: {
			style: google.maps.NavigationControlStyle.SMALL
		},
		mapTypeId: google.maps.MapTypeId.ROADMAP
	};
	var map = new google.maps.Map(document.getElementById("gmap-holder"),myOptions);
	dt = new Date();//alert(document.location.host);
	var markersLayer = new google.maps.KmlLayer("http://"+ document.location.host + "/maps/cng-stations/&stamp="+dt.getTime(), {
		preserveViewport:true
	});
	markersLayer.setMap(map);

	google.maps.event.addListener(markersLayer, 'click', function(kmlEvent) {
		var text = kmlEvent.featureData.description
		
		if (($.browser.mozilla != undefined) && $.browser.mozilla)
		{
			var js = '$("div a[href$=.jpg],a[href$=.png],a[href$=.gif]").attr("rel", "photogallery").fancybox();';
			text = '<script type="text/javascript">$(document).ready(function(){' + js + '});</script>' + text;
		}
		else {
			var regexp = /<a href="([^"]*)" (target="_blank")><img src="([^"]*)" alt="([^"]*)" width="([0-9]*)" height="([0-9]*)"><\/a>/g;
			text = text.replace(regexp, '<a href="#" onclick="javascript:display(\'$1\', \'$4\');" rel="photogallery"><img src="$3" alt="$4" width="$5" height="$6"></a>');
		}
		kmlEvent.featureData.description = text;
		//alert(kmlEvent.featureData.description);
	});
}
