// shw_siteSettings.js (c)2008 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 ftrMenuItems = new Array ();


//////var testMenuItems = new Array();
//////testMenuItems[menuItems.length] = {
//////	id: 'pkgLnk',
//////	mLink: 'nav_packages.gif',
//////	altTxt: 'PACKAGES',
//////	mHref: 'packages/',
//////	subItems: ['PHOTOGRAPHY','VIDEO','PHOTO & VIDEO',['OTHER SERVICES &nbsp;&gt;','subsubItem3']],
//////	subHrefs: ['#','#','#','#'],
//////};
//////
////////alert(testMenuItems[0].subItems[1][1]);
//////alert(typeof testMenuItems[0].subItems[3])
//////






//// ********************************************************************************************************** //

//// ********************************************************************************************************** //
//// ********************************************************************************************************** //
//// ********************************************************************************************************** //
//// ********************************************************************************************************** //
//// *********************************                                        ********************************* //
//// *********************************      DO NOT EDIT ABOVE THIS LINE       ********************************* //
//// *********************************                                        ********************************* //
//// *********************************         SET SITE OPTIONS BELOW         ********************************* //
//// *********************************                                        ********************************* //
//// ********************************************************************************************************** //
//// ********************************************************************************************************** //
//// ********************************************************************************************************** //
//// ********************************************************************************************************** //
////
//
//// THE FOLLOWING LINES AFFECT THE TITLE THAT APPEARS IN THE BROWSER WINDOW'S TITLEBAR
//// [any legal HTML text is allowed]
var defaultTitle = "Berkley Girl";
var titleSeparator = " | ";


//// THE FOLLOWING LINES ARE USED TO BUILD THE SITE-WIDE HEADER MENU
// Each menuItem has several attributes:
// id (required) - the text that will appear as the link, the name of the file to be linked to, the name of the image(gif) if an image is to be used
//			that is, 'about' will appear in the menu or about.png will show,  and link to about.html
// image (required) - set to 1 if images are to be used - set to 0 for a text link
// subItems (optional) - set to a comma separated list of quote-enclosed submenu items. images not allowed.
//			or leave blank empty brakets for no submenu items , i.e. []
// 
// NOTE: menuItems link to an index.html file in the 'id' folder - i.e /contact/index.html
// NOTE: images are in the /img/ folder in the 'shw_menu' folder and images should be named 'id'.gif and 'id'_f2.gif - both files required - the _on.png file is for the mouse rollover event
//		See the example below and follow the pattern:
//
//menuItems[menuItems.length] = {
//	id: 'nav_main_menu',  // corresponds to #id rule in fsmenu_h.css
//	mLink: 'main menu',   // the text to be displayed in the menu (use HTML character codes)
//	mHref: 'menu.html',   // the page to link to (relative to site root)
//	subItems: ['sub item 1', 'sub item 2'],   // list submenu link texts here
//	subHrefs: ['menu.html', 'menu.html']      // list corresponding submenu pages to link to here
//};
//
//		
menuItems[menuItems.length] = {
	id: 'homeLnk',
	mLink: 'nav_home.gif',
	altTxt: 'home',
	mHref: '',
	curPage: 'about'
};

menuItems[menuItems.length] = {
	id: 'shopLnk',
	mLink: 'nav_shop.gif',
	altTxt: 'shop online!',
	mHref: 'shop/',
	curPage: 'shop'
};

menuItems[menuItems.length] = {
	id: 'buzzLnk',
	mLink: 'nav_buzz.gif',
	altTxt: 'the buzz',
	mHref: 'buzz/',
	curPage: 'buzz'
};

menuItems[menuItems.length] = {
	id: 'friendsLnk',
	mLink: 'nav_friends.gif',
	altTxt: 'friends',
	mHref: 'friends/',
	curPage: 'friends'
};

menuItems[menuItems.length] = {
	id: 'commLnk',
	mLink: 'nav_comm.gif',
	altTxt: 'the community',
	mHref: 'community/',
	curPage: 'community'
};

menuItems[menuItems.length] = {
	id: 'visitLnk',
	mLink: 'nav_visit.gif',
	altTxt: 'visit us',
	mHref: 'visit/',
	curPage: 'visit'
};

//menuItems[menuItems.length] = {
//	id: 'hotLnk',
//	mLink: 'nav_hot.gif',
//	altTxt: 'whats hot',
//	mHref: 'hot/',
//	curPage: 'hot'
//};

// ------------------------- these are for the footer menu links ------------------------- //
// 
ftrMenuItems[ftrMenuItems.length] = {
	mLink: 'about us',
	mHref: 'index.html'
};

ftrMenuItems[ftrMenuItems.length] = {
	mLink: 'community',
	mHref: 'community/' 
};

//ftrMenuItems[ftrMenuItems.length] = {
//	mLink: 'what\'s hot',
//	mHref: 'hot/'
//};

ftrMenuItems[ftrMenuItems.length] = {
	mLink: 'shop online',
	mHref: 'shop/'
};

ftrMenuItems[ftrMenuItems.length] = {
	mLink: 'friends',
	mHref: 'friends/'
};

ftrMenuItems[ftrMenuItems.length] = {
	mLink: 'visit us',
	mHref: 'visit/'
};

ftrMenuItems[ftrMenuItems.length] = {
	mLink: 'the buzz',
	mHref: 'buzz/'
};


// --------------------------------------------------------------------------- //




//// ********************************************************************************************************** //

//// ********************************************************************************************************** //
//// ********************************************************************************************************** //
//// ********************************************************************************************************** //
//// ********************************************************************************************************** //
//// *********************************                                        ********************************* //
//// *********************************      DO NOT EDIT BELOW THIS LINE       ********************************* //
//// *********************************                                        ********************************* //
//// ********************************************************************************************************** //
//// ********************************************************************************************************** //
//// ********************************************************************************************************** //
//// ********************************************************************************************************** //

//// ********************************************************************************************************** //

var isitIE = false;
var isitIE8 = false;
var isitIE7 = false;
var isitIE6 = false;
if (window.attachEvent && !window.opera) { //object-detect IE5+, exclude opera
	isitIE = true;
	if(navigator.appVersion.match(/MSIE 8/)) { isitIE8 = true; }
	if(navigator.appVersion.match(/MSIE 7/)) { isitIE7 = true; }
	if(navigator.appVersion.match(/MSIE 6/)) { isitIE6 = true; }
	document.write("<meta HTTP-EQUIV=\"imagetoolbar\" content=\"no\">");
}

//// 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
	};
}
// so we can dynamically add event watchers...
var addEvent = function( obj, type, fn ) {
	if (obj.addEventListener) {
		obj.addEventListener(type, fn, false);
	} else if (obj.attachEvent) {
		obj.attachEvent('on' + type, function() { return fn.apply(obj, new Array(window.event)); });
	}
}; 

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




// these vars used in shwFade to define the ss container for image centering
// on this site, set to values from css
//var maxvpW = 980;
//var maxvpH = 402;



//function doLogo() {
//	var logo = d.getElementById('logo');
//	logo.onmouseover = function() {
//		logo.src = rootPath + 'img/hdr_logo_on.gif';
//	}
//	logo.onmouseout = function() {
//		logo.src = rootPath + 'img/hdr_logo.gif';
//	}
//}

function makeMenu() {
var menuParent = d.getElementById('menu'), page_body = d.getElementsByTagName('body');
	if (!menuParent) { return; }
	menuParent.innerHTML = '';
	var menu = d.createElement('ul');
	menu.className = 'menulist';
	//menu.setAttribute('id', 'listMenuRoot');
	var subsubMenus = new Array();
	for (var i = 0; i < menuItems.length; i++) {
		menuItems[i].li = d.createElement('li');
		// the following if statement classes the leftmost li tag to align correctly
		if(i == 0) {
			menuItems[i].li.className = 'left';
		}
		menuItems[i].a = d.createElement('a');
		//menuItems[i].a.className = 'special';
		if(menuItems[i].id) {
			menuItems[i].a.id = menuItems[i].id; // id is on the a tag!
		}
		if(menuItems[i].mHref == '#') {
			menuItems[i].a.href = '#';
		} else {	
			menuItems[i].a.href = rootPath + menuItems[i].mHref;
		}
		if(menuItems[i].mLink.match(/(\.gif$)|(\.jpg$)/)) {
			var linkImgExt = menuItems[i].mLink.match(/(\.gif$)|(\.jpg$)/);
			var mLinkImg = d.createElement('img');
			if(menuItems[i].altTxt) {
				mLinkImg.alt = menuItems[i].altTxt;
			}

//			if(menuItems[i].curPage == page_body[0].id) {// alert(page_body[0].id);
			if( (menuItems[i].curPage == page_body[0].id) ||  ((menuItems[i].curPage == 'shop') && (page_body[0].id.match(/.*Body/))) ) {
				var curPageSrc = rootPath + 'img/menu/' + menuItems[i].mLink.replace(/(\.gif$)|(\.jpg$)/,'_f2');
				mLinkImg.src = curPageSrc + linkImgExt[0];
				mLinkImg.onmouseover = '';
				mLinkImg.onmouseout = '';
				menuItems[i].a.className = 'disabledLnk';
				menuItems[i].a.onclick = function() {return false;};
			} else {// alert(page_body[0].id);
				mLinkImg.src = rootPath + 'img/menu/' + menuItems[i].mLink;
				mLinkImg.onmouseover = function() {
					var menuItemsOver = this.src.replace(/(\.gif$)|(\.jpg$)/,'_f2');
					this.src = menuItemsOver + linkImgExt[0];
				}
				mLinkImg.onmouseout = function() {
					var menuItemsOut = this.src.replace(/(_f2\.gif$)|(_f2\.jpg$)/,'');
					this.src = menuItemsOut + linkImgExt[0];
				}
				menuItems[i].a.className = '';
				menuItems[i].a.onclick = '';
			}
			if (isitIE === true) {
				mLinkImg.style.width = 'auto';
			}
			menuItems[i].a.appendChild(mLinkImg);
			
		} else {
			menuItems[i].a.innerHTML = menuItems[i].mLink.replace(/\s/g, '&nbsp;');
		}
		menuItems[i].li.appendChild(menuItems[i].a);
		
		menu.appendChild(menuItems[i].li);
	}
	menuParent.appendChild(menu);
	//activateMenu();
}
//var listMenu = new Object();
//function activateMenu() {
//	listMenu = new FSMenu('listMenu', true, 'display', 'block', 'none');
//	listMenu.animations[listMenu.animations.length] = FSMenu.animSwipeDown;
//	listMenu.activateMenu("listMenuRoot", null);
//	// Activation: Include the ID for your menu in here.
//	//setTimeout('activePageHighlight("listMenuRoot");',1);
//}


// this controls the plain links in the footer "info" div
function makeFtrMenu() {
	var menuParent = d.getElementById('info');
	if (!menuParent) { return; }
	menuParent.innerHTML = '';
	var menu = d.createElement('ul');
	menu.className = 'ftrLnks';
	for (var i = 0; i < ftrMenuItems.length; i++) {
		ftrMenuItems[i].li = d.createElement('li');
		// the following if statement classes the leftmost li tag to align correctly
		if(i == 0) {
			ftrMenuItems[i].li.className = 'left';
		}
		ftrMenuItems[i].a = d.createElement('a');
		//ftrMenuItems[i].a.className = 'txtlnk';
//		if(ftrMenuItems[i].mLink == '(808) 537-6484') {
//			ftrMenuItems[i].a.className = 'nolnk';
//		}
		if(ftrMenuItems[i].mHref == '#') {
			ftrMenuItems[i].a.href = '#';
		} else {
			ftrMenuItems[i].a.href = rootPath + ftrMenuItems[i].mHref;
		}
		ftrMenuItems[i].a.innerHTML = ftrMenuItems[i].mLink.replace(/\s/g, '&nbsp;');
		ftrMenuItems[i].li.appendChild(ftrMenuItems[i].a);
		
		menu.appendChild(ftrMenuItems[i].li);
	}
	menuParent.appendChild(menu);
	var order = d.createElement('p');
	order.innerHTML = 'Shop online at our new BG Online Store! &nbsp;We ship to anywhere in the United States.<br />For questions about your order, please call us at 212.877.4770 or 212.744.9507.'; // If you are interested in placing an order, please call us at 212.877.4770 or 212.744.9507.<br />We are happy to ship anywhere in the United States.
	menuParent.appendChild(order);
	var copy = d.createElement('p');
	copy.className = 'webmark';
	copy.innerHTML = '&copy; 2009 Berkley Girl.&nbsp;&nbsp;berkley girl<span style=\"vertical-align:super;font-size:60%;\">SM</span> is a registered service mark.&nbsp;&nbsp;Berkley girl with dog logo is a &#174; registered trademark.<br />All rights reserved.&nbsp;&nbsp;<a href=\"mailto:mimi10023@aol.com\">Paintings by Melissa Martinez</a>.&nbsp;&nbsp;<a onclick=\"newWin=window.open(this.href,\'new_win\');newWin.focus();return false;\" href=\"http://tkcunninghamphoto.com\">Photos by TK Cunningham</a>.&nbsp;&nbsp;<a onclick=\"newWin=window.open(this.href,\'new_win\');newWin.focus();return false;\" href=\"http://sugarhillworks.com\">Site by SugarHill Works</a>.';
	menuParent.appendChild(copy);
}


// things to do onload...
addEvent(window, 'load', function() {
	getRootPath();
	makeMenu();
	makeFtrMenu();
});
//addEvent(window, 'load', function() {
//});
//addEvent(window, 'load', function() {
//});
//addEvent(window, 'load', function() {
//	doLogo();
//});



