$(document).ready(function(){
	
	PageInit();
	// Drop Down Catalogue Menu
	$('#nav li a').mouseover(function() {
		$('#catalogue').hide();
	});
	$('#catalogue_button').mouseover(function() {
		$('#catalogue').show();
	});
	$('#catalogue').mouseleave(function() {
		$('#catalogue').hide();
	});
	// User Login Info
	var loggedIn = document.cookie.search(/AHASH/i);
	if (loggedIn > 0) {
		$('#login_info').html('Logged in as ' + userLogonId + ': <a href="/dynamic/account.php">My Account</a> | <a href="/dynamic/account.php?cmd=logout">Logout</a>');
	}
	else {
		$('#login_info').html('<a href="/dynamic/setup_account.php">Register</a> | <a href="/dynamic/login.php">Login</a>');
	}
	// Search Form
	$('#search_button').click(function() {
		$('#search_form').submit();
	});
	
});

/* From: browse_display_each_items.js */


	function BrowseItemView(what)
{
	window.location.href = "/dynamic/viewitem.php?item=" + what;
	return true;
}

function BrowseItemHighLight(obj,what,mode)
{
	switch(what)
	{
		case "box":
			switch(mode)
			{
				case 0:
					obj.className = "browse_display_each_item_over";
					break;
				case 1:
					obj.className = "browse_display_each_item";
					break;
			}
			break;
		case "link":
			switch(mode)
			{
				case 0:
					obj.className = "browse_display_each_item_price_link_active";
					break;
				case 1:
					obj.className = "browse_display_each_item_price_link";
					break;
			}
			break;
	}
	return true;
}

/* From: browse_each_department.js */


	function BrowseDepartmentView(what)
	{
		window.location.href = "/dynamic/browse.php?department=" + what;
		return true;
	}



/* From: browse_featured_item.js */


	function BrowseFeatureView(what)
{
	window.location.href = "/dynamic/viewitem.php?item=" + what;
	return true;
}

function BrowseFeatureHighLight(obj,what,mode)
{
	switch(what)
	{
		case "box":
			switch(mode)
			{
				case 0:
					obj.className = "browse_each_featured_item_over";
					break;
				case 1:
					obj.className = "browse_each_featured_item";
					break;
			}
			break;
	}
	return true;
}

/* From: mainsite.js */


	// JavaScript Document
	var storeCatalogueLink = new String();
	storeCatalogueLink = "";
	var storeAccountLink = new String();
	var dropAccount = false;
	var dropCatalogue = false;

	function PageInit()
	{
		if(requireMiniBasket){FillMiniBasket();}
		if(requireLeftCatalog){FillLeftCatalog();}
		if(displayLeftCatalog){document.getElementById("mainsite_left_navigation_catalog_container").style.display="block";}
		if(requireFooterCatalog){FillFooterCatalog();}
		if(requireCurrency){FillCurrencySelector();}
		//if(displayFooterCatalog){document.getElementById("mainsite_left_catalog_holder").style.display="block";}
		//if(requireSearch){FillSearch();}
		//if(displaySearch){document.getElementById("mainsite_search").style.display="block";}
		//if(requireLogin){FillLogin();}
		//if(displayLogin){document.getElementById("mainsite_login").style.display="block";}
		//if(displayPageLinks){document.getElementById("mainsite_left_navigation_link_container").style.display="block";}
		//if(displayIconLinks){document.getElementById("mainsite_left_navigation_icons_container").style.display="block";}
		
		CollapseEmpty();
		FillSearchBox();
		//if(displayLogin){CheckLoginStatus();}
		//if(showUserLogon){DisplayUserLogon();}
		return true;
	}

/* From: search.js */

function ShowSearchText(obj)
{
	var occlude = document.getElementById("search_site_summary_full_text");
	var x = obj.value;
	if(x == "Show Full Search Text")
	{
		obj.value = "Hide Full Search Text";
		occlude.style.display = "inline";
	}
	else
	{
		obj.value = "Show Full Search Text";
		occlude.style.display = "none";
	}
	return true;
}
function RefineSearch(obj)
{
	var occlude = document.getElementById("search_site_refine_container");
	var x = obj.value;
	if(x == "Refine Your Search")
	{
		obj.value = "Close";
		occlude.style.display = "inline";
	}
	else
	{
		obj.value = "Refine Your Search";
		occlude.style.display = "none";
	}
	return true;
}

/* From: search_results_each_items.js */


	function SearchResultsView(what)
{
	window.location.href = "/dynamic/viewitem.php?item=" + what;
	return true;
}

function SearchResultsHighLight(obj,what,mode)
{
	switch(what)
	{
		case "box":
			switch(mode)
			{
				case 0:
					obj.className = "search_results_each_item_over";
					break;
				case 1:
					obj.className = "search_results_each_item";
					break;
			}
			break;
		case "link":
			switch(mode)
			{
				case 0:
					obj.className = "search_results_each_item_price_link_active";
					break;
				case 1:
					obj.className = "search_results_each_item_price_link";
					break;
			}
			break;
	}
	return true;
}

/* From: small_item.js */


	function SmallItemView(what)
{
	window.location.href = "/dynamic/viewitem.php?item=" + what;
	return true;
}

function SmallItemHighLight(obj,what,mode)
{
	switch(what)
	{
		case "box":
			switch(mode)
			{
				case 0:
					obj.className = "each_small_item_over";
					break;
				case 1:
					obj.className = "each_small_item_out";
					break;
			}
			break;
		case "link":
			switch(mode)
			{
				case 0:
					obj.className = "each_small_item_view_active";
					break;
				case 1:
					obj.className = "each_small_item_view_link";
					break;
			}
			break;
	}
	return true;
}

/* From: viewitem.js */

var viewitemCurrentSelectedInfo = "description";

function ViewitemInfoSelect(which)
{
	var thisFrameID = "iframe_product_info_"+which;
	var thatFrameID = "iframe_product_info_"+viewitemCurrentSelectedInfo;
	var thisBoxID = "product_info_navigation_"+which;
	var thatBoxID = "product_info_navigation_"+viewitemCurrentSelectedInfo;
	viewitemCurrentSelectedInfo = which;
	document.getElementById(thatFrameID).style.display="none";
	document.getElementById(thisFrameID).style.display="block";
	document.getElementById(thatBoxID).className="iframe_deselected";
	document.getElementById(thisBoxID).className="iframe_selected";
	return true;
}



