// --- son of a suckerfish dropdowns
sfHover = function() {
	var sfEls = document.getElementById("dropdown").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

$(document).ready(function() {
	
	// --- function for the slideshow
	$(function() {
		$('#slideshow-imgs').cycle({
			fx:			'fade',
			speed:	500,
			pause:  1,
			next: 	'#next',
			prev: 	'#prev',
			pager: '#nav', 
			timeout: 4000,
			pauseOnPagerHover: 1
		});
	});

	// --- remove text in search field
	$("input").focus(function() {
		if( this.value == this.defaultValue ) {
			this.value = "";
		}
	}).blur(function() {
		if( !this.value.length ) {
			this.value = this.defaultValue;
		}
	});

	// --- TPC shop all dropdown
	$('ul#shop-all').hover(
		function () {
			$($(this).children().children('ol')[0]).slideDown('slow');
			return false;
		}, 
		function () {
			$($(this).children().children('ol')[0]).slideUp('fast');
			return false;
		}
	);

});


// --- for live chat popup
$(function() {
	$(".popupwindow").popupwindow();
});