
/************************************************************************************
  The following lines determine the current working directory. Once this is
  established, then the root directory is determined. The variable [rootURL] is
  used throughout the scripts on this site for various links.

  Change History:
  ---------------------------------------------------------------------------------
  Date      Initials	Description of Change
  ---------------------------------------------------------------------------------
  12.27.05  CG		Logic Developed
  01.30.06  CG		Added logic to manage URL by hostname (support for localhost)
  08.02.06  CG		Renamed "Special Events" to Weddings and moved menu choices
  			around to be more suitable to audience
  02.04.07  CG		Added new pages to Photography Services menu
  07.08.07  CG		Updated to reflect change to CCG Creative Studios
  03.12.08  CG		Added booking page to "About Us" drop down
  07.01.08  CG		Changed Main Header to separate out the services
  11.19.08  CG		Added "Special Projects" Gallery link
  06.23.09  CG		Added "Prices and Packages" to Photography Menu
************************************************************************************/

var thisHOST = unescape(location.hostname);
var thisURL  = unescape(window.location.pathname);
var currDIR  = thisURL.substr(1,thisURL.lastIndexOf('\/') - 1);
var currURL  = thisURL.substring(thisURL.lastIndexOf('\/') + 1);
var currLEN  = currURL.length;
var thisPage = currURL.substring(currURL.lastIndexOf('\\') + 1);
var thisLEN  = thisPage.length;
var rootLEN  = currLEN - thisLEN;
var rootURL  = currURL.substr(0,rootLEN);

// *** CURRENT TIME ***

var currDATE = new Date();
var currHOUR = currDATE.getHours();
var currMINS = currDATE.getMinutes();
var currSECS = currDATE.getSeconds();
var currMILL = currDATE.getMilliseconds();
var currTIME = currHOUR + ' ' + currMINS + ' ' + currSECS + ' ' + currMILL;

// *** ALERTS (FOR TESTING) ***

// alert ('"' + thisHOST + '"');
// alert ('"' + thisPage + '"');
// alert ('"' + thisHOST + thisURL + '"');
// alert ('"' + thisURL + '"'); // full page with directory (after hostname)
// alert ('"' + currDIR + '"');
// alert ('"' + currURL + '"');
// alert ('"' + rootURL + '"');
// alert ('"' + currTIME + '"');

// *** LOGIC BEGINS ***

if (rootURL == "")
	{
		// alert ('Will not get to DIR Section...');
		if (thisHOST == "localhost" || thisHOST == "192.168.1.101")
			{
				var rootURL = "http://localhost/";
				var prodURL = "http://www.ccgcreativestudios.com/";
				var testURL = rootURL; // "http://www.ccgcreations.com/"; //
			}
		else
			{
				if (thisHOST == "www.ccgcreativestudios.com" || thisHOST == "ccgcreativestudios.com")
					{
						var rootURL = "http://www.ccgcreativestudios.com/";
						var prodURL = rootURL;
						var testURL = rootURL;
					}
				else
					{
						var rootURL = "http://www.ccgcreations.com/";
						var prodURL = "http://www.ccgcreativestudios.com/";
						var testURL = rootURL;
					}
			}
	}
else
	{
		// alert ('Got to DIR Section...');
		var prodURL  = rootURL;
		var pathLEN  = rootURL.lastIndexOf('\\',rootLEN - 2);
		var currDIR  = rootURL.substr(pathLEN + 1,(rootLEN - (pathLEN + 2)));
		var DIR      = currDIR;

		if (DIR == "about" || DIR == "photography" || DIR == "photo-to-art" || DIR == "photocart" || DIR == "galleries" || DIR == "forums")
			{
				rootURL = rootURL.substr(0,pathLEN + 1);
			};
	};

// alert ('"' + rootURL + '"');
// alert ('"' + pathLEN + '"');

if (currDIR == "photocart")
	{
		var topPos = 146
		// alert ('"' + rootURL + '"')
	}
else
	{
		var topPos = 134
	};

// alert ('"' + topPos + '"');
// alert ('"' + testURL + '"');

if (testURL == "http://www.ccgcreations.com/")
	{
		// alert ("Got Here");
		if (thisPage == "ccgannounce.html")
			{
				// You're here now...
				// alert ('"' + thisURL + '"');
			}
		else
			{
				// alert ("Going to CCG Announce...");
				// alert ('"' + currDIR + '"');
				if (currDIR == "")
					{
						var GoPage = currURL;
					}
				else
					{
						var GoPage = currDIR + "\/" + currURL;
					}

				// alert ('"' + GoPage + '"');
				// TEST Version:
				// window.location = rootURL + "ccgannounce.html?Page=" + GoPage;

				window.location = prodURL + "ccgannounce.html?Page=" + GoPage;
			}
	};

// ****************************************************************
// Before dynamically setting rootURL...
// var rootURL = "http://www.ccgcreations.com/"
// ****************************************************************

function init()
{
// Main Menu items:
	menus[0] = new menu(20, "horizontal", 24, topPos, -1, -1, "#5a6f7d", "#5a6f7d", "Verdana,Helvetica", 8,
		"bold", "bold", "white", "white", 0, "gray", 2, "", false, true, true, false, 0, false, 0, 0, "black");
	menus[0].addItem(rootURL, "", 70, "left", "Home", 0);
	menus[0].addItem(rootURL + "about/about-us.html", "", 90, "left", "About Us", 1);
	menus[0].addItem(rootURL + "photography/studio-services.html", "", 115, "left", "Photography", 2);
	menus[0].addItem(rootURL + "photography/restore-services.html", "", 110, "left", "Restoration", 3);
	menus[0].addItem(rootURL + "photography/preserve-services.html", "", 110, "left", "Show it Off!", 4);
	menus[0].addItem(prodURL + "photocart/index.php", "", 90, "left", "Galleries", 5);
	menus[0].addItem(rootURL + "forums/ccgcreative.html", "", 110, "left", "Forums", 6);

// ****************************************************************
// Sub Menu for Main Menu Item ("About Us"):
// ****************************************************************
	menus[1] = new menu(170, "vertical", 0, 0, -5, -5, "#FFFFFF", "#5a6f7d", "Verdana,Helvetica", 7.5, "",
		"bold", "#5a6f7d", "white", 1, "#899ead", 4, "rollover:/images/tri-right1.gif:/images/tri-right2.gif",
		false, true, false, false, 0, true, 4, 4, "black");
	menus[1].addItem(rootURL + "about/about-us.html", "", 22, "left", "About Our Company", 0);
	menus[1].addItem(rootURL + "about/values.html", "", 22, "left", "Company Values", 0);
	menus[1].addItem(rootURL + "about/contact.html", "", 22, "left", "Contact Us", 0);
	menus[1].addItem(rootURL + "about/book-us.html", "", 22, "left", "Book an Appointment", 0);
	menus[1].addItem(rootURL + "about/associations.html", "", 22, "left", "Associations", 0);
	menus[1].addItem(rootURL + "about/testimonials.html", "", 22, "left", "Testimonials", 0);

// ****************************************************************
// Sub Menu for Main Menu Item ("Photography"):
// ****************************************************************
	menus[2] = new menu(242, "vertical", 0, 0, -6, -1, "#FFFFFF", "#5a6f7d", "Verdana,Helvetica", 7.5, "",
		"bold", "#5a6f7d", "white", 1, "#899ead", 4, "rollover:/images/tri-right1.gif:/images/tri-right2.gif",
		false, true, false, false, 0, true, 4, 4, "black");
	menus[2].addItem(rootURL + "photography/wedding.html", "", 22, "left", "Wedding Photography", 0);
	menus[2].addItem(rootURL + "photography/portraits.html", "", 22, "left", "Portrait Photography", 0);
	menus[2].addItem(rootURL + "photography/events.html", "", 22, "left", "Concert and Event Photography", 0);
	menus[2].addItem(rootURL + "photography/sports.html", "", 22, "left", "Sports Team Photography", 0);
	menus[2].addItem(rootURL + "photography/nature.html", "", 22, "left", "Art and Nature Photography", 0);
	menus[2].addItem(rootURL + "photography/pricing.html", "", 22, "left", "Prices and Packages", 0);

// ****************************************************************
// Sub Menu for Main Menu Item ("Restoration"):
// ****************************************************************
	menus[3] = new menu(170, "vertical", 0, 0, 0, 0, "#FFFFFF", "#5a6f7d", "Verdana,Helvetica", 7, "",
		"bold", "#5a6f7d", "white", 1, "#899ead", 4, ">>", false, true, false, false, 0, true, 4, 4, "black");
	menus[3].addItem(rootURL + "photography/restore.html", "", 22, "left", "Photo Restoration", 0);
	menus[3].addItem(rootURL + "photography/correct.html", "", 22, "left", "Color Correction", 0);
	menus[3].addItem(rootURL + "photography/time.html", "", 22, "left", "Time Machine", 0);

// ****************************************************************
// Sub Menu for Main Menu Item ("Show it Off"):
// ****************************************************************
	menus[4] = new menu(170, "vertical", 0, 0, 0, 0, "#FFFFFF", "#5a6f7d", "Verdana,Helvetica", 7, "",
		"bold", "#5a6f7d", "white", 1, "#899ead", 4, ">>", false, true, false, false, 0, true, 4, 4, "black");
	menus[4].addItem(rootURL + "photography/medley.html", "", 22, "left", "Photo Medley DVDs", 0);
	menus[4].addItem(rootURL + "photography/framing.html", "", 22, "left", "Matting and Framing", 0);
	menus[4].addItem(rootURL + "photography/memories.html", "", 22, "left", "Scrapbooking", 0);
	menus[4].addItem(rootURL + "photo-to-art/myphotoart.html", "", 22, "left", "Photo-to-Art", 0);
	menus[4].addItem(rootURL + "photo-to-art/products.html", "", 22, "left", "Photo Products", 0);

// ****************************************************************
// Sub Menu for Main Menu Item ("Photo-to-Art"):
// ****************************************************************
//	menus[3] = new menu(210, "vertical", 0, 0, -6, -1, "#FFFFFF", "#5a6f7d", "Verdana,Helvetica", 7.5, "",
//		"bold", "#5a6f7d", "white", 1, "#899ead", 4, "rollover:/images/tri-right1.gif:/images/tri-right2.gif",
//		false, true, false, false, 0, true, 4, 4, "black");
//	menus[3].addItem(rootURL + "photo-to-art/myphotoart.html", "", 22, "left", "What is Photo-to-Art?", 0);
//	menus[3].addItem(rootURL + "photo-to-art/canvas.html", "", 22, "left", "Gallery Wrapped Canvas", 0);
//	menus[3].addItem(rootURL + "photo-to-art/woven.html", "", 22, "left", "Woven Throw or Tapestry", 0);
//	menus[3].addItem(rootURL + "photo-to-art/giftbox.html", "", 22, "left", "Give Them As Gift Boxes", 0);
//	menus[3].addItem(rootURL + "photo-to-art/testimonial.html", "", 22, "left", "Customer Testimonials", 0);

// ****************************************************************
// Sub Menu for Main Menu Item ("Galleries"):
// ****************************************************************
	menus[5] = new menu(265, "vertical", 0, 0, -6, -1, "#FFFFFF", "#5a6f7d", "Verdana,Helvetica", 7.5, "",
		"bold", "#5a6f7d", "white", 1, "#899ead", 4, "rollover:/images/tri-right1.gif:/images/tri-right2.gif",
		false, true, false, false, 0, true, 4, 4, "black");
	menus[5].addItem(prodURL + "photocart/index.php?category=101", "", 22, "left", "Wedding and Engagement Gallery", 0);
	menus[5].addItem(prodURL + "photocart/index.php?category=102", "", 22, "left", "Family Portrait Gallery", 0);
	menus[5].addItem(prodURL + "photocart/index.php?category=103", "", 22, "left", "Senior Portrait Gallery", 0);
	menus[5].addItem(prodURL + "photocart/index.php?category=109", "", 22, "left", "Concert and Event Gallery", 0);
	menus[5].addItem(prodURL + "photocart/index.php?category=100", "", 22, "left", "Art and Nature Gallery", 0);
	menus[5].addItem(prodURL + "photocart/index.php?category=105", "", 22, "left", "Special Projects Gallery", 0);
	menus[5].addItem(prodURL + "photocart/index.php?do=photocart&action=accessGallery", "", 22, "left", "Private Gallery - Access Code Reqd", 0);
	menus[5].addItem(rootURL + "galleries/public.html", "", 22, "left", "Public Photo Sharing Site", 0);

// ****************************************************************
// Sub Menu for Main Menu Item ("Forums"):
// ****************************************************************
	menus[6] = new menu(215, "vertical", 0, 0, -6, -1, "#FFFFFF", "#5a6f7d", "Verdana,Helvetica", 7.5, "",
		"bold", "#5a6f7d", "white", 1, "#899ead", 4, "rollover:/images/tri-right1.gif:/images/tri-right2.gif",
		false, true, false, false, 0, true, 4, 4, "black");
	menus[6].addItem(rootURL + "forums/ccgcreative.html", "", 22, "left", "CCG Creative Studios Forum", 0);
	menus[6].addItem(rootURL + "forums/canon-photo.html", "", 22, "left", "Canon Public Forum", 0);
	menus[6].addItem(rootURL + "forums/digital-photo.html", "", 22, "left", "Digital Photography Forum", 0);

} //OUTER CLOSING BRACKET. EVERYTHING ADDED MUST BE ABOVE THIS LINE.