		
jQuery.noConflict();

jQuery('a[rel=ajax]') 
    .livequery('click', function(event) { 

       var hash = this.href;
		//remove the # value
		hash = hash.replace(/^.*#/, '');
		//for back button
	 	jQuery.history.load(hash);	
		jQuery('#hiddenDIV')
		.hide()
		.html('')
		
         .removeClass('textonormal')
		 .addClass('loading')
		 .show()
	 	
	 	//run the ajax
		getPage(hash);
	
		//cancel the anchor tag behaviour
		return false;
    });

jQuery(document).ready(function () {
	//Check if url hash value exists (for bookmark)
	jQuery.history.init(pageload);
	//Seearch for link with REL set to ajax
	jQuery('a[rel=ajax]').click(function () {
										  
		//grab the full url
		var hash = this.href;
		//remove the # value
		hash = hash.replace(/^.*#/, '');
		//for back button
	 	jQuery.history.load(hash);
		jQuery('#hiddenDIV')
		.hide()
		.html('')	
        .removeClass('textonormal')
		.addClass('loading')
		.show()
	
		//cancel the anchor tag behaviour
		return false;
	});	
});

function pageload(hash) {
	//if hash value exists, run the ajax
	getPage(hash);
}

function setinicio() {
	var data = 'page=home';
	jQuery.ajax({	
		url: "page.php",
		type: "GET",		
		data: data,		
		cache: false,
		success: function (html) {	
			jQuery('#hiddenDIV').show();
			jQuery('#hiddenDIV').removeClass('loading');
		  	jQuery('#hiddenDIV').addClass('textonormal');
			//add the content retrieved from ajax and put it in the #content div
			jQuery('#hiddenDIV').html(html);
			//display the body with fadeIn transition
			jQuery('#hiddenDIV').fadeIn('slow');
			
				
		}		
	});
}
		
function getPage(hash) {

		if (!hash){
			var temp = document.location.href.search("language");
			if (!temp || temp==-1){
				var lang = '';
			}else{
				var lang ='?'+document.location.href.substr(temp,11);
			}			
			var data = 'page=home' +lang;
		}else{
			var temp = hash.search("language");
			if (!temp || temp==-1){
				var lang = '';
			}else{
				var lang ='&'+hash.substr(temp,11);
			}	
			var data = 'page=' + hash+lang;
		}
	jQuery.ajax({
		url: "page.php",
		type: "GET",		
		data: data,		
		cache: false,
		success: function (html) {	

        jQuery('#hiddenDIV')
			.hide()
          .removeClass('loading')
		  .addClass('textonormal')
		  .show()
          .html(html);

		}		
	});
}

