/* SERVER CACHE */
var isIE6 = /msie|MSIE 6/.test(navigator.userAgent);
function trim(value){
  return value.replace(/^\s+|\s+$/g, '') ;
}
function GoToUrl(url)
{
	window.location.href = url;
}
var fnChain = new Chain();
function changeProjectTitle(newtitle){
	document.getElementById('projecttitle').innerHTML = newtitle;
	var hdrItems = $$('#projecttitle');
	if(!isIE6){
		hdrItems.each(function(item) {
			item.setStyle('opacity', 0);
			item.set('morph', {
				duration: 400,
				onComplete: function(){fnChain.callChain()}
			});
			fnChain.chain(
				function(){item.morph({
					opacity: 1});
				}
			);
		});
		fnChain.callChain();
	} else {
		document.getElementById('projecttitle').setStyle('opacity', 1);
	}
}
function unchangeProjectTitle(newtitle){
	document.getElementById('projecttitle').innerHTML = newtitle;
	document.getElementById('projecttitle').setStyle('opacity', 0);
}
function changeProjectTitleDetail(newtitle){
	document.getElementById('projecttitle-hover').innerHTML = newtitle;
	var hdrItems = $$('#projecttitle-hover');
	if(!isIE6){
		hdrItems.each(function(item) {
			item.setStyle('opacity', 0);
			item.set('morph', {
				duration: 400,
				onComplete: function(){fnChain.callChain()}
			});
			fnChain.chain(
				function(){item.morph({
					opacity: 1});
				}
			);
		});
		fnChain.callChain();
	} else {
		document.getElementById('projecttitle-hover').setStyle('opacity', 1);
	}	
}
function unchangeProjectTitleDetail(newtitle){
	document.getElementById('projecttitle-hover').innerHTML = newtitle;
	document.getElementById('projecttitle-hover').setStyle('opacity', 0);
}
function showProjectText(){
	var projecttext = $$('#projecttext');
	var posY = findPosY(document.getElementById('cont'));
	var posX = findPosX(document.getElementById('cont'));	
	posY = parseInt(posY) + 285;
	posX = parseInt(posX) + 537;
	//alert(posY);
	//alert(posX);
	document.getElementById('projecttext').style.top=posY+'px';
	document.getElementById('projecttext').style.left=posX+'px';
	//document.getElementById('outerdiv').style.display='block';
	projecttext.each(function(item) {
		item.setStyle('display', 'block');
		item.setStyle('opacity', 0);
		item.set('morph', {
			duration: 400,
			onComplete: function(){fnChain.callChain()}
		});
		fnChain.chain(
			function(){item.morph({
				opacity: 1});
			}
		);
	});
	fnChain.callChain();
	document.getElementById('prjtxt').style.color='#000';
	//document.getElementById('prjtxt').setStyle('color', '#000');
}
function hideProjectText(){
	document.getElementById('projecttext').style.display='none';
	document.getElementById('prjtxt').style.color='#9A9A9A';
	//document.getElementById('prjtxt').setStyle('color', '#9A9A9A');
}
function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		do {
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	return [curtop];
}
function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
		} while (obj = obj.offsetParent);
	}
	return [curleft];
}
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	return [curleft,curtop];
}