function modelsShowCategory(showme, position) {
	var currentPosition = $("#visibleContainer").val();
	var lang = $("#languageValue").val();
	$("#gotoModelCurrent").val('0');
	$(document).unbind("keyup");
	
	
	$("#main-bg").animate({opacity: 0}, 300, function() { $(this).hide(0); });
	
	//alert(currentPosition + ', ' + position);
	if (currentPosition != position) {
		// move out existing model-container
		if ( currentPosition < position ) { var moveouttop = "0%"; var moveintop = "100%"; }
		else { var moveouttop = "100%"; var moveintop = "0%"; }
		
		$(".pages-container").animate({top: "100%", opacity: 0}, 600, "easeInOutCirc", function() { $(this).remove(); });
		$(".models-container").animate({top: moveouttop, opacity: 0}, 600, "easeInOutCirc", function() { $(this).remove(); });
		$(".model-container").animate({top: moveouttop, opacity: 0}, 600, "easeInOutCirc", function() { $(this).remove(); });
		
		
		$("#content-container").append('<div id="models-container-' + showme + '" class="models-container" style="top: ' + moveintop + ';"></div>');
		
		
		
		
		$.ajax({
			url: "models-category.php?showme=" + showme, 
			cache: false, 
			success: function(response) {
				$("#models-container-" + showme).html(response);
				$("#visibleContainer").attr("value", position);
				
				
				var paircount = 0;
		function initImage(obj) {
			obj.onload = null;
			var $newthis = $(obj);
			if ($.browser.msie) {
				// You need this only if desaturate png with aplha channel
				$newthis = $newthis.desaturateImgFix();
			}
			
			// class for easy switch between color/gray version
			$newthis.addClass("pair_" + ++paircount);
			var $cloned = $newthis.clone();
			
			// reset onload event on cloned object
			$cloned.get(0).onload = null;
			
			// add cloned after original image, we will switch between
			// original and cloned later
			$cloned.insertAfter($newthis).addClass("color").hide();
			
			// desaturate original
			$newthis.desaturate();
		}
				
				// set breadcrumbs text
				if (lang == 1) {
					if (showme == "girl") { var breadcrumbs = "L&aacute;nyok"; }
					else if (showme == "boy") { var breadcrumbs = "Fi&uacute;k"; }
					else if (showme == "ptm") { var breadcrumbs = "Part Time Models"; }
					else if (showme == "newface") { var breadcrumbs = "&Uacute;j Arcok"; }
				}
				
				else if (lang == 2) {
					if (showme == "girl") { var breadcrumbs = "Girls"; }
					else if (showme == "boy") { var breadcrumbs = "Boys"; }
					else if (showme == "ptm") { var breadcrumbs = "Part Time Models"; }
					else if (showme == "newface") { var breadcrumbs = "New Faces"; }
				}
				
				$("#breadcrumbs").animate({opacity: 0}, 400, function() {
					$("#breadcrumbs").html(breadcrumbs).animate({opacity: 1}, 400);
				});
				
				
				// remove class="selected"
				var menuItem = $("#menu li");
				for (i = 0; i <= (menuItem.length - 5); i++) {
					$(menuItem[i]).attr("class", "model-category");
				}
				for (i = 4; i <= (menuItem.length - 1); i++) {
					$(menuItem[i]).attr("class", "");
				}
				
				
				// add class="selected"
				var divClass = $("#menu-item-" + showme).attr("class");
				var newDivClass = divClass + " selected";
				$("#menu-item-" + showme).attr("class", newDivClass);
				
				
				// move in new model-container
				$("#models-container-" + showme).animate({top: "50%", opacity: 1}, 600, "easeInOutCirc", function() {
					$(".scroll-pane").jScrollPane();
					$(".jspVerticalBar, .jspHorizontalBar").animate({"opacity": 1}, 500);
					
					// preloadAR
					var modelItems = $(".model-item");
					for (i = 0; i <= (modelItems.length - 1); i++) {
						var j = parseInt(i) + 1;
						$(modelItems[i]).find("img").delay(j * 200).fadeIn(500, function() {
							//$(this).css({"-webkit-transition-property": "opacity", "-webkit-transition-duration": ".2s", "-moz-transition-property": "opacity", "-moz-transition-duration": ".2s"});
						});
						
						
						$(modelItems[i]).find(".preload").delay(j * 200).animate({"opacity": 0}, 500);
					}
				});
			}
		});
	}
}



function pageShowConfirm(showme, position, id) {
	var currentPosition = $("#visibleContainer").val();
	var lang = $("#languageValue").val();
	$(document).unbind("keyup");
	
	
	$("#main-bg").animate({opacity: 0}, 300, function() { $(this).hide(0); });
	
	
	if (currentPosition != position) {
		// set breadcrumbs text
		if (lang == 1) { var breadcrumbs = "Jelentkezés megerősítése"; }
		else if (lang == 2) { var breadcrumbs = "Confirm application"; }
		
		
		
		// remove class="selected"
		var menuItem = $("#menu li");
		for (i = 0; i <= (menuItem.length - 5); i++) {
			$(menuItem[i]).attr("class", "model-category");
		}
		for (i = 4; i <= (menuItem.length - 1); i++) {
			$(menuItem[i]).attr("class", "");
		}
		
		
		// add class="selected"
		if (showme != 'terms') {
			var divClass = $("#menu-item-" + showme).attr("class");
			var newDivClass = divClass + " selected";
			$("#menu-item-" + showme).attr("class", newDivClass);
			
			$('.footer-item').attr("class", 'footer-item');
		}
		
		else if (showme == 'terms') {
			var newDivClass = "footer-item footer-item-selected";
			$( $('.footer-item')[1] ).attr("class", newDivClass);
		}
		
		
		// move out existing model-container
		if ( currentPosition < position ) { var moveouttop = "0%"; var moveintop = "100%"; }
		else { var moveouttop = "100%"; var moveintop = "0%"; }
		
		$(".models-container").animate({top: "0%", opacity: 0}, 600, "easeInOutCirc", function() { $(this).remove(); });
		$(".pages-container").animate({top: moveouttop, opacity: 0}, 600, "easeInOutCirc", function() { $(this).remove(); });
		$(".model-container").animate({top: moveouttop, opacity: 0}, 600, "easeInOutCirc", function() { $(this).remove(); });
		
		
		$("#content-container").append('<div id="pages-container-' + showme + '" class="pages-container" style="top: ' + moveintop + '; height: 380px;"></div>');
		$.ajax({
			url: "page.php?showme=" + showme + "&confirmID=" + id, 
			cache: false, 
			success: function(response) {
				$("#pages-container-" + showme).html(response);
				$("#visibleContainer").attr("value", position);
				
				$("#breadcrumbs").animate({opacity: 0}, 400, function() {
					$("#breadcrumbs").html(breadcrumbs).animate({opacity: 1}, 400);
				});
				
				// move in new model-container
				$("#pages-container-" + showme).animate({top: "50%", opacity: 1}, 600, "easeInOutCirc", function() {
					$(".scroll-pane").jScrollPane();
					$(".jspVerticalBar, .jspHorizontalBar").animate({"opacity": 1}, 500);
				});
			}
		});
	}
}



function pageShow(showme, position) {	
	var currentPosition = $("#visibleContainer").val();
	var lang = $("#languageValue").val();
	$(document).unbind("keyup");
	
	
	$("#main-bg").animate({opacity: 0}, 300, function() { $(this).hide(0); });
	
	
	
	if (currentPosition != position) {
		// set breadcrumbs text
		if (lang == 1) {
			if (showme == "become") { var breadcrumbs = "Legy&eacute;l Modell"; }
			else if (showme == "about") { var breadcrumbs = "R&oacute;lunk"; }
			else if (showme == "contact") { var breadcrumbs = "Kapcsolat"; }
			else if (showme == "vmsupermodel") { var breadcrumbs = "VM Supermodel"; }
			else if (showme == "terms") { var breadcrumbs = "Felhasználási feltételek"; }
			else if (showme == "confirm") { var breadcrumbs = "Jelentkezés megerősítése"; }
		}
		
		else if (lang == 2) {
			if (showme == "become") { var breadcrumbs = "Become A Model"; }
			else if (showme == "about") { var breadcrumbs = "About Valentine Model"; }
			else if (showme == "contact") { var breadcrumbs = "Contact Us"; }
			else if (showme == "vmsupermodel") { var breadcrumbs = "VM Supermodel"; }
			else if (showme == "terms") { var breadcrumbs = "Terms &amp; Conditions"; }
			else if (showme == "confirm") { var breadcrumbs = "Confirm application"; }
		}
		
		
		
		
		// remove class="selected"
		var menuItem = $("#menu li");
		for (i = 0; i <= (menuItem.length - 5); i++) {
			$(menuItem[i]).attr("class", "model-category");
		}
		for (i = 4; i <= (menuItem.length - 1); i++) {
			$(menuItem[i]).attr("class", "");
		}
		
		
		// add class="selected"
		if (showme != 'terms') {
			var divClass = $("#menu-item-" + showme).attr("class");
			var newDivClass = divClass + " selected";
			$("#menu-item-" + showme).attr("class", newDivClass);
			
			$('.footer-item').attr("class", 'footer-item');
		}
		
		else if (showme == 'terms') {
			var newDivClass = "footer-item footer-item-selected";
			$( $('.footer-item')[1] ).attr("class", newDivClass);
		}
		
		
		// move out existing model-container
		if ( currentPosition < position ) { var moveouttop = "0%"; var moveintop = "100%"; }
		else { var moveouttop = "100%"; var moveintop = "0%"; }
		
		$(".models-container").animate({top: "0%", opacity: 0}, 600, "easeInOutCirc", function() { $(this).remove(); });
		$(".pages-container").animate({top: moveouttop, opacity: 0}, 600, "easeInOutCirc", function() { $(this).remove(); });
		$(".model-container").animate({top: moveouttop, opacity: 0}, 600, "easeInOutCirc", function() { $(this).remove(); });
		
		
		$("#content-container").append('<div id="pages-container-' + showme + '" class="pages-container" style="top: ' + moveintop + '; height: 380px;"></div>');
		
		$.ajax({
			url: "page.php?showme=" + showme, 
			cache: false, 
			success: function(response) {
				$("#pages-container-" + showme).html(response);
				$("#visibleContainer").attr("value", position);
				
				$("#breadcrumbs").animate({opacity: 0}, 400, function() {
					$("#breadcrumbs").html(breadcrumbs).animate({opacity: 1}, 400);
				});
				
				// move in new model-container
				$("#pages-container-" + showme).animate({top: "50%", opacity: 1}, 600, "easeInOutCirc", function() {
					$(".scroll-pane").jScrollPane();
					$(".jspVerticalBar, .jspHorizontalBar").animate({"opacity": 1}, 500);
				});
			}
		});
	}
}
