jQuery(function($) { 
	$(document).ready(function(){
			$(window).load(function () {
            $("#imag").attr({src:'http://creare-site-pagini-web.ro/shikatedo.gif?' + (new Date()).getTime()});
			$("body").css({background:"url(http://creare-site-pagini-web.ro/imagini/blex6.jpg)"});
                  
				  var hei = $('body').css("height");
                  hei = parseInt(hei.split("px", 1)) + 650 + 'px'; 
			$("body").wrapInner("<div id=sus style=\"position:relative; top:-"+hei+";\"></div>");

			$("body").prepend("<div id=black style=\"opacity:1; background:black; position:relative; top:-20px; height:"+hei+"; width:100%;\"></div>");			
			
                  $("body").css({visibility:"visible"});
				  				  			
			var height= $('#text').css("height");
			var height2 = parseInt(height.split("px", 1)) + 380 + 'px';
			var height3 = parseInt(height.split("px", 1)) + 50 + 'px';	
		    var height4 = parseInt(height.split("px", 1)) - 35 + 'px';
			var time = setTimeout(function(){
			$("#black").animate({opacity:"0"},500, function(){$("#black").remove(); $("#sus").css({top:"0px"}); });
			$("#imag").
			animate({left: "100px",
			top: "165px",
			height: height2
			}, 500, function(){ 
			$('#container').css({visibility:"visible"});
			$('#textback').animate({opacity: "0.8"},800);
			$('#container').animate({opacity: "1"}, 800, function(){
		      $('#textback').animate({height: height3}, 1000,function(){
			$('#text').css({visibility:"visible", top: "-"+height4});
			$('#text').animate({opacity: "1"},800);
                  });					
			});
			clearTimeout(time);
			});

			}, 3000);	 
     
	 $('ul').get(0).id=location.href;
	 clicka("a");


    function clicka(ra){
	$(ra).focus(function(){this.blur()});
	  $(ra).click(function(){
	if(this.href.search(/creare-site-pagini-web.ro/)=="-1"){ 
		window.location.href=this.href;
	} else {
		if(this.href!=$('ul').get(0).id){ $('ul').get(0).id=this.href;
			if (this.href.search(/php/)=="-1")
			{
			var id = "primapagina";
			var page = "/index.php";			
			}
			else 
			{			
			var id = this.href.substr(40).replace(/.php/, "").replace(/-/g, "");
			var page = this.href.substr(32);
			}		
			schimba(id, page);
		}
	  } 
	  return false;  });
	}


	 
	function schimba(id, page){
		var page = (page == null) ? "" : page;		

		window.scrollTo(0, 0);
	    $('#text').css({display:"none"});
		$('#textback').animate({height: "0px"}, 500);
		$('#text').replaceWith("<div id=\"text\"> </div>");								  
	    $.get("http://creare-site-pagini-web.ro/ajax/continut.php", {menu:id}, function(data){ 		
		document.title= $("title",data).text(); 
		$("meta").eq(0).attr({content:$("description",data).text()});
		$("meta").eq(1).attr({content:$("keywords",data).text()});
		$('#text').replaceWith("<div id=\"text\">"+$("text",data).text()+"</div>");
		var height= $('#text').css("height");
		var height2 = parseInt(height.split("px", 1)) + 380 + 'px';										        var height3 = parseInt(height.split("px", 1)) + 50 + 'px';	
		var height4 = parseInt(height.split("px", 1)) - 35 + 'px';
		$("#imag").animate({height: height2}, 500);
		 $('#textback').animate({height: height3}, 1000,function(){
			$('#text').css({visibility:"visible", top: "-"+height4});
			$('#text').animate({opacity: "1"},800);
           clicka("#text a");
		
	//analytics
	   activateGoogle(page);
		  
		 });
		});
	}
	
	
	 });
    });
  });

			//analytics
			
			var _googleInterval;
			function addGoogleTracking()
			{
				var sc = document.createElement('script');
				sc.type = 'text/javascript';
				sc.src = 'http://www.google-analytics.com/ga.js';
				document.getElementsByTagName("head").item(0).appendChild(sc);
				_googleInterval = setInterval(activateGoogle,250);
			}
			function activateGoogle(page)
			{	
				var page = (page == null) ? "" : page;

				if(typeof _gat != 'undefined') 
				{
				clearInterval(_googleInterval);
				var pageTracker = _gat._getTracker("UA-3641490-3");
				pageTracker._initData();
				pageTracker._trackPageview(page);
				}
			}


			addGoogleTracking();
			//end analytics
