function getContent(arg) {
	$.history.load(arg);
	}

function myTimestamp(){
	    tstmp = new Date();    
	    return tstmp.getTime();
}

function initAjaxLinks() {
	$("a.step-link").click(function(){
		var temphash = this.href;
		var hash = hashit(temphash);
		$.history.load(hash);
		return false;
	});
}

function GO(goto){
	MM_goToURL('parent',goto);
	return false;
}

function MM_goToURL() { //v3.0
	  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	}

function CANCEL(goto){
	
	if(confirm("Biztos, hogy megszakitod?")){
		GO(goto);
	}
	else return false;
}

function pageload(hash) {
		if(hash)	{
//			window.scrollTo(0,0);
			motyoX=hash.split('&');

			for (keyVar in motyoX) {
				var info1 = motyoX[keyVar].split('=');
				var info2m = info1[0];
				var info3 = info1[1];
				if(info2m == "mode"){
					var modebu = info3;
				}
				
			}
			
			if(modebu !== "search") 
			{
				if(modebu == "slider")
					{
						var modebu = "slider";
					}
				else
					{
						var modebu = "product";
					}
			}
			
			if(modebu != "slider"){
				
			$("#AJAX").css("opacity","0.5");
	    	$.ajax({
	    			   type:"POST",
	    			   url:baseDir+"webshop/"+modebu,
	    			   data:"ajax=true&modul=webshop&mode="+modebu+"&"+hash,
	    			   success: function(xml){
	    				   $("#AJAX").css("opacity","1");
	    				   $("#AJAX").html(xml);
	    				   initAjaxLinks();
	    		 	   }
	    	});	
					
	    	initAjaxLinks();
			}
		}

	else	{
			document.getElementById("AJAX").style.display = "block";
			}

		}

//searchform






$(document).ready(function(){
	
	
	$.history.init(pageload);
	$("a.step-link").click(function(){
		var temphash = this.href;
		var hash = hashit(temphash);
		$.history.load(hash);
		return false;
	});
	
	
	
	// static text open
	$('#HEADER .contain a').bind("click",function(event){
			event.preventDefault();
			var hr = $(this).attr("href");
			var b = $(".TextSite").css("opacity","0.5");
			$.ajax({
				   type:"POST",
				   url:hr,
				   data:{ajax:"true",modul:"text"},
				   success: function(xml){
					   // $('#slide_kereses #formLoader').hide();
					   	$("#AJAX").html(xml);				 
			 	   }
			});
			return false;
	});
	

	// static text open
	$('em.langEdit').bind("click",function(event){
			
			var hr = $(this);
			var valu = hr.attr("rel");
			var values = hr.html();
			$("<div id='LANGEDIT' style='position:fixed;left:300px;top:50px;background-color:#333;padding:20px;margin:auto;'><input id='langEditname' type='text' size='100' name='langEditname' value='"+valu+"'><b><br><textarea id='langEditvalue' name='langEditvalue' style='width:815px;height:100px;clear:both;'>"+values+"</textarea><br><input type='button' name='SaveLang' id='SaveLang' value='Mentés'><input type='button' name='exitLang' id='exitLang' value='Bezár'></div>").appendTo('body');
			
			$('#LANGEDIT #SaveLang').click(function(){
				
				var txt = $("#langEditvalue").val();
				var nme = $("#langEditname").val();
				$.ajax({
					   type:"POST",
					   url:baseDir+"language",
					   data:{ajax:"true",modul:"language",mode:"save",lid:nme,text:txt},
					   success: function(xml){
						   // $('#slide_kereses #formLoader').hide();
						   	hr.html(xml);				 
				 	   }
				});
				$('#LANGEDIT').remove();
				return false;
			});
			
			$('#LANGEDIT #exitLang').click(function(){
				
				
				$('#LANGEDIT').remove();
				return false;
			});
			
			/*
			var b = $(".TextSite").css("opacity","0.5");
			$.ajax({
				   type:"POST",
				   url:hr,
				   data:{ajax:"true",modul:"text"},
				   success: function(xml){
					   // $('#slide_kereses #formLoader').hide();
					   	$("#AJAX").html(xml);				 
			 	   }
			});
			*/
			return false;
	});	

});

