function pageloadEffects(){
	preloadImages();
	// Effect.SlideDown('subNavContentBG', { duration: 0.65, delay: 0.3 }); return false;
	Effect.Fade('landing-menuContent', { duration: 1.5, from: 0, to: 1 }); return false;
	
}



function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		mainNavHomeon = newImage("../images/mainNav_Home_on.png");
		mainNavCompanyon = newImage("../images/mainNav_Company_on.png");
		mainNavContacton = newImage("../images/mainNav_Contact_on.png");
		mainNavServiceson = newImage("../images/mainNav_Services_on.png");
		mainNavWorkon = newImage("../images/mainNav_Work_on.png");
		btnformSubmitover = newImage("../images/btn_formSubmit_over.gif");
		btnlistItemsnextover = newImage("../images/btn_listItems_next_over.gif");
		btnlistItemsprevover = newImage("../images/btn_listItems_prev_over.gif");
		
		preloadFlag = true;
	}
}


if (document.layers){
      //Netscape 4 specific code
      pre = 'document.';
      post = '';
      post2 = '';
      var IEoffsets = 0;
   }
   if (document.getElementById){
      //Netscape 6 specific code
      pre = 'document.getElementById("';
      post = '").style';
      post2 = '")';
      var IEoffsets = 2;
   }
   if (document.all){
      //IE4+ specific code
      pre = 'document.all.';
      post = '.style';
      post2 = '';
      var IEoffsets = 5;
   }
  
   		function showLayer(lyr){
			eval(pre + lyr + post).display = 'block';
		}
		function hideLayer(lyr){
			eval(pre + lyr + post).display = 'none';
		}


var currentTab = 'news';
function changeTabs(newTab) {
	tab = 'tab_' + currentTab;
	tabContent = 'tabContent_' + currentTab;
	setTab = 'tab_' + newTab;
	setTabContent = 'tabContent_' + newTab;
	// alert(setTab);
	
	
	if (newTab != currentTab){
		// change tab style
		document.getElementById(tab).className = 'tabOff';
		document.getElementById(setTab).className = 'tabOn';
		
		// change tab content
		Effect.Fade(tabContent, { duration: .25, from: 1.0, to: 0.0 });
		Effect.Appear(setTabContent, { duration: 1.0 });
		currentTab = newTab;	
		
	}
}

function tabsSeeAllLink() {
	if (currentTab == 'news'){
		window.location="company/news.php";
	} else if (currentTab == 'projects'){
		window.location="work/project_gallery.html";
	} else if (currentTab == 'blog'){
		window.location="company/blog.php";
	} else if (currentTab == 'twitter'){
		window.location="http://twitter.com/liquidreality";
	}
}


function fadeOldTabContent(tabContent){
		Effect.Fade(tabContent, { duration: .25, from: 1.0, to: 0.0 });return false;
}
function fadeNewTabContent(setTabContent){
		Effect.Appear(setTabContent, { duration: 1.0 });return false;
}

var theItemDate;
var theItemTitle;
var theItemText;

function moveListBG(selectedItem, itemDate, itemTitle, itemText){
	
	if(selectedItem == 'listItem_1'){
		new Effect.Move('listSelectedBG', { x: -4, y: 0, mode: 'absolute', duration: 0.5 });
		
	} else if(selectedItem == 'listItem_2'){
		new Effect.Move('listSelectedBG', { x: -4, y: 50, mode: 'absolute', duration: 0.5 });
		
	} else if(selectedItem == 'listItem_3'){
		new Effect.Move('listSelectedBG', { x: -4, y: 100, mode: 'absolute', duration: 0.5 });
		
	} else if(selectedItem == 'listItem_4'){
		new Effect.Move('listSelectedBG', { x: -4, y: 150, mode: 'absolute', duration: 0.5 });
		
	} else if(selectedItem == 'listItem_5'){
		new Effect.Move('listSelectedBG', { x: -4, y: 200, mode: 'absolute', duration: 0.5 });
		
	}
	

		
	if(itemDate == 'bio'){
		theItemTitle = itemTitle;
		theItemText = itemText;
		
		setTimeout("swapBioContent();",500);
		
		changeBioArticle();
		
	} else if (itemDate != ''){
		
		theItemDate = itemDate;
		theItemTitle = itemTitle;
		theItemText = itemText;
		
		setTimeout("swapBlogContent();",500);
		
		changeBlogArticle();
	} 
		
}

function insertHTML(where, what) {
			eval(pre + where + post2).innerHTML = what;
}

function changeBlogArticle(){
	
		Effect.Fade('blogDate', { duration: 0.25 });
		Effect.Fade('blogTitle', { duration: 0.25 });
		Effect.Fade('blogBodyBlock', { duration: 0.25 });
		
		Effect.Appear('blogDate', { duration: 0.25, delay: 1.0 });
		Effect.Appear('blogTitle', { duration: 0.25, delay: 1.0 });
		Effect.Appear('blogBodyBlock', { duration: 0.25, delay: 1.0 });
}

function swapBlogContent(){
		insertHTML('blogDate', theItemDate);
		insertHTML('blogTitle', theItemTitle);
		insertHTML('blogBodyBlock', theItemText);
}


function changeBioArticle(){
	
		Effect.Fade('bioTitle', { duration: 0.25 });
		Effect.Fade('bioText', { duration: 0.25 });
		
		Effect.Appear('bioTitle', { duration: 0.25, delay: 1.0 });
		Effect.Appear('bioText', { duration: 0.25, delay: 1.0 });
}

function swapBioContent(){
		insertHTML('bioTitle', theItemTitle);
		insertHTML('bioText', theItemText);
}



function $style(ElementId, CssProperty)
{
    function $(stringId)
    {
        return document.getElementById(stringId);
     }    

    if($(ElementId).currentStyle)
   {
        var convertToCamelCase = CssProperty.replace(/\-(.)/g, function(m, l){return l.toUpperCase()});
        return $(ElementId).currentStyle[convertToCamelCase];
    }
    else if (window.getComputedStyle)
   {
        var elementStyle = window.getComputedStyle($(ElementId), "");
        return elementStyle.getPropertyValue(CssProperty);
    }
}


function getElementStyles(filter, move)
{
    var leftEdge = $style(filter, "left");
    leftEdgetCut = leftEdge.length - 2;
	//alert(leftEdgetCut);
    var check = leftEdge.substring(0,leftEdgetCut);
    var widthIs = $style(filter, "width");
    widthIsCut = widthIs.length - 2;
	var check2 = widthIs.substring(0,widthIsCut);
	// alert(check);
	// alert(check2);
    var leftPosition = check - 11;
    var bgWidth =  Number(check2) + 12;
	// alert(bgWidth);
    // alert('"filterBtn_mobile" altered left edge : ' + leftPosition);
    // new Effect.Move('filterSelectedBG', { x: leftPosition, y: 0, mode: 'absolute' });
    $(move).morph('left:' + leftPosition  + 'px; width:' + bgWidth  + 'px;');

}






		
function showPopUpDeets(projID, projName, projComp, imagePre, imageSRC){
		// get position of related Item on screen ('related_' + projID)

		var callObj = 'related_' + projID;

		var objTop = 0;
		var objLeft = 0;
		elementid=document.getElementById(callObj);
		while( elementid != null ){
			objTop += elementid.offsetTop;
			objLeft += elementid.offsetLeft;
			elementid = elementid.offsetParent;
		}
		// alert("link:"+objLeft + ' - ' + objTop);
		
		
		
		// move the position of 'projectDeetsPop' to above and over the correct related item 
		var relatedCenter = objLeft + 24;
		var popTop = objTop - 203;
		var popLeft = relatedCenter - 96;
		
		document.getElementById('projectDeetsPop').style.left = popLeft + 'px';
		document.getElementById('projectDeetsPop').style.top = popTop + 'px';
		
		
		// replace the content of the 'projectDeetsPop' image, title and company with correct project info
		insertHTML('projectDeetsTitle', projName);
		insertHTML('projectDeetsComp', projComp);
		
		var bigThumb = imageSRC.replace("thumbImage", "galleryImage");
			
		changeImages('projImage', imagePre + 'images/gallery/' + bigThumb);
		
		// fade in 'projectDeetsPop'
		new Effect.Appear('projectDeetsPop', { duration: 0.8 });return false;
	}