/* shw_siteSettings.js (c)2007 SugarHill Works LLC - http://www.sugarhillworks.com */

var d = document;

var rootPath = "";
//function getRootPath() {
//	for(var i = 2; i < rootPathNum; i++) {
//		rootPath += "../";
//	}
//	return rootPath;
//}
//var menuItems = new Array();
//

var splashImages = new Array();
var i = 0;

var defaultTitle = "";
var titleSeparator = "";
var contactTitle = "";

//
//
// THE FOLLOWING LINES AFFECT THE TITLE THAT APPEARS IN THE BROWSER WINDOW'S TITLEBAR
//
defaultTitle = "NIGEL HO-SANG";
titleSeparator = " | ";
contactTitle = "CONTACT";


// THE FOLLOWING SECTION LISTS THE POOL OF IMAGES FROM WHICH TO SHOW ONE RANDOMLY ON THE SPLASH PAGE
//

//splashImages[i] = "mary-story-8.jpg";
//i++;

splashImages[i] = "eyen-18.jpg";
i++;

//splashImages[i] = "army-13.jpg";
//i++;

//splashImages[i] = "brasil-2_2009.jpg";
//i++;

//splashImages[i] = "07_street-19.jpg";
//i++;

//splashImages[i] = "cyan.6.jpg";
//i++;


//
//
//
//
//
// ********************************************************************************************************** //
// ********************************************************************************************************** //
// *********************************                                        ********************************* //
// *********************************      DO NOT EDIT BELOW THIS LINE       ********************************* //
// *********************************                                        ********************************* //
// ********************************************************************************************************** //
// ********************************************************************************************************** //
//
//
//
//
//
//
//
// randomize the order of splashpage imgs
splashImages.sort( randOrd );


var isitIE = false;
var isitIE7 = false;
if (window.attachEvent && !window.opera) { //object-detect IE5+, exclude opera
	isitIE = true;
	if(navigator.appVersion.match(/MSIE 7/)) isitIE7 = true
}
//
//// turn off 'image toolbar' in older versions of IE
if(isitIE == true){
	document.write("<meta HTTP-EQUIV=\"imagetoolbar\" content=\"no\">");
}
//
// for IE6+ so we can use appendChild, etc...
if (!window.Node) {
	var Node = {
		ELEMENT_NODE: 1,
		ATTRIBUTE_NODE: 2,
		TEXT_NODE: 3,
		COMMENT_NODE: 8,
		DOCUMENT_NODE: 9,
		DOCUMENT_FRAGMENT_NODE: 11
	};
}

function randOrd(){
	return (Math.round(Math.random())-0.5);
}

// preload basic site images
var pld_01 = new Image();
pld_01.src = "img/";
var pld001 = new Image();
pld001.src = "img/";
var pld002 = new Image();
pld002.src = "img/";



function site_init() {
	//document.getElementsByTagName('title')[0].text = defaultTitle;// + titleSeparator + portfolioTitle;
	//getRootPath();
	//makeMenu();
	//doLogo();
	//makeCopyFtr();
}


// global portfolio vars
var imgs = [];
var gi = 0;
var imageFilenames = [];




var maxvpW = 818; //for slideshow image centering: should be set to same as xfsoContianer width in shw_global.css
var maxvpH = 525; //for slideshow image centering
var ceibw;
var main_div;
var gPicsFolder, sPicsFolder;
var ldgGif;
function loadNums() {
	ceibw = document.getElementById("ceibw");
	main_div = document.getElementById("main_div");
	if(main_div){
		if (screen.height < 855) {
			gPicsFolder = "img/medium";
			sPicsFolder = "splash_imgs/medium/";
			ceibw.style.height = "600px";
			ceibw.style.width = "818px";
			if (screen.height < 770) {
				ceibw.style.margin = "10px auto 0px auto";
			}
			else {
				ceibw.style.margin = "25px auto 0px auto";
			}
			maxvpH = 525;
			main_div.style.height = maxvpH + "px";
			//ldgGif = "ldg.gif";
		}
		if (screen.height >= 855) {
			gPicsFolder = "img/large";
			sPicsFolder = "splash_imgs/large/";
			ceibw.style.height = "700px";
			ceibw.style.width = "980px";
			ceibw.style.margin = "25px auto 0px auto";
			maxvpH = 625;
			main_div.style.height = maxvpH +"px";
			//alert(main_div.style.height);
			//ldgGif = "ldg.gif";
		}
		//main_div.style.backgroundColor = "#F00";
	return ceibw, main_div, gPicsFolder, sPicsFolder; // ldgGif;
}}


function makeCopyFtr() {
	var copyParent = d.getElementById('copy');
	copyParent.innerHTML = '';	
	copyParent.className = 'credits';
	var copy_p = d.createElement('p');
	copy_p.innerHTML = '<span>All images &copy; Nigel Ho-Sang.</span>&nbsp;&nbsp;&nbsp;<a href=\"http://sugarhillworks.com \"onclick=\"newWin=window.open(this.href,\'newWin\');newWin.focus();return false;\">Site by SugarHill Works</a>.';
	copyParent.appendChild(copy_p);
}


// ------------------------------ SHW webmark ----------------------------
function make_shwFtr() {
	//set the pCap text on the splash page
	var pageBody = document.getElementsByTagName("body");
//	if (pageBody[0].id == 'splash') {
//		document.getElementById('pCap').innerHTML = ftrTxt;
//	}
	//-----------------------------------------------------
	// set up header img rollover
//	var hdrImg = document.getElementById("logo");
//	hdrImg.onmouseover = function hdrover() {
//		hdrImg.src = rtPth + "img/name_on.gif";
//	};
//	hdrImg.onmouseout = function hdrout() {
//		hdrImg.src = rtPth + "img/name.gif";
//	};
	//-----------------------------------------------------
	//add the sugarhill works webmark
	var shwFtrDiv = document.createElement("div");
	shwFtrDiv.style.position = "absolute";
	shwFtrDiv.style.right = "10px";
	shwFtrDiv.style.bottom = "5px";
	shwFtrDiv.style.width = "auto";
	shwFtrDiv.style.height = "auto";
	
	var shwFtrLnk = document.createElement("a");
	shwFtrLnk.href = "http://sugarhillworks.com";
	shwFtrLnk.target = "newWin";
	
    var shwWebmark = new Image();
	shwWebmark = document.createElement("img");
	shwWebmark.src = rtPth + "img/webmark.gif";
	shwWebmark.onmouseover = function shwWover() {
		shwWebmark.src = rtPth + "img/webmark_on.gif";
	};
	shwWebmark.onmouseout = function shwWout() {
		shwWebmark.src = rtPth + "img/webmark.gif";
	};
	
	pageBody[0].appendChild(shwFtrDiv);
	shwFtrDiv.appendChild(shwFtrLnk);
	//shwFtrLnk.appendChild(document.createTextNode("site by sugarhill works"));
	shwFtrLnk.appendChild(shwWebmark);
	//-----------------------------------------------------

}
