// JavaScript Document

// IMAGE DEFINITIONS

img1     = new Image();
img1.src = "images/nav_portfolio_over.jpg";
img2     = new Image();
img2.src = "images/nav_portfolio.jpg";
img3     = new Image();
img3.src = "images/nav_statement_over.jpg";
img4     = new Image();
img4.src = "images/nav_statement.jpg";
img5     = new Image();
img5.src = "images/nav_cv_over.jpg";
img6     = new Image();
img6.src = "images/nav_cv.jpg";
img7	 = new Image();
img7.src = "images/arrow_prev_over.jpg";
img8	 = new Image();
img8.src = "images/arrow_prev.jpg";
img9	 = new Image();
img9.src = "images/arrow_next_over.jpg";
img10	 = new Image();
img10.src = "images/arrow_next.jpg";
img11	= new Image();
img11.src = "images/nav_portfolio2_over.jpg"
img12	= new Image();
img12.src = "images/nav_portfolio2.jpg"

// IMAGE CHANGE

function changeImg(imgx,placex)  { 
    if (document.images) { 
        document.images[placex].src = eval(imgx + ".src");
    }
}

ns4 = (document.layers) ? true:false //required for Functions to work 
ie4 = (document.all) ? true:false //required for Functions to work 
ng5 = (document.getElementById) ? true:false //required for Functions to work 

// SHOW or HIDE TITLES 

function hideTitle() {
			
	var imageTotal = 9;
		
	for (i=1;i<=imageTotal;i++) {
		if (ng5) document.getElementById('image_' + i).style.visibility = "hidden" 
		else if (ns4) document.layers['image_' + i].visibility = "hide" 
		else if (ie4) document.all['image_' + i].style.visibility ="hidden" 
	}
}
				
function showTitle(n) { 
	
	if (ng5) document.getElementById('image_' + n).style.visibility = "visible"; 
		else if (ns4) document.layers['image_' + n].visibility = "show"; 
		else if (ie4) document.all['image_' + n].style.visibility = "visible";
}

// OPEN POPUP

function openWin(url) {
	// get the height/width of the user's screen
	var screenHeight = screen.availHeight;
	var screenWidth = screen.availWidth;
	
	// set the desired height/width of the new window
	var winWidth = 540;
	var winHeight = 540;
	
	// calculate the exact center
	var winY = Math.round(((screenHeight/2)-(winHeight/2))-50);
	var winX = Math.round((screenWidth/2)-(winWidth/2));
		
	// open the window at the correct position
	var theWin = window.open(url, "dan_win", "width="+winWidth+",height="+winHeight+",top="+winY+",left="+winX+",location=false,resizable=false,statusbar=false,menubar=false,titlebar=true");
	
	// bring the window to the front
	theWin.focus();
}

// POPUP RESIZE

function resizeWin(isVid) {
	// find the image
	var theImage = document.getElementById("picture");
	
	if(isVid) {
		var imageWidth = 480;
		var imageHeight = 610;
	} else {
		// get the image's width and height, converting the strings to integers
		var imageWidth = parseFloat(theImage.getAttribute("width"));
		var imageHeight = parseFloat(theImage.getAttribute("height"));
	}
	
	// get the height/width of the user's screen
	var screenHeight = screen.availHeight;
	var screenWidth = screen.availWidth;
		
	version=0
	if (navigator.appVersion.indexOf("MSIE")!=-1){
		temp=navigator.appVersion.split("MSIE")
		version=parseFloat(temp[1])
		var winWidth = imageWidth + 128;
		var winHeight = imageHeight + 125;
	} else {
	// set the desired height/width of the new window
	var winWidth = imageWidth + 175;
	var winHeight = imageHeight + 70;
	}
	// calculate the exact center
	var winY = Math.round((screenHeight/2)-(winHeight/2));
	var winX = Math.round((screenWidth/2)-(winWidth/2));

	// resize the window
	parent.window.resizeTo(winWidth, winHeight);
	//alert(winWidth);
}