var browserName=navigator.appName; if (browserName=="Microsoft Internet Explorer") {
        
    History = History || {};
    History.pathname = null;
    History.previousHash = null;
    History.hashCheckInterval = -1;
    History.stack = [];
    History.initialize = function () {
        if (History.supportsHistoryPushState()) {
            History.pathname = document.location.pathname;
            $(window).bind("popstate", History.onHistoryChanged);
        } else {
            History.hashCheckInterval = setInterval(History.onCheckHash, 200);
        }
    };
    History.supportsHistoryPushState = function () {
        return ("pushState" in window.history) && window.history.pushState !== null;
    };
    History.onCheckHash = function () {
        if (document.location.hash !== History.previousHash) {
            History.navigateToPath(document.location.hash.slice(1));
            History.previousHash = document.location.hash;
        }
    };
    History.pushState = function (url) {
        if (History.supportsHistoryPushState()) {
            window.history.pushState("", "", url);
        } else {
            History.previousHash = url;
            document.location.hash = url;
        }
        History.stack.push(url);
    };
    History.onHistoryChanged = function (event) {
        if (History.supportsHistoryPushState()) {
            if(History.pathname != document.location.pathname){
                History.pathname = null;
                History.navigateToPath(document.location.pathname);
            }
        }
    };
    History.navigateToPath = function(pathname) {
        History.pushState(pathname);
    
        // DO SOME HANDLING OF YOUR PATH HERE
    
    };

}

$(document).ready(function () {

	$('a').live('click', function() {
	   
        if (browserName=="Microsoft Internet Explorer") {
            var href = $(this).attr('href');
            History.navigateToPath( href );        
        } else {
            $.getScript(this.href);  
            history.pushState(null, document.title, this.href);            
        }        
               
		if ($(this).attr('rel') != '' && $(this).attr('rel') != 'javascript:;' && $(this).attr('href') != 'javascript:;')
		{
			$('#loader').html('<div class="yuklenir"><img src="images/loading.gif" /><br/><br/>Yüklənir. Zəhmət olmasa gözləyin...</div>');
			$(document).scrollTo( 300, 800, {queue:true} );
			$.get($(this).attr('rel'), '',
				function(data){ 
				    $('#loader').html(data);
                    
                }
			);
			return false;
		}
		else
		{
			return true;
		}

	});
    
});


$(document).ready(function() {

	// --------------------
	// NAVIGATION
	// --------------------

	$('#navMenu li').append('<div class="hover"><\/div>');

	$('#navMenu li:not(.active)').hover(function() {
			$(this).children('div').stop().css({ opacity: 1 }).fadeIn();	
	}, function() {
			$(this).children('div').fadeOut();	
	});	

	// --------------------
	// SUB NAVIGATION
	// --------------------

	
	//To switch directions up/down and left/right just place a "-" in front of the top/left attribute

	//Caption Sliding (Partially Hidden to Visible) Verlishler uchun
	$('.boxgrid.caption').hover(function(){
		$(".cover", this).stop().animate({top:'-11px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({top:'55px'},{queue:false,duration:200});
	});
	
});










//dnmmenu
function getcontent (getid) {
for(var i=1; i <= element_count; i++) {
document.getElementById('dpart_'+i).className = 'hidden';
}

document.getElementById('dpart_'+getid).className = '';
}

function getclick (getid) {
currentobyekt = getid;

for(var i=1; i <= element_count; i++) {
document.getElementById('dnmkmenyu_'+i).className = 'dnmkmenu';
}

document.getElementById('dnmkmenyu_'+getid).className = 'dnmkmenu_click';
getcontent(getid);
}

function dnmkmouseout (obyekt) {
if(obyekt.id != 'dnmkmenyu_'+currentobyekt)
obyekt.className='dnmkmenu';
getcontent (currentobyekt);
}

function dnmkmouseover (obyekt, this_id) {
if(obyekt.id != 'dnmkmenyu_'+currentobyekt)
obyekt.className='dnmkmenu_over';
getcontent (this_id);
}
