function getcoords(cox, coy, em){ 
  if(window.sample) window.document["sample"].SetVariable("cel._x", cox);
  if(window.sample) window.document["sample"].SetVariable("cel._y", coy);
  if(window.sample) window.document["sample"].SetVariable("cel._visible", 1);
  if(document.sample) document.sample.SetVariable("cel._x", cox);
  if(document.sample) document.sample.SetVariable("cel._y", coy);
  if(document.sample) document.sample.SetVariable("cel._visible", 1);
  
  if (em == 0) {
  
    if(window.sample) window.document["sample"].SetVariable("em._visible", 0);
    if(document.sample) document.sample.SetVariable("em._visible", 0);
    
    if(window.sample) window.document["sample"].SetVariable("bem._visible", 1);
    if(document.sample) document.sample.SetVariable("bem._visible", 1);
    
    if(window.sample) window.document["sample"].SetVariable("bfsz._visible", 0);
    if(document.sample) document.sample.SetVariable("bfsz._visible", 0);
  
  } else if (em == 1) {
    
    if(window.sample) window.document["sample"].SetVariable("em._visible", 1);
    if(document.sample) document.sample.SetVariable("em._visible", 1);
    
    if(window.sample) window.document["sample"].SetVariable("bem._visible", 0);
    if(document.sample) document.sample.SetVariable("bem._visible", 0);
    
    if(window.sample) window.document["sample"].SetVariable("bfsz._visible", 1);
    if(document.sample) document.sample.SetVariable("bfsz._visible", 1);
  }
}

/* 3DVALOSAG */

function showHideFlashes(hide) {
	var w = $(window).width();
	var h = $(window).height()
	if (hide) {
//		console.log('adding pedig div...');
		if ($('#nagy-tura-overlay').length == 0) {
			$('body').prepend('<div id="nagy-tura-overlay"></div>');
		}
//		console.log('vanoverlay? ' + $('#nagy-tura-overlay').length);
		$('#nagy-tura-overlay').css({
			'display': 'block',
			'width': '100%',
			'height': '100%',
			'position': 'fixed',
			'background-color' : '#000',
			'opacity' : 0.0,
			'z-index': 99998,
			'left': '0px',
			'top': '0px'
		}).animate({
			opacity: 0.4
		}, 500);

//		console.log('vanoverlay? ' + $('#nagy-tura-overlay').length);

		$('object, embed').addClass('flash-hidden');
		muteWebcam(30);

	} else {
		$('#nagy-tura-overlay').css({
			opacity: 0.0,
			display: 'none'
		});

		$('object, embed').removeClass('flash-hidden');
		muteWebcam(30);
	}
}

function muteWebcam(i) {
	if (i == 0) return;
//	console.log('muting . '+i);
	mute(webcam);
	setTimeout(function() {
		muteWebcam(i-1);
	}, 50)
}

function show3Dvalosag() {
	resize_init(true);
	showHideFlashes(true);
	$('#preloader').css({
		width: '100%',
		height: $(window).height(),
		opacity: 1,
		top: $(window).scrollTop()
	}).click(function() {
		resize_init( false );
		showHideFlashes(false);
		$('#preloader img').remove();
		$('#preloader').css({
			width: '4px',
			height: '4px',
			opacity: 0,
			top: 0
		});
		$('#preloader #preloader_sub').css({
			margin: 0,
			width: '4px',
			height: '4px'
		});
	});
	$('#preloader #preloader_sub').css({
		width: $(window).width() - 40 + 'px',
		height: $(window).height() - 40 + 'px',
		margin: '20px'
	}).click(function() {
		return false;
	});
	$('<img src="/css/images/tour_close.png" id="close-button" alt="bez�r�s" style="margin:6px 20px 0px 0px; z-index: 99999;" />').appendTo('#preloader').click(function() {
		$('#preloader').click();
	});
}
/* END OF 3DVALOSAG */

$(document).ready(function() {

/* 3DVALOSAG */

	// KIADO MENU JS

	if ($.browser.msie) {
		$('div.kiado-holder').css({
			'border' : '1px solid #bbbbbb'
		});
	}

	$('div.kiado-holder div.right-content div.rental-holder img.play-button').each(function() {
		$(this).css({
			left: ($(this).parent().position().left + 100) + "px",
			top: ($(this).parent().position().top + 65) + "px",
			'z-index': 5
		});
	});
	setTimeout(function() {
		if ($.browser.msie) {
			$('div.kiado-holder div.right-content div.rental-holder img.play-button').each(function() {
				$(this).css({
					left: ($(this).parent().position().left + 100) + "px",
					top: ($(this).parent().position().top + 65) + "px",
					display: 'block',
					'z-index': 5
				});
			});
		} else {
			$('div.kiado-holder div.right-content div.rental-holder img.play-button').each(function() {
				$(this).css({
					left: ($(this).parent().position().left + 100) + "px",
					top: ($(this).parent().position().top + 65) + "px",
					'z-index': 5
				}).fadeIn(500);
			});
		}
	}, 500);

	$('div.kiado-holder div.right-content div.rental-holder').each(function() {
		$(this).mouseover(function() {
			$(this).children('img.play-button').attr('src','/images/design/play-button-blue-on.png');
		}).mouseout(function() {
			$(this).children('img.play-button').attr('src','/images/design/play-button-blue-off.png');
		})
	});
	// END OF KIADO MENU JS

	$('#playbutton').click(function() {
		show3Dvalosag();
		return false;
	});

//	$('a.3d-seo-only').attr('href','javascript:;');

	setTimeout(function() {
		$('a.3d-seo-only').click(function() {
			show3Dvalosag();
			if(typeof rwshowtourfrommikrotour == 'function') {
				rwshowtourfrommikrotour();
			}
			return false;
		});
	}, 500);

	$('#new-img').css({
		left : $('#breadcrumb').position().left + 5,
		top : $('#breadcrumb').position().top - 12
	});

	// nagyitos kereso effekt
	if ($('#magnifier-holder').length == 1) {
		$('#magnifier').css({
			left : $('#magnifier-holder').position().left + 240,
			top : $('#magnifier-holder').position().top + 27
		});
		$('#magnifier-holder').mouseover(function() {
			$('#magnifier').attr('src','/images/design/magnifier-on.png');
		}).mouseout(function() {
			$('#magnifier').attr('src','/images/design/magnifier-off.png');
		});
	}

	if ($('div.lurdy-uzletkereso-holder').length == 1) {
		$('#playbutton-icon').css({
			left : $('div.lurdy-uzletkereso-holder').position().left + 215,
			top : $('div.lurdy-uzletkereso-holder').position().top + 40
		});
		$('div.lurdy-uzletkereso-holder').mouseover(function() {
			$('#playbutton-icon').attr('src','/images/design/play-button-on.png');
		}).mouseout(function() {
			$('#playbutton-icon').attr('src','/images/design/play-button-off.png');
		});
	}

	if ($('div#3dvalosag-banner').length == 1) {
		$('#3dvalosag-banner-play').css({
			left : $('div#3dvalosag-banner img.3d-banner-main-img').position().left + 85,
			top : $('div#3dvalosag-banner img.3d-banner-main-img').position().top + 141
		});
		$('div#3dvalosag-banner').mouseover(function() {
			$('#3dvalosag-banner-play').attr('src','/images/design/play-button-on.png');
		}).mouseout(function() {
			$('#3dvalosag-banner-play').attr('src','/images/design/play-button-off.png');
		});
		setTimeout(function() {
			$('#3dvalosag-banner-play').css({
			left : $('div#3dvalosag-banner img.3d-banner-main-img').position().left + 85,
			top : $('div#3dvalosag-banner img.3d-banner-main-img').position().top + 141
		});
		}, 2000);
		
	}
	
	if ($('div.lurdy-pano-holder').length == 1) {
		$('#lurdy-pano-play').css({
			left : $('div.lurdy-pano-holder').position().left + 235,
			top : $('div.lurdy-pano-holder').position().top + 80
		});
		$('div.lurdy-pano-holder').mouseover(function() {
			$('#lurdy-pano-play').attr('src','/images/design/play-button-on.png');
		}).mouseout(function() {
			$('#lurdy-pano-play').attr('src','/images/design/play-button-off.png');
		});
	}
	
/* END OF 3DVALOSAG */

	 $('.note .body').hide();
	 $('.note .title').click(function () {
	 $(this).parent().parent().children('.body').slideToggle('slow');
	 });

	$('.default-value').each(function() {

			 var default_value = this.value;

			 $(this).focus(function(){
						if(this.value == default_value) {
								  this.value = '';
						}
			 });

			 $(this).blur(function(){
						if(this.value == '') {
								  this.value = default_value;
						}
			 });

	});

});


/* 3DVALOSAG */

function resize_init( opened ) {
$(window)
.scroll(function() {
	if( opened ) {
	// ha nyitva van a 3dval�s�g, akkor scrolloz�sra mindig oda igaz�tsa a flasht, ahol �pp �ll a scroll
	$('#preloader').css({
		top: $(window).scrollTop()
	});
	}
	else {
	// ha z�rva van a 3dval�s�g, akkor scrolloz�sra maradjon fent a 3dval�s�g
	$('#preloader').css({
		top: 0
	});
	}
})
.resize(function() {
	if( opened ) {
	// ha nyitva van a 3dval�s�g, akkor �tm�retez�sre a preloader �s a preloader sub is k�vesse
	$('#preloader').css({
		width: '100%',
		height: $(window).height(),
		top: $(window).scrollTop()
	});
	$('#preloader #preloader_sub').css({
		width: $(window).width() - 40 + 'px',
		height: $(window).height() - 40 + 'px',
		margin: '20px'
	});
	}
	else {
	// ha z�rva van a 3dval�s�g, akkor �tm�retez�sre a preloader �s a preloader sub is maradjon kicsi
	$('#preloader').css({
		width: '4px',
		height: '4px',
		top: 0
	});
	$('#preloader #preloader_sub').css({
		width: '4px',
		height: '4px',
		margin: '0px'
	});
	}
});
}

function openhdv(pcid) {
	show3Dvalosag();
	if (typeof pcid != 'undefined') rwshowcomment(pcid);
}

/* END OF 3DVALOSAG */
