function nopicsave()
	{
	alert('Amennyiben képekre van szüksége, kérjük szíveskedjen felvenni velünk a kapcsolatot a megadott elérhetőségek valamelyikén! Köszönjük!');
	return false;
	}

function shareContent(share, url) 
	{
	share_url='';

	a = document.createElement('a');
	a.href = url ? url : document.location.href;

	url_href=a.href;
	url_pathname = a.pathname.indexOf('/')!=0 ? '/'+a.pathname : a.pathname ; /// IE hiba miatti '/' korrekció...
	url_search = a.search;

	share_title = encodeURIComponent('Cirko Gejzír Mozi: ' + $("H1").text());

	if (share=='blogger')
		{
		share_url='http://www.blogger.com/blog_this.pyra?t&u=' + escape(url_href) + '&n=' + share_title + '&pli=1';
		}
	else if (share=='email')
		{
		openwindow('/misc/sendbyemail.php?pageurl='+escape(url_pathname)+'&fullurl='+escape(url_pathname+url_search)+'&'+url_search.substring(1)+'&printpage=1', '629','323','no');
		}
	else if (share=='facebook')
		{
		share_url='http://www.facebook.com/share.php?u='+escape(url_href);
		}
	else if (share=='foursquare')
		{
		share_url='https://foursquare.com/remote_todo?vid=2847885&color=light';
		}
	else if (share=='gmail')
		{
		share_url='http://www.google.com/buzz/post?url=' + escape(url_href);
		}
	else if (share=='twitter')
		{
		share_url='http://twitter.com/home?status=' + share_title + ' ' + escape(url_href);
		}
	else if (share=='print')
		{
		openwindow('/misc/printpage.php?pageurl='+escape(url_pathname)+'&'+url_search.substring(1)+'&printpage=1', '720','450', 'yes');
		}
	else if (share=='stumbleupon')
		{
		share_url='http://www.stumbleupon.com/submit?url=' + escape(url_href) + '&title=' + share_title;
		}
	else if (share=='paypal')
		{
		share_url='https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=' + escape('Cirko Film – Másképp Alapítvány') + '&item_name=' + escape('Támogatás') + '&no_shipping=1&return=' + escape(url_href) + '&cancel_return=' + escape(url_href) + '&currency_code=HUF&tax=0&lc=HU&bn=PP-DonationsBF';
		///$.post("https://www.paypal.com/cgi-bin/webscr", { cmd: "_s-xclick", hosted_button_id: "JTEXWHELM6M58" } );
		}

	if (share_url) window.open(share_url);
	} 


function openwindow(pageurl,width,height,scroll,winname) 
	{
	showscroll=(scroll!='yes' && scroll!=true) ? true : false;
	$("#bpopup_popup").html('<iframe src="'+pageurl+'" width="'+width+'" height="'+height+'" frameborder="no"></iframe><span class="bClose" style="display:none;"></span>');
	$("#bpopup_popup").openPopup({amsl:0, followSpeed:100, fadeSpeed: 500, scrollBar:showscroll, fixed:true, modalClose:true});
	}


function showContent(id,txtshow,txthide)
	{
	$("#"+id).slideToggle(500);

	src = $("#"+id+"_img").attr("src");
	src = $("#"+id).css("height")=="1px" ? src.replace('plus','minus') : src.replace('minus','plus');
	$("#"+id+"_img").attr("src", src);

	if (txtshow && txthide)
		{
		txt = $("#"+id+"_div").html();
		txt = $("#"+id).css("height")=="1px" ? txt.replace(txtshow,txthide) : txt.replace(txthide,txtshow);
		$("#"+id+"_div").html(txt);
		}
	}


content_loaded=Array();
newscript=Array();
function loadContent(contentid,contentparam,forcereload,outputid,lang,onloadfunct)
	{
	outputid=(outputid ? outputid : contentid);
	contentparam=contentparam ? contentparam : '';
	if (content_loaded[outputid]!=1 || forcereload==1)
		{
		if (lang=='en' || contentparam.indexOf('lang=en')!=-1)
			{
			loading_text='Loading...';
			}
		else if (lang=='de' || contentparam.indexOf('lang=de')!=-1)
			{
			loading_text='Loading...';
			}
		else
			{
			loading_text='Betöltés...';
			}
		document.getElementById(outputid).innerHTML='<br/><br/><center>'+loading_text+'</center>';

		content_loaded[outputid]=1;

		sitemapidparam=sitemap_id ? '&sitemap_id='+sitemap_id : '';
		contentidparam='&contentid='+contentid;
		langparam=lang ? '&lang='+lang : '';
		contenturl='/inc/functions/content_'+contentid+'.php?'+(contentparam.indexOf('contentid')==-1 ? sitemapidparam+contentidparam+langparam+'&' : '') + contentparam;

		if (window.XMLHttpRequest) {xmlhttp=new XMLHttpRequest();} else {	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
		if (!xmlhttp && typeof xmlhttprequest!='undefined') {xmlhttp = new xmlhttprequest();} 
		xmlhttp.onreadystatechange = function (e)
			{
			if (xmlhttp.readyState == 4)
				{
				content=xmlhttp.responseText;
				document.getElementById(outputid).innerHTML=content;
				if (onloadfunct) onloadfunct();
				}   
			};
		xmlhttp.open('GET',contenturl,true);
		xmlhttp.send();
		}

	return true;
	}



function zoomimg() /// itt ezt nem használjuk
	{
	return false;
	}


function showGallery(img,database_name,database_id)
	{
	gallery_params=(typeof gallery_params==='undefined') ? '' : gallery_params;

	/// manuálisan meghívva
	if (database_name)
		{
		gallery_url='/gallery/gallery.php?'+gallery_params+'&database_name='+database_name+'&database_id='+database_id;
		}
	/// képre katt
	else
		{
		img=this;

		reg=/(id\=\d+\&ext\=[^&]+|id\=\d+|database_name\=.+\&database_id\=[^&]+)/g;
		imgid=reg.exec(img.src);

		reg2=/(http:\/\/[^\/]+)\//g;
		imgroot=reg2.exec(img.src);

		reg3=/\&type\=([^&]+)/g;
		imgtype=reg3.exec(img.src);
		imgtype=imgtype ? '&type='+imgtype[1] : '';

		if (imgroot[1].indexOf('cirkofilm')!=-1) /// saját kép?
			{
			gallery_url='/gallery/gallery.php?'+gallery_params+'&'+imgid[1]+imgtype+(img.src.indexOf('video')!=-1 ? '&media=video' : '');
			imgid=reg.exec(''); /// FF hiba miatt...
			imgroot=reg2.exec(''); /// FF hiba miatt...
			imgtype = reg3.exec(''); /// FF hiba miatt...
			}
		}
	window.open(gallery_url);
	///openwindow(gallery_url,1138,714,0,'gallery');
	///$("#bpopup_popup").html('<iframe src="'+gallery_url+'" width="1138" height="800" frameborder="no"></iframe><span class="bClose" style="display:none;"></span>');
	/// ez scroll nélküli: $("#bpopup_popup").openPopup({amsl:0, followSpeed:100, fadeSpeed: 500, scrollBar:true, fixed:true, modalClose:false, modalColor:'rgb(34,34,34)', opacity: 1.0});
	///$("#bpopup_popup").openPopup({amsl:0, follow:false, fadeSpeed: 500, scrollBar:true, fixed:false, modalClose:false, modalColor:'rgb(34,34,34)', opacity: 1.0});

	}



function showMedia(objid,id,width,height,type,autostart)
	{
	if (!objid || !id) return;

	media_servers = new Array();
	media_servers[0]="mediaserver12_new.quatra.net";
	media_server=media_servers[0];
	media_path='cirkofilm.hu';

	width_container = document.getElementById(objid).offsetWidth;
	width_max = 640;
	width_orig = width;
	width = width ? width : width_max;
	width = Math.min(width_container, width_max, width);

	height_max = 512;
	height = height ? height : height_max;
	height = Math.round((width/width_orig)*height);

	type = type ? type : 'video';
	th = width + 'x' + height;
	autostart = autostart==null ? false : autostart;

	if (type == 'video')
		{
		media_file = 'videos/' + id + '.mp4';
		}
	else
		{
		media_file = 'videos/' + id + '.mp3';
		}

	jwplayer(objid).setup(
		{
		width: width,
		height: height,
		bufferlength: 2,
		autostart: autostart,
		stretching: 'fill',
		controlbar: 'over',
		'controlbar.margin': 0,
		'controlbar.idlehide': true,
		frontcolor: 'FFFFFF',
		backcolor: 'EC1C24',
		lightcolor: 'FFFFFF',
		'logo.file': '/images/logo_stat.gif',
		'logo.position': 'top-right',
		'logo.out': '0.7',
		'logo.timeout': 10,
		'logo.link': 'http://www.cirkofilm.hu',
		image: '/image/video.php?id=' + id + '&th=' + th,
		modes:
			[
				{
				type: 'flash',   
				src: "/video/player.swf",   
				config:
					{
					streamer: 'rtmp://' + media_server + '/' + media_path,
					file: media_file,
					provider: 'rtmp'
            		}  
          		},
          		{
          		type: 'html5',
				config:
					{  
					file: 'http://' + media_server + '/' + media_path + '/_definst_/' + media_file + '/playlist.m3u8'
          			}
          		},
				{
				type: 'download',
				config:
					{
					file: 'rtsp://' + media_server + '/' + media_path + '/_definst_/' + media_file
              	} 
				} 
     		]
		});
	}



function doFilter()
	{
	querystr='?';

	for(i=0;i<doFilter_fieldnames.length;i++)
		{
		field=document.getElementsByName(doFilter_fieldnames[i])[0];
		querystr+='&'+doFilter_fieldnames[i]+'='+field.value;
		}

	document.location=querystr;
	}


function doABC(letter)
	{
	document.getElementsByName('letter')[0].value=letter;
	doFilter();
	return void(0);
	}


processing_map_id=0;
function showMap(id)
	{
	if (id && !content_loaded['map_'+id]) /// load map
		{
		processing_map_id=id;
		loadContent('map', 'id='+id, 0, 'map_'+id, '', showMap); /// load content
		}
	else if (processing_map_id) /// setup the loaded map
		{
		/// create map and markers
		$('#map_area_'+processing_map_id).goMap(
			{
			maptype: 'ROADMAP',
			mapTypeControlOptions: {position: 'TOP_RIGHT',style:'DROPDOWN_MENU'},
			markers: [{id:map_markers[processing_map_id]['id'],latitude:map_markers[processing_map_id]['lat'],longitude:map_markers[processing_map_id]['lng'],title:map_markers[processing_map_id]['title']}]
			});
		$.goMap.fitBounds();
		$.goMap.createListener({type:'marker', marker:map_markers[processing_map_id]['id']}, 'click', function() {document.location=map_markers[$(this).data('id')]['url'];});

		/// setup the hide button
		$("#map_toggle_"+processing_map_id).click(
			function() 
				{
				$(this).parent().slideUp(500);
				$(this).parent().find("[id^='map_area_']").slideUp(500);
				});

		processing_map_id=0;
		}
	else /// show (already loaded) map
		{
		$('#map_div_'+id+',#map_area_'+id).slideDown(500);
		}
	}

/// onload
$(document).ready(function()
	{
	/// képeket ne lehessen jobb klikkelni
	$("IMG").bind("contextmenu",function(e)
		{
		return false;
		});

	$('#premiers_scroll').serialScroll(
		{
		items:'.text',
		prev:'#premiers_scroll_left',
		next:'#premiers_scroll_right',
		axis:'x',
		duration:500,
		force:true,
		start:0,
		stop:true,
		lock:false,
		interval:4000,
		cycle:true, /// pull back once you reach the end
		/// jump: true, /// click on the images to scroll to them
		onBefore:function(e, elem, $pane, $items, pos)
			{
			visibility=pos ? 'visible' : 'hidden';
			$('#premiers_scroll_left').css('visibility',visibility);
			visibility=($items.length-premiers_scroll_visible_elements-pos)>0 ? 'visible' : 'hidden';
			$('#premiers_scroll_right').css('visibility',visibility);
			}
		});
	///$('#premiers_scroll').trigger('goto', 0); /// az aktívra ugrik betöltéskor
	});
