$(document).ready(function() {
	
	// $(document).log("ready");
	
	var qString = document.location.toString();
	
	$("a[rel=gal].fancy").fancybox({
		'overlayOpacity' : '0.7',
		'transitionIn' : 'elastic',
		'transitionOut' : 'elastic',
		'padding' : 0,
		'type' : 'image',
		'cyclic' : true,
		'margin' : 100,
		'titlePosition' : 'over',
		'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">' + title + ' &nbsp;&nbsp;&nbsp;[ ' + (currentIndex + 1) + ' / ' + currentArray.length + ' ]</span>';
		}
	});
	
	/* dialog window */
	$("a[href=#login]").click(function(e) {
		e.stopPropagation();
		centerPopup();
		loadPopup('login');
		$("#loginEmail").focus();
		return false;
	});
	$("a[href=#lostpw]").click(function(e) {
		e.stopPropagation();
		centerPopup();
		loadPopup('lostpw');
		$("#lostpwEmail").focus();
		return false;
	});
	
	$("#popupBoxClose").click(function() {
		disablePopup();
	});
	$("#backgroundPopup").click(function() {
		disablePopup();
	});
	$(document).keypress(function(e) {
		if(e.keyCode==27 && popupStatus==1) {
			disablePopup();
		}
	});
	
	$("#popupBox .login a[href=#doLogin]").click(function(e){
		e.stopPropagation();
		doLogin();
		return false;
	});
	$("#popupBox .login form.content input").keypress(function(e) {
		if(e.keyCode==13 && popupStatus==1) {
			doLogin();
		}
	});
	
	$("#popupBox .lostpw a[href=#doLostPw]").click(function(e){
		e.stopPropagation();
		doLostPw();
		return false;
	});
	$("#popupBox .lostpw form.content input").keypress(function(e) {
		if(e.keyCode==13 && popupStatus==1) {
			doLostPw();
		}
	});
	/* dialog window */
	
	if ($.browser.msie) {
		$("div.invisible *").css("opacity","0.5");
	} else {
		$("div.invisible").css("opacity","0.5");
	}
	
	/*
	// apply to div#logo, undo fix, then apply the fix again 
	$('img[@src$=.png], div#logo').ifixpng().iunfixpng().ifixpng(); 
	*/
	
	/*
	$("img[src$=.png], #box-details .details").pngfix();
	
	$("input, select, textarea").focus(function () {
		$(this).addClass("selected");
	});
	$("input, select, textarea").blur(function () {
		$(this).removeClass("selected");
	});
	*/
	
	// google chrome frame
	/*
	if ($.browser.msie) {
		if ($.browser.version.substr(0,1)<"8") {
			CFInstall.check({
				preventPrompt: true,
		    onmissing: function(){
					$('<div></div>').html('Az oldal helyes megjelenítéséhez az Internet Explorer legújabb verziójára, vagy a Google Inc. által fejlesztett Google Chrome Frame plugin-re van szükség!').activebar({
						'path': 'includes/js/activebar/',
						'url': 'http://www.google.com/chromeframe/eula.html'
					});
		    }
			});
		}
	}
	*/
	/*
	if ($.browser.msie) {
		if ($.browser.version.substr(0,1)<"8") {
			$(function() {
				$('<div></div>').html('Az oldal helyes megjelenítéséhez az Internet Explorer legújabb verziójára van szükség! Kattintson ide, a böngésző frissítéséhez...').activebar({
					'path': 'includes/js/activebar/',
					'url': 'http://www.microsoft.com/hun/windows/internet-explorer/worldwide-sites.aspx'
				});
			});
		}
	}
	*/
	
	/* yamm widget */
	new Yamm.Widget({
		'app' : 'yamm',
		'divId' : 'yamm-widget',
		'q' : 'SEARCH:pen',
		'noMentions' : true,
		'noLinks' : false,
		'wordBlacklist' : true,
		'width' : '250',
		'height' : '200',
		'mainTitle' : 'PEN 2010 csiripfal',
		'subTitle' : '',
		'footer' : '<a href="http://yamm.hu/pen2010" target="_blank">Kövesd a Pécsi Egyetemi Napokat a Yamm-on!</a>',
		'avatars' : true,
		'theme' : 
		{
		  'shell' : 
		  {
		    'color' : '000000',
		    'linkColor' : '008990',
		    'bgColor' : 'E6E6E6'
		  },
		  'tweet' : 
		  {
		    'color' : '666666',
		    'linkColor' : '014977',
		    'bgColor' : 'ffffff'
		  },
		  'customCSS' : '',
		  'customHTMLFormatter' : ''
		},
		'charset' : 'UTF-8'
	}).start();

});

$(window).unload(function () {
	
});