// main.js

function getEventTarget(e) {
	var targ;
	if (!e) var e = window.event;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
		targ = targ.parentNode;
	return targ;
}

function PopUpMenu(sLiPre, sUlPre) {
	this.sLiPre = sLiPre;
	this.sUlPre = sUlPre;
	this.aTimer = [ ]
	this.mouseOver = function(i) {
		var ulPre = $('#'+this.sUlPre+i)[0];
		if(ulPre != null) {
			$('#'+this.sUlPre+i)[0].style.display = "block";
			clearTimeout(this.aTimer[i]);
		}
	}
	this.mouseOut = function(i) {
		var ulPre = $('#'+this.sUlPre+i)[0];
		if($('#'+this.sUlPre+i)[0] != null) {
			this.aTimer[i] = setTimeout("$(\"#"+this.sUlPre+i+"\")[0].style.display = \"none\"" , 200);
		}
	}
	
}

function productDetailZoom() {
	$('#ulDetailImg a').oriolaZoom();  
}

function productDetailSlide() {
	if($('#ulDetailImg li').length > 1) {
		$('#ulDetailImg').cycle( {
			 timeout: 0
			,speed: 1000
			,pause: 1
			,random: 0
			,fx: 'scrollHorz'
			,next: '#divDetailFlash a.SlideNext'
			,prev: '#divDetailFlash a.SlidePrev'
			,pager: null
			,sync: true
		} );
		$('#divDetailFlash').hover(
			 function() { $(this).find('a.SlideNext, a.SlidePrev').fadeIn(); }
			,function() { $(this).find('a.SlideNext, a.SlidePrev').fadeOut(); }
		);
	}
}

$(document).ready( function() {
	$(".Products .Minisquares.ProductColors a").lightBox();
	$(".Products .Minisquares.ProductImages a").lightBox();
	$(".Products .DetailDataUnit ul.Accessories a").lightBox();
	//$(".Products #divDetailCallFromFlash .Minisquares.ProductColors a").lightBox();
	//$(".Products #divDetailCallFromFlash .Minisquares.ProductImages a").lightBox();
	productDetailZoom();
	productDetailSlide();
});

