// JavaScript Document

function init() {
	ieUpdate();
	preloadImgs();
}

function preloadImgs(){
	var i = 0;
    imageObj = new Image();
    images = new Array();     
	images[0]="img/logo_02.jpg";     
	images[1]="img/portfolio_02.jpg";     
	images[2]="img/services_02.jpg"; 
	images[3]="img/contact_02.jpg";
    for(i=0; i<images.length; i++){          
		imageObj.src=images[i];
	}
}

function ieUpdate() {
	objects = document.getElementsByTagName("object");
	for (var i = 0; i < objects.length; i++)
	{
	objects[i].outerHTML = objects[i].outerHTML;
	}	
}

function openWindow(url) {
	newWin = window.open(url,'myWindow','location=1,status=1,scrollbars=1,resizable=1,width=800,height=450');
 	newWin.focus();
}

var project = "";
var selected_thumb = "1"; 
var selected_color = "#99CC33";
var over_color = "#FFFFFF";
var out_color = "#444444";


function borderColor(thumb,mouse_state) {
	if ( thumb != selected_thumb ) {
		thumb_id = "thumb" + thumb;
		statement = "document." + thumb_id + ".style.borderColor = border_color;";
		if ( mouse_state == 'over' ) { border_color = over_color; } else if ( mouse_state == 'out' ) { border_color = out_color; } else if ( mouse_state == 'click' ) { border_color = selected_color; }
		eval(statement);
	}
}

function setCursor(thumb) {
	if ( thumb != selected_thumb ) {
		statement_cursor = "document." + thumb_id + ".style.cursor='pointer';";
		eval(statement_cursor);
	} else if ( thumb == selected_thumb ) {//alert(selected_thumb + ' ' + thumb);
		statement_cursor = "document." + thumb_id + ".style.cursor='default';";
		eval(statement_cursor);
	}
	
}

function selectedThumb(thumb) {
	thumb_id = "thumb" + thumb;
	statement = "document." + thumb_id + ".style.borderColor = selected_color;";
	if ( eval("document." + thumb_id) ) { eval(statement); }
	selected_thumb = thumb;
}

function switchPhoto(thumb) {
	photo_src = "img/project_" + project + "_" + thumb +"_lg.jpg";
	document.photoLg.src = photo_src;
	borderColor(thumb,'click')
	temp_selected = selected_thumb;
	selected_thumb = thumb;
	borderColor(temp_selected,'out')
}

function initProject(project_id,thumb) {
	project = project_id;
	selectedThumb(thumb);
}




