$(document).ready(function(){
	// background image
	$("#bgimg").fadeIn(100);
	$("#bgimg").fullscreenr({
		width: 1024,
		height: 768,
		bgID: '#bgimg'
	});
	// subnav hover
	$("#nav li").hover(function(){
		$(this).children("ul.subnav").css('z-index',999);
	},function(){
		$(this).children("ul.subnav").css('z-index',0);
	});
	// general hover
	$(".opacity").hover(function(){
		$(this).stop().fadeTo(200,0.7);
	},function(){
		$(this).stop().fadeTo(200,1.0);
	});
	$(".inverted-opacity").css('opacity',0.8);
	$(".inverted-opacity").hover(function(){
		$(this).stop().fadeTo(200,1.0);
	},function(){
		$(this).stop().fadeTo(200,0.8);
	});
	// fade in
	$(".hide-n-seek").fadeIn(500);
	// cycle
	$('.slider').each(function() {
		var show = $(this);
			
		show.cycle({ 
			fx :    	'fade', 
			speed :  	1000,
			timeout : 	6000, 
			cleartypeNoBg: true,
			next :	    show.next('.next2'), 
			prev :  	show.prev('.prev2')
		});
					
	});
	// scroller
	$(".scroll-pane").jScrollPane();
	// product image switcher
	$("#product-image-counter").jFlow({
		slides: "#product-image",
		width:  "470px",
		height: "525px",
		duration: 0,
		prev: "#prevbut",
		next: "#nextbut"
	});
	// product zoom clearer
	var hidden = 0;
	$("#zoombut").click(function(){
		if(hidden==0){
			hidden = 1;
			$("#zoomhide").hide();
			$("#zoombut").children("img").attr("src","_img/but_zoom_minus.gif");
		}else{
			hidden = 0
			$("#zoomhide").show();
			$("#zoombut").children("img").attr("src","_img/but_zoom_plus.gif");
		}
	});
	// image control on top
	$('#product-image-control').maxZIndex();
	// tooltip
	$(".tooltip").tooltip({ showURL: false });
});
$(window).load(function(){
});
$(window).resize(function(){
});
// gmap
function initializeGmap(gMapLat,gMapLng,gMapZoom,gMapElementId,gMapImage){
	var latlng = new google.maps.LatLng(gMapLat,gMapLng);
	var myOptions = {
		zoom: gMapZoom,
		center: latlng,
		mapTypeControl: true,
		mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DEFAULT},
		navigationControl: true,
		navigationControlOptions: {style: google.maps.NavigationControlStyle.DEFAULT},
		mapTypeId: google.maps.MapTypeId.ROADMAP
	};
	var map = new google.maps.Map(document.getElementById(gMapElementId), myOptions);
	var image = gMapImage;
	var spotMarker = new google.maps.Marker({
		position: latlng,
		map: map,
		icon: image
	});
}

