
/**************************************
	Main Navigation Rollover
**************************************/

	$(document).ready(function(){
		$("#mainNavigation a[class*=mN]:not('.selected')").fadeTo("fast", 0);
	
		$("#mainNavigation a[class*=mN]:not('.selected')").hover(function(){
			$(this).stop().fadeTo("normal", 1.0); // This should set the opacity to 100% on hover
		},function(){
			$(this).stop().fadeTo("normal", 0); // This should set the opacity back to 60% on mouseout
		});
	});




/*********************************
		Dropdown Menu (IE Support)
*********************************/
	<!--//--><![CDATA[//><!--

	startList = function() {
		if (document.all&&document.getElementById) {
			navRoot = document.getElementById("mainNavigation");
			for (i=0; i<navRoot.childNodes.length; i++) {
				node = navRoot.childNodes[i];
				if (node.nodeName=="LI") {
					node.onmouseover=function() {
						this.className+=" over";
					}
					node.onmouseout=function() {
						this.className=this.className.replace(" over", "");
					}
				}
			}
		}
	}
	window.onload=startList;
	
	//--><!]]>




/*********************************
		Tooltip
*********************************/
	this.tooltip = function(){	
		/* CONFIG */		
			xOffset = 10;
			yOffset = 20;		
			// these 2 variable determine popup's distance from the cursor
			// you might want to adjust to get the right result		
		/* END CONFIG */		
		$("#galleryWrapper img").hover(function(e){											  
			this.t = this.alt;
			this.alt = "";									  
			$("body").append("<p id='tooltip'>"+ this.t +"</p>");
			$("#tooltip")
				.css("top",(e.pageY - xOffset) + "px")
				.css("left",(e.pageX + yOffset) + "px")
				.fadeIn("fast");		
	    },
		function(){
			this.alt = this.t;		
			$("#tooltip").remove();
	    });	
		$("#galleryWrapper img").mousemove(function(e){
			$("#tooltip")
				.css("top",(e.pageY - xOffset) + "px")
				.css("left",(e.pageX + yOffset) + "px");
		});			
	};

	// starting the script on page load
	$(document).ready(function(){
		tooltip();
	});




/*********************************
		Lightbox
*********************************/
	$(function() {
		$('#galleryWrapper a').lightBox();
	});




/*********************************
		Open Popup Browser
*********************************/
	function MM_openBrWindow(theURL,winName,features) {
		window.open(theURL,winName,features);
	}




/*********************************
		Custom Dropdown Select
*********************************/
	
	$(document).ready(function() {
	redrawSelectBoxes();
	});
	function redrawSelectBoxes() {
	    $(".customDropDown, .customDropDownWrapper").remove();
	    var $selectBoxes = $("#customDD");
	    for (var i = 0; i < $selectBoxes.length; i++) {
		   var ddl = $selectBoxes.get(i);
		   var width = ddl.style.width ? ddl.style.width : "175px";
		   var selText = ddl.selectedIndex != null ? ddl.options[ddl.selectedIndex].text : "";
		   var div = "<div class='customDropDownWrapper customDropDownSelector' style='width: " + width + "' parent='" + ddl.id + "' id='div_" + ddl.id +
						 "'>" + selText + "</div><div id='div_" + ddl.id + "_Container' class='customDropDown'>";
		   for (var o = 0; ddl.options[o]; o++) {
			  div += "<div index='" + o + "' class='customDropDownItem' parent='" + ddl.id + "'>" + ddl.options[o].text + "</div>";
		   }
		   div += "</div>";
		   $("#" + ddl.id).after(div);
		   $("#" + ddl.id).css("display", "none");
	    }
	    $(".customDropDown").hide();
	    $(".customDropDownSelector").click(function(e) {
		   var id = $(this).attr("id");
		   var $container = $("#" + id + "_Container")
		   if (!$container.css("display") || $container.css("display") == "none")
			  $container.slideDown();
		   else
			  $container.slideUp();
		   e.preventDefault();
	    });
	    $(".customDropDownItem").click(function() {
		   var $this = $(this);
		   var $parentId = $this.attr("parent")
		   var $parent = $("#" + $parentId)
		   $parent[0].selectedIndex = $(this).attr("index");
		   $("#div_" + $parentId).text($(this).text());
		   $("#div_" + $parentId).trigger('click');
		   if ($parent[0].attributes["onchange"])
			  eval($parent[0].attributes["onchange"].value);
	    });
	    $(".customDropDownItem").hover(function() {
		   $(this).toggleClass("customDropDownItemHover");
	    },
	    function() {
		   $(this).toggleClass("customDropDownItemHover");
	    });
	}
