$(document).ready (function () {

	readymenu();
	
	setInterval(size , 10);
	
	/*$("#pic_detail .photo_placeholder .image img").load(function() {
        
    });*/
	
    if (window.location.toString().indexOf("diak")!=-1) {
        var color_type = 'sarga';
    }if (window.location.toString().indexOf("kornyezetineveles")!=-1) {
        var color_type = 'kek';
    }if (window.location.toString().indexOf("kornyezetbarat")!=-1) {
        var color_type = 'zold';
    }if (window.location.toString().indexOf("vallalkozas")!=-1) {
        var color_type = 'szurke';
    }

	//menu = getEncoded(menu);
	$("div#flashVideo").flashHack ({

	/* attribútumok */

	source: "/swf/simpleplayer-0.9.1.swf",
	width: "430",
	height: "360"

  }, {
	/* paraméterek */
	config: "config.xml"
  });
 /*$("div#flashcontent").flashHack
 ({
  source: "/swf/menu.swf",
  width: "100%",
  height: "100%",
  scale: "noscale",
  wmode: "transparent",
  salign: "lt",
  allowscriptaccess: "always",
  swliveconnect: "true",
  ident: "hulladekboltermek",
  allownetworking: "all",
  query: false
 },
  {
   paramXml : menu,
   menuColor : color_type
	 });
	 */
	$("div#foto2010_banner").flashHack
		({
			source: "/swf/fotopalyazat2010.swf",
			width: "283px",
				height: "60px"
		});

	 
	 
    $("a span").css ({
    display: "none"
    });
    $("div#leftbar div.menu ul li a").flashText ({
    source: "/swf/verdana-1.0.0.swf"
    });
    $("div#content div.fancybox p.title").flashText ({
    source: "/swf/verdana-1.0.0.swf"
    });
    $("div#content div.welcome p.title").flashText ({
    source: "/swf/verdana-1.0.0.swf"
    });
    $("div#content div.imagelist h3").flashText ({
    source: "/swf/verdana-1.0.0.swf"
    });
    $("div#content div.linklist h3").flashText ({
    source: "/swf/verdana-1.0.0.swf"
    });
    $("div#content div.AutoNewsFeed h3").flashText ({
    source: "/swf/verdana-1.0.0.swf"
    });
    $("div#article h1 ").flashText ({
    source: "/swf/verdana-1.0.0.swf"
    });
    $("div#article div.intro p ").flashText ({
    source: "/swf/verdana-1.0.0.swf"
    });
	
});

function size() {
	height = $("#pic_detail .image").height();
	$(".photo_placeholder_m").height(height);
}

function getEncoded (ftValue)
{
 var ftString = new String ();
 $.each (ftValue.split (""), function (ftKey, ftValue)
 {
  var ftChar = ftValue.charCodeAt (0);
  if (ftChar < 128) { ftString += String.fromCharCode (ftChar); }
  else if (ftChar < 2048) { ftString += String.fromCharCode (((ftChar >> 6) | 192), ((ftChar & 63) | 128)); }
  else { ftString += String.fromCharCode (((ftChar >> 12) | 224), (((ftChar >> 6) & 63) | 128), ((ftChar & 63) | 128)); }
 });
 return ftString;
}


function hulladekboltermek_DoFSCommand(FSCmd, FSArg)
{
 //alert(FSCmd+'--'+FSArg);
 if(FSCmd=="mainMenuHeight") {
    mainh = parseInt(FSArg)+10;
    $('#leftbar .loginbox').css({marginTop:mainh+'px'});
    $('#flashcontent').css({height:mainh+'px'});
 }
 if(FSCmd=="originalSize")
 {
  $('#flashcontent').css({height:mainh+'px'});
  $('#flashcontent').css({width:'244px'});
 }
 if(FSCmd=="changeSize")
 {
  if (prevCmd != 'mainMenuHeight') {
  	var par = FSArg.split(":");
  	var w = Number(par[0]) + 40;
  	var h = Number(par[1]) + 40;
   	$('#flashcontent').css({height:h+'px'});
  	$('#flashcontent').css({width:w+'px'});
  }
 }
 prevCmd = FSCmd;
}



function PrintPage () {

    PrintWindow = window.open ("", "mywindow1","directories=1,fullscreen=1,location=1,menubar=1,resizable=1,scrollbars=1,status=1,titlebar=1,width=800,height=600");
    PrintWindow.document.write ($('#content').html ());
    PrintWindow.document.write ('<p style="clear:both">Az oldal az alábbi linken érhető el: '+window.location.href+'</p>');

}


/* New JS menu */

var menu_onoff = 0;
		
	function menuanimacio(onoff) {
		
		var meiklehet="";
		
		if (onoff == 0) {
		
			if (menu_onoff == 1) {
			
			meiklehet = 1;
			
			} else if (menu_onoff == 2) {
			
			meiklehet = 2;
			
			};
			
			$(".activatedmenu"+meiklehet).css('display', 'none');
					
		} else if (onoff == 1) {
			
			if (menu_onoff == 0) {
			
			meiklehet = 1;
			
			} else if (menu_onoff == 1) {
			
			meiklehet = 2;
			
			};
			
			$(".activatedmenu" + meiklehet + " li").css('height', '0px');
			$(".activatedmenu" + meiklehet).css('display', 'inline-block');
			$(".activatedmenu" + meiklehet + " li").stop(false, true).animate({height: 28}, 500);

			
		};
		
	};

function menubetuformazas(){

	$("div#flashcontent ul a").css('font-family', '"Verdana"');
	$("div#flashcontent ul a").css('font-style', 'italic');
	$("div#flashcontent ul a").css('font-size', '12px');
	$("div#flashcontent ul a").css('font-weight', 'bold');
	$("div#flashcontent ul a").css('letter-spacing', '-1px');

};

function menumeretallitas(){

	var newmenuheight = $("div#flashcontent").css('height');
	$("div.loginbox").css('margin-top', newmenuheight);

};
	
	
	function readymenu(){

		
		  $("div#flashcontent ul li a").mouseenter(function() {
			  if (menu_onoff == 0) {
			$(this).next('div#flashcontent ul li ul').addClass("activatedmenu1");
			menuanimacio(1);
			$(this).css('background-position', 'bottom');
			$(this).addClass("activatedbut1");
			menu_onoff = 1;
			};
		  });
		  
		  $("div#flashcontent ul li").mouseleave(function() {
			  if (menu_onoff == 1) {
			menuanimacio(0);
			$(".activatedmenu1").removeClass();
			$(".activatedbut1").css('background-position', 'top');
			$(".activatedbut1").removeClass();
			menu_onoff = 0;
			};
		  });
		  
		  $("div#flashcontent ul li ul li a").mouseenter(function() {
			  if (menu_onoff == 1) {
			$(this).next('div#flashcontent ul li ul li ul').addClass("activatedmenu2");
			menuanimacio(1);
			$(this).css('background-position', 'bottom');
			$(this).addClass("activatedbut2");
			menu_onoff = 2;
			};
		  });
		  			
		  $("div#flashcontent ul li ul li").mouseleave(function() {
			 if (menu_onoff == 2) {
			menuanimacio(0);
			$(".activatedmenu2").removeClass();
			$(".activatedbut2").css('background-position', 'top');
			$(".activatedbut2").removeClass();
			menu_onoff = 1;
			};
		  });
		  
		  $("div#flashcontent ul li ul li ul li a").mouseenter(function() {
			  if (menu_onoff == 2) {
			$(this).css('background-position', 'bottom');
			$(this).addClass("activatedbut3");
			menu_onoff = 3;
			};
		  });
		  			
		  $("div#flashcontent ul li ul li ul li").mouseleave(function() {
			 if (menu_onoff == 3) {
			$(".activatedbut3").css('background-position', 'top');
			$(".activatedbut3").removeClass();
			menu_onoff = 2;
			};
		  });

		menubetuformazas();
		menumeretallitas();
  
	};

