/********************************************************************************************************************
 * Document   : general.js
 * Created on : Apr 15, 2010, 8:09:29 PM
 * Author     : kkuehn
 * Description: Global Javascript file
 * Notes:
 *******************************************************************************************************************/

//alert("into general.js");

function PageLoad()
{
	//alert("into PageLoad()");

	// Preload header background images
	var header01 = new Image(938,215);
	var header02 = new Image(938,215);
	var header03 = new Image(938,215);
	var header04 = new Image(938,215);
	var header05 = new Image(938,215);
	var header06 = new Image(938,215);
	header01.src="../../Images/bg_header01.jpg";
	header02.src="../../Images/bg_header04.jpg";
	header03.src="../../Images/bg_header02.jpg";
	header04.src="../../Images/bg_header03.jpg";
	header05.src="../../Images/bg_header04.jpg";
	header06.src="../../Images/bg_header02.jpg";

	//window.document.getElementById("SupplierList").selectedIndex = 0;
	
/*
	var bgimages = [
	"../../Images/bg_header01.jpg",
	"../../Images/bg_header02.jpg",
	"../../Images/bg_header03.jpg"
	];

 var counter = 0;

 setInterval(function() {
	 $(".ShellHeader").css('backgroundImage', 'url("'+bgimages[counter]+'")');
		counter++;
		if(counter == bgimages.length)
		{
			counter = 0;
		}
 }, 2000);
 */

}

$(document).ready(function(){

	$("ul.NavTopSub").parent().append("<span></span>"); //Only shows drop down button when js is enabled (Adds empty span tag after ul.NavTopSub)

	$("ul.NavTop li span").click(function() {
		
		$(this).parent().find("ul.NavTopSub").slideDown('fast').show();

		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("ul.NavTopSub").slideUp('slow');
		});

		}).hover(function() {
			$(this).addClass("subhover"); //On mouse over
		}, function(){	//On mouse out
			$(this).removeClass("subhover")
	});

	$('.SlideShowHeader').click(function(){
		window.document.location.href="../../Controls/Pages/home.php";
	})

	$('.SlideShowHeader').cycle({
    fx:     'fade',
    speed:   2500,
    timeout: 6000,
    next:   '.SlideShowHeader',
    pause:   1
	});

	// Search Suppliers Dropdown
	$("#ButtonSearchSuppliers").click(function() {

		$(this).parent().find("#ListSuppliers").slideDown('fast').show();

		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("#ListSuppliers").slideUp('slow');
		});
		
	});

	// Search Services Dropdown
	$("#ButtonSearchServices").click(function() {

		$(this).parent().find("#ListServices").slideDown('fast').show();

		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("#ListServices").slideUp('slow');
		});

	});


	/*$("#ButtonSearchSuppliers").click(function() {
		$("#ListSuppliers").slideDown('fast').show();
		$(this).hover(function(){
		}, function(){
			$("#ListSuppliers").slideUp('slow');
		})
	});

	$("#ContainerSearchSuppliers").hover(function(){
		$(this).show();
	}, function(){
		$("#ContainerSearchSuppliers").slideUp('slow');
	})*/
	

});

function aSearchSuppliersHeaderClick()
{
	//alert("into SearchSuppliersHeaderClick()");
	window.document.getElementById('DivSearchSuppliers').style.display = "block";
}

function SearchSerivcesHeaderClick()
{
	//alert("into SearchSerivcesHeaderClick()");
}

function SupplierListClick(supplierlist)
{
	var supplier = supplierlist.options[supplierlist.selectedIndex].value;
	if(supplier != "0")
	{
		window.location.href="../../Controls/Pages/suppliers.php?supplier=" + supplier;
	}
}





