var currentImage;
var imageCount;

function previewMe(dir,who){
	var preview = document.getElementById("preview"); 
	preview.src = dir + "/" + who + "/preview.jpg";
}

function menuMe(on,who,listings){
	var menuButton = document.getElementById(who); 
	if(on == true){
		menuButton.src = "http://www.duarchitects.com/images/menu/"+who+"9.gif";
	}else{
		if(listings == true){
			menuButton.src = "http://www.duarchitects.com/images/menu/"+who+"Gray.gif";
		}else{
			menuButton.src = "http://www.duarchitects.com/images/menu/"+who+"White.gif";
		}
		
	}
}

function prevNextMe(on,who){
	var prevNext = document.getElementById(who); 
	if(on == true){
		prevNext.src = "http://www.duarchitects.com/images/prevNext/"+who+"0.gif";
	}else{
		prevNext.src = "http://www.duarchitects.com/images/prevNext/"+who+"Black.gif";
	}
}

function workMe(who,which){
	url = "myWindow.php?who=" + who + "&which=" + which;
	myWindow = window.open(url,"myWindow","width=552, height=350, resizable=no, scrollbars=no, toolbar=no, directories=no, status=no, menubar=no, copyhistory=no");
}

function showImage(who,which,ic){
	var DU = document.getElementById("DU");
	var DUH = DU.offsetHeight;
	//alert(DUH);
	var hiddenArea = document.getElementById("hiddenArea");
	var myImage = document.getElementById("myImage");
	var imageString = "<img src=\"" +who + "/lg/" + which + ".jpg\" border=\"none\">";
	//aa.style.visibility = "visible";
	hiddenArea.style.height = DUH + "px";
	hiddenArea.style.visibility = "visible";
	myImage.innerHTML = imageString;
	currentImage = which;
	imageCount = ic;
}

function hideImage(){
	//var hiddenArea = document.getElementById("aa");
	var hiddenArea = document.getElementById("hiddenArea");
	//aa.style.visibility = "hidden";
	hiddenArea.style.visibility = "hidden";
}

function nextImage(who,which){
	var myImage = document.getElementById("myImage");
	if(which==true){
		if(currentImage < imageCount){
			currentImage++;
			var imageString = "<img src=\"" +who + "/lg/" + currentImage + ".jpg\" border=\"none\">";
			myImage.innerHTML = imageString;
		}
	}else{
		if(currentImage > 1){
			currentImage--;
			var imageString = "<img src=\"" +who + "/lg/" + currentImage + ".jpg\" border=\"none\">";
			myImage.innerHTML = imageString;
		}
	}
}

function getWinWidth() {
	if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    return(window.innerWidth);
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    return(document.documentElement.clientWidth);
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    return(document.body.clientWidth);
  }

}
function getWinHeight() {
	if( typeof( window.innerHeight ) == 'number' ) {
    //Non-IE
    return(window.innerHeight);
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    return(document.documentElement.clientHeight);
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    return(document.body.clientHeight);
  }
}
