w=window.location.toString();
var page=(w.indexOf('#')>0?(w.split('#'))[1]:'despre');
var ch='636px';//content height
var lh='60px';//loader height

function specifics(p){
	switch(p){
		case 'servicii': 
			$('#s-acc').accordion({
				animated:'easeOutCirc',
				changestart:function(){
					$.extend($.ui.accordion.animations, {
						fastslide: function(options) {
							$.ui.accordion.animations.slide(options, { duration: 1200 }); }
						});
				},
				change:function(){
					$.extend($.ui.accordion.animations, {
						fastslide: function(options) {
							$.ui.accordion.animations.slide(options, { duration: 750 }); }
						});
				}
			}); 
			break;
	}
}

$(function(){
	$.ajax({
		url:'getpage.php',
		type:'GET',
		data:{'page':page},
		success:function(response){
			$('#content').animate({height:1},100,'linear',function(){
				
				$('#content').hide().html(response).css('height',ch).slideDown(750);
				specifics(page);
			});
		}
	});
});

String.prototype.ucfirst = function()
{
  var text;
  text = this[0].toUpperCase();
  for(var i = 1; i<this.length; i++){
   text += this[i-1]==' ' ? this[i].toUpperCase(): this[i].toLowerCase() ;
  }
  return text;
};


function nav(pag){	
	page=pag;

	loc=window.location.toString();
	window.location=loc.split('#')[0]+'#'+page;
	$('#content').animate({height:1},750,'swing',function(){
		$('#content').html('<div class="loader"><img src="img/ajax.gif"/></div>').animate({height:lh},100,'linear',function(){
			//simulare pauza ajax
			//$('#content').animate({height:lh},2000,'linear',function(){
				$.ajax({
					url:'getpage.php',
					type:'GET',
					data:{'page':page},
					success:function(response){
						$('#content').animate({height:1},100,'linear',function(){
							$('title').html(page.ucfirst);
							$('#content').hide().html(response).css('height',ch).slideDown(750);
							specifics(page);
						});
					}
				});
			//});
		});
	});/**/
}

var desc=new Array();
