	var xmlHttp;
	var imgProjectPath = "img/projects/";
	var imgProjectThumbPath = "img/projects/thumbs/";
	
	function createXMLHttpRequest(){
		if(window.ActiveXObject){
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		} else if(window.XMLHttpRequest) {
			xmlHttp = new XMLHttpRequest();
		}
	}	

	function ajaxCallback(){
		if(xmlHttp.readyState == 4){
			if(xmlHttp.status == 200) {
				var txtHtml = "";
				var target = document.getElementById("rightColumn");
				var xmlDoc = xmlHttp.responseXML;

				var txtName, txtTechnology, txtDescription, txtLogo, txtTemp;
				var arrImages = new Array();

				var tmpSrc, tmpAlt, tmpWidth, tmpHeight;
				
				txtName = xmlDoc.getElementsByTagName("name")[0].firstChild.nodeValue;
				if(xmlDoc.getElementsByTagName("link")[0].firstChild){
					txtLink = xmlDoc.getElementsByTagName("link")[0].firstChild.nodeValue;
				} else {
					txtLink = "";	
				}
				txtTechnology = xmlDoc.getElementsByTagName("technology")[0].firstChild.nodeValue;
			
				if(xmlDoc.getElementsByTagName("description")[0].firstChild){
					txtDescription = xmlDoc.getElementsByTagName("description")[0].firstChild.nodeValue;
				} else {
					txtDescription = "";
				}
				
				tmpSrc = xmlDoc.getElementsByTagName("logo")[0].firstChild.nodeValue;
				txtLogo = "<img src=\""+ imgProjectThumbPath + tmpSrc +"\" alt=\""+ txtName +"\" width=\"150\" height=\"100\" />";

				var xmlImages = xmlDoc.getElementsByTagName("image");
				for(var i=0;i<xmlImages.length;i++){
					tmpSrc = xmlImages[i].getElementsByTagName("src")[0].firstChild.nodeValue;
					if(xmlImages[i].getElementsByTagName("alt")[0].firstChild){
						tmpAlt = xmlImages[i].getElementsByTagName("alt")[0].firstChild.nodeValue;
					} else {
						tmpAlt = "";	
					}
					tmpWidth = xmlImages[i].getElementsByTagName("width")[0].firstChild.nodeValue;
					tmpHeight = xmlImages[i].getElementsByTagName("height")[0].firstChild.nodeValue;					
					
					arrImages[i] = "<a href=\""+ imgProjectPath + tmpSrc +"\" rel=\"lightbox["+ txtName +"]\" title=\""+ tmpAlt +"\"><img src=\""+ imgProjectThumbPath + tmpSrc +"\" alt=\"\" width=\"150\" height=\"100\" class=\"thumbnails\" /></a>";
				}

				txtHtml += "<h1>"+ txtName +"</h2>";
				if(txtLink != "")
					txtHtml += "<a href=\""+ txtLink +"\" onclick=\"this.target='_blank';\">"+ txtLink +"</a><br /><br />";
				if(txtDescription != "")
					txtHtml += replaceAll("\n","<br/>", txtDescription) +"<br /><br />";
				for(var i=0; i< arrImages.length;i++){
					txtHtml += arrImages[i] +" ";	
				}
				txtHtml += "<br/><br/>";
				txtHtml += "<small>Information: "+ txtTechnology +"</small>";
				target.innerHTML = txtHtml;
				initLightbox();

			}
		}
	}
	
	function replaceAll( strSearch, strReplace, strSubject ) {
		var iTemp = strSubject.indexOf( strSearch );
		while ( iTemp > -1 ) {
			strSubject = strSubject.replace( strSearch, strReplace );
			iTemp = strSubject.indexOf( strSearch );
		}
	
		return strSubject;
	}
	
	function getProject(iId){
		createXMLHttpRequest();	
		var url = "core.php?p="+ iId.toString();
		xmlHttp.open("GET",url);
		xmlHttp.onreadystatechange = ajaxCallback;
		xmlHttp.send(null);
	}	
