
function fadestart()
{
	$('#featured_projects_list').cycle({
		fx: 'fade',
		random: 1,
		speed:    1500, 
		timeout:  7000 
	});
}
	
$(document).ready(function() {


$("#loading").hide();

bindelements = function(){
	
	$("#loading").hide();
	
	// INDUSTRY   ////////////////////////
	$(".indlink").click(function() {
		
		// Get rid of html entities
		oldstring = this.innerHTML;
		newstring = oldstring.replace(/&amp;/, "andxxxreplace");
		
		$("#loading").ajaxStart(function(){
   			$(this).show();
		});
		
		$.ajax({
			type: "POST",
  			url: "port_modul.php",
  			cache: false,
			data: "industry="+newstring+"&toplink=true",
  			success: function(html){
				$("#contentwrapper").empty();
   				$("#contentwrapper").append(html);
				bindelements();
  			}
		});
	
		$("#loading").ajaxStop(function(){
   			$(this).hide();
		});
	
	return false;	
	});
	// END ////////////////////////////////////////////////////
	
	
	// CATEGORY   ////////////////////////
	$(".catlink").click(function() {						 
								 
		// Get rid of html entities
		oldstring = this.innerHTML;
		newstring = oldstring.replace(/&amp;/, "andxxxreplace");
								 
		$("#loading").ajaxStart(function(){
   			$(this).show();
		});
		
		$.ajax({
			type: "POST",
  			url: "port_modul.php",
  			cache: false,
			data: "category="+newstring+"&toplink=true",
  			success: function(html){
				$("#contentwrapper").empty();
   				$("#contentwrapper").append(html);
				bindelements();
  			}
		});
	
		$("#loading").ajaxStop(function(){
   			$(this).hide();
		});
	
	return false;	
	// return true;
	});
	// END ////////////////////////////////////////////////////
	
	
	// LOAD BIG VIEW   ////////////////////////
	$(".thumblink").click(function() {						 
		
		$("#loading").ajaxStart(function(){
   			$(this).show();
		});
		
		$.ajax({
			type: "POST",
  			url: "port_enlarge_project.php",
  			cache: false,
			data: "projectid="+this.id,
  			success: function(html){
				$("#modulwrapper").empty();
   				$("#modulwrapper").append(html);
				bindelements();
  			}
		});
	
		$("#loading").ajaxStop(function(){
   			$(this).hide();
		});
	
	return false;	
	});
	// END ////////////////////////////////////////////////////
	
	
	// SKIM THUMBS   ////////////////////////
	$(".thumbskim").click(function() {						 
				
		$("#loading").ajaxStart(function(){
   			$(this).show();
		});
		
		$.ajax({
			type: "POST",
  			url: "port_modul.php",
  			cache: false,
			data: "skimdir="+this.id,
  			success: function(html){
				$("#contentwrapper").empty();
   				$("#contentwrapper").append(html);
				bindelements();
  			}
		});
	
		$("#loading").ajaxStop(function(){
   			$(this).hide();
		});
	
	return false;	
	});
	// END ////////////////////////////////////////////////////
	
	
	// ENLARGE THUMBS IN DETAIL VIEW   ////////////////////////
	$(".enlargethumb").click(function() {						 
				
		$("#loading").ajaxStart(function(){
   			$(this).show();
		});
		
		$.ajax({
			type: "POST",
  			url: "port_change_thumb.php",
  			cache: false,
			data: this.id,
  			success: function(html){
				$("#mainimageholder").empty();
   				$("#mainimageholder").append(html);
  			}
		});
	
		$("#loading").ajaxStop(function(){
   			$(this).hide();
		});
	
	return false;	
	});
	// END ////////////////////////////////////////////////////
	
	// BACKTO THUMBS   ////////////////////////
	$(".backtothumbs").click(function() {						 
								 
		// Get rid of html entities
		oldstring = this.innerHTML;
		newstring = oldstring.replace(/&amp;/, "andxxxreplace");
								 
		$("#loading").ajaxStart(function(){
   			$(this).show();
		});
		
		$.ajax({
			type: "POST",
  			url: "port_modul.php",
  			cache: false,
			data: this.id,
  			success: function(html){
				$("#contentwrapper").empty();
   				$("#contentwrapper").append(html);
				bindelements();
  			}
		});
	
		$("#loading").ajaxStop(function(){
   			$(this).hide();
		});
	
	return false;	
	});
	// END ////////////////////////////////////////////////////
	
}// end bindelements

bindelements();

});
