
var jq=jQuery.noConflict();

jq(document).ready(function(){

	jq(document).ready(function(){
	
		// ref: http://cssglobe.com/post/5780/easy-slider-17-numeric-navigation-jquery-slider
		jq("#homepagesliderA").easySlider({
		
			prevId: 		'homeSlidePrevBtn',
			prevText: 		'&lt; Previous',
			nextId: 		'homeSlideNextBtn',	
			nextText: 		'Next &gt; ',
			controlsShow:	true,
			controlsBefore:	'<div id="homePageSliderControlsDiv">',
			controlsAfter:	'</div>',	
			controlsFade:	false,
			firstId: 		'firstBtn',
			firstText: 		'First',
			firstShow:		false,
			lastId: 		'lastBtn',	
			lastText: 		'Last',
			lastShow:		false,				
			vertical:		false,
			speed: 			1000,
			auto:			true,
			pause:			3000,
			continuous:		true, 
			numeric: 		false,
			numericId: 		'controls'
		
		});
	});
	
	// image load on visible only - quirky but works for most browsers
	jq(".viewallpage .categoryPageBrandGroupWrapperDiv img, brandPageCategoryGroupWrapperDiv img, .searchPageResultsWrapperDiv img").lazyload({
		//placeholder : "/pics/holiday/snowflake-bg.jpg",
		//placeholder : "/admin-media/pics/progress-indicator.gif",
		effect      : "fadeIn"
	});
	
	// emulated SSI
	//jq(".jq-include").each(function(){
	//	var inc=jq(this);
	//	jq.get(inc.attr("title"), function(data){ inc.replaceWith(data); });
	//});
	
	// linked images
	jq("a img").hover(function(){
		jq(this).fadeTo(200, 0.6);
	},function(){
		jq(this).fadeTo(200, 1.0);
	});
	
	// sidebar links
	var sidebarLinkOrigColor = jq(".sidebarContainerTD a").css("color");
	var sidebarLinkHoverColor = "#bbc";
	jq('.sidebarContainerTD a').underline({
		width:			1,				//default: 1
		distance:		-1,				//default: 0
		color:			sidebarLinkHoverColor,			//default: #000
		durationOn:		100,			//default: 250
		durationOff:	350,			//default: 250
		extend:			0,				//default: 2,
		linkOn:			'mouseover',	//default: 'mouseover'
		linkOff:		'mouseout'		//default: 'mouseout' 
	});
	
	jq(".sidebarContainerTD a").not('.invodo_navigation a').hover(function() {
		//jq(this).animate({backgroundColor: "#2f406b"}, 100);
		jq(this).animate({color: sidebarLinkHoverColor}, 100);
	},function(){
		//jq(this).animate({backgroundColor: "#ffffff"}, 50);
		jq(this).animate({color: sidebarLinkOrigColor}, 100);
	});
	
	
	// header links bar
	var headerLinkOrigColor = jq(".headerLinksDiv a").css("color");
	var headerLinkHoverColor = "#ddd";
	jq('.headerLinksDiv a').underline({
		width:			1,				//default: 1
		distance:		-1,				//default: 0
		color:			headerLinkHoverColor,			//default: #000
		durationOn:		350,			//default: 250
		durationOff:	350,			//default: 250
		extend:			0,				//default: 2,
		linkOn:			'mouseover',	//default: 'mouseover'
		linkOff:		'mouseout'		//default: 'mouseout'
	});
	
	//var originalHeaderLinkBGColor = jq(".headerLinksDiv a").css("background-color");
	jq(".headerLinksDiv a").hover(function() {
		jq(this).animate({color: headerLinkHoverColor}, 100);
	},function(){
		jq(this).animate({color: headerLinkOrigColor}, 100);
	});


	// image hover zoom
	// based on: http://www.dynamicdrive.com/dynamicindex4/featuredzoomer.htm
	jq('.imageCell img, .productShortDescriptionDiv img, .imageDisplayPopUpImg').each(function () {
	
		id = '#' + jq(this).attr("id");
		largeImgURL = jq(this).attr("largeurl");
	
		if (id && largeImgURL) {
		
			imgLink = jq(this).parent().attr("href");
			//alert("link goes here: " + imgLink);
			
			largeImgX	= jq(this).attr("largex");
			largeImgY	= jq(this).attr("largey");
			imgAlt		= jq(this).attr("alt");
			
			magSizeX = largeImgX;
			magSizeY = largeImgY;

			jq(id).addimagezoom({
				//zoomrange: [5, 10],
				caption: imgAlt,
				hoverclicklink: imgLink,
				magnifypadding: [5,5],
				magnifiersize: [magSizeX,magSizeY],
				magnifierpos: 'right',
				cursorshade: false,
				cursorshadecolor: 'blue',
				cursorshadeopacity: 0.3,
				cursorshadeborder: '1px solid #008;',
				largeimage: largeImgURL //<-- No comma after last option!
			});
			
		}
	
	});
	
	//index = window.location.href.lastIndexOf("/");
	//pageFileName = window.location.href.substr(index);
	//pageFileName = url.substring(url.lastIndexOf('/') + 1 );
	//if (pageFileName == '/testingpage.html') {
		// test stuff
	//}
	
});




/*
UNDERLINE:

width
	DEFAULT: 1
	This will be the thickness of the line in pixels
distance
	DEFAULT: 0
	This will be the distance from the bottom of the element. This can be positive of negative number to move the line up or down accordingly.
color
	DEFAULT: '#000'
	this will be the color of the line
durationOn
	DEFAULT: 250
	This will be the time it takes for the line to fade in. If you set this to 0; it will just pop up.
durationOff
	DEFAULT: 250
	This will be the time it takes for the line to fade out. If you set this to 0; it will just pop up.
linkOn
	DEFAULT: mouseover
	Event that is called to start the underline
linkOff
	DEFAULT: mouseout
	Event that is called to stop the underline
extend
	DEFAULT: 2
	This will be how many pixels the line will extend on each side of the element. You can go positive or a negative number on this as well.
*/


