function createRequestObject(){
	var request_o; //declare the variable to hold the object.
	var browser = navigator.appName; //find the browser name
	if(browser == "Microsoft Internet Explorer"){
		/* Create the object using MSIE's method */
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		/* Create the object using other browser's method */
		request_o = new XMLHttpRequest();
	}
	return request_o; //return the object
}


/* The variable http will hold our new XMLHttpRequest object. */
var http = createRequestObject(); 


/* Function called to get the product categories list */
function getPage(nr, type){
	
	http.open('get', 'internal_request.php?action=' + type + "&page=" + nr);
	
	http.onreadystatechange = handlePage; 
	
	http.send(null);
}

/* Function called to handle the list that was returned from the internal_request.php file.. */
function handlePage(){
	/* Make sure that the transaction has finished. The XMLHttpRequest object 
		has a property called readyState with several states:
		0: Uninitialized
		1: Loading
		2: Loaded
		3: Interactive
		4: Finished */
	if(http.readyState == 4){ 			
		var response = http.responseText;		
		document.getElementById('portfolio').innerHTML = response;
	}
}

