/*tandoori.js*/
var Class = {
	create : function() {
		return function() {
			this.initialize.apply(this, arguments)
		}
	}
};
var Tandoori = Class.create();
function WindowEdges() {
	var C = document.createElement("div");
	var A = jQuery(C).css( {
		position : "absolute",
		width : "1px",
		height : "1px",
		bottom : "0",
		right : "0"
	}).appendTo(document.body);
	var B = A.offset();
	document.body.removeChild(C);
	return [ B.left + 1, B.top + 1 ]
}
function ContractCategorySidebar() {
	jQuery("#category-sidebar li").each(function(A) {
		if (this.hasClass(h1)) {
			this.hide()
		}
	})
}
Tandoori.executeWhenAvailable = function(D, A) {
	if (jQuery("#" + A)) {
		D()
	} else {
		var C = D, B = A;
		setTimeout(Tandoori.executeWhenAvailable(C, B), 100)
	}
};
/* popupwindow.js */
isMac = (navigator.appVersion.indexOf("Mac") != -1) ? true : false;
NS4 = (document.layers) ? true : false;
IEmac = ((document.all) && (isMac)) ? true : false;
IE4plus = (document.all) ? true : false;
IE4 = ((document.all) && (navigator.appVersion.indexOf("MSIE 4.") != -1)) ? true
		: false;
IE5 = ((document.all) && (navigator.appVersion.indexOf("MSIE 5.") != -1)) ? true
		: false;
IE6 = ((document.all) && (navigator.appVersion.indexOf("MSIE 6.") != -1)) ? true
		: false;
ver4 = (NS4 || IE4plus) ? true : false;
NS6 = (!document.layers) && (navigator.userAgent.indexOf("Netscape") != -1) ? true
		: false;
IE5plus = IE5 || IE6;
IEMajor = 0;
if (IE4plus) {
	var start = navigator.appVersion.indexOf("MSIE");
	var end = navigator.appVersion.indexOf(".", start);
	IEMajor = parseInt(navigator.appVersion.substring(start + 5, end));
	IE5plus = (IEMajor >= 5) ? true : false
}
var gSafeOnload = new Array();
function SafeAddOnload(A) {
	if (IEmac && IE4) {
		window.onload = SafeOnload;
		gSafeOnload[gSafeOnload.length] = A
	} else {
		if (window.onload) {
			if (window.onload != SafeOnload) {
				gSafeOnload[0] = window.onload;
				window.onload = SafeOnload
			}
			gSafeOnload[gSafeOnload.length] = A
		} else {
			window.onload = A
		}
	}
}
function SafeOnload() {
	for ( var A = 0; A < gSafeOnload.length; A++) {
		gSafeOnload[A]()
	}
}
function isInt(B) {
	var A = parseInt(B);
	return !isNaN(A)
}
function PUW_Init() {
	if (gPopupWindow.CheckFrequency()) {
		setTimeout("gPopupWindow.Show()", gPopupWindow.showDelay)
	}
}
function PUW_Show() {
	var B = "width=" + this.width + ",height=" + this.height + ",top="
			+ this.top + ",left=" + this.left + ",";
	B += "scrollbars=" + ((this.scrollbars) ? "yes," : "no,");
	B += "toolbar=" + ((this.toolbar) ? "yes," : "no,");
	B += "location=" + ((this.locationbar) ? "yes," : "no,");
	B += "menubar=" + ((this.menubar) ? "yes," : "no,");
	B += "status=" + ((this.statusbar) ? "yes," : "no,");
	B += "resizable=" + ((this.resizable) ? "yes" : "no");
	var A = window.open(this.url, this.name, B);
	if (!this.ontop) {
		window.focus()
	}
}
function PUW_CheckFrequency() {
	var A = this.frequency != 0;
	if (this.frequency > 0) {
		var C = document.cookie;
		var F = C.indexOf("PUWCount=");
		if (F >= 0) {
			var B = C.indexOf(";", F);
			if (B < 0) {
				B = C.length
			}
			var D = C.substring(F + 9, B);
			if (isInt(D)) {
				this.frequency = parseInt(D)
			}
		}
		if (this.frequency > 0) {
			this.frequency--
		} else {
			A = false
		}
		var E = new Date();
		E.setTime(E.getTime() + this.renew * 60 * 60000);
		document.cookie = "PUWCount=" + this.frequency + "; expires="
				+ E.toGMTString()
	}
	return A
}
function PopupWindow(C, D, B, A) {
	this.width = D;
	this.height = B;
	this.top = screen.availHeight / 2 - B / 2;
	this.left = screen.availWidth / 2 - D / 2;
	this.name = "CWViewer";
	this.url = C;
	this.showDelay = 2000;
	this.frequency = 2;
	this.renew = 1;
	this.scrollbars = A;
	this.toolbar = false;
	this.statusbar = false;
	this.resizable = false;
	this.locationbar = false;
	this.menubar = false;
	this.ontop = true;
	this.Init = PUW_Init;
	this.Show = PUW_Show;
	this.CheckFrequency = PUW_CheckFrequency
}
function PUWStart() {
	gPopupWindow.Init()
}
function loadWindow(B, C, A) {
	loadWindow(B, C, A, false)
}
function loadWindow(C, D, B, A) {
	gPopupWindow = new PopupWindow(C, D, B, A);
	SafeAddOnload(PUWStart);
	gPopupWindow.toolbar = false;
	gPopupWindow.statusbar = false;
	gPopupWindow.resizable = true;
	gPopupWindow.ontop = true;
	gPopupWindow.Show()
};
/* misc.js */
function ToggleHiddenLinks(A, B) {
	jQuery("#" + A).toggleClass("tandoori-links-visible");
	jQuery("#" + A + " " + B).each(function(C) {
		if (jQuery(this).hasClass("hl")) {
			jQuery(this).toggle()
		}
	})
}
function startGreyBox(C, A, B, D) {
	jQuery.ShowGreyBox("/browse/miniProductDetail.ajax", {
		onGreyBoxShow : function() {
			jQuery(A).css( {
				position : "relative",
				"z-index" : 105,
				background : "#EEE",
				border : "2px solid " + D,
				height : "50px"
			});
			pageTracker._trackPageview("/ajax/" + B + "/view")
		},
		onGreyBoxExit : function() {
			jQuery(A).css( {
				background : "#FFF",
				position : "static",
				border : "none"
			})
		},
		onGreyBoxError : function() {
			jQuery(A).unbind("click");
			jQuery(A + " a").unbind("click");
			jQuery(A).unbind("over");
			jQuery(A).css( {
				background : "#FFF",
				position : "static",
				border : "none"
			})
		}
	}, {
		data : ( {
			pid : C,
			googleAnalyticsTracking : "" + B
		})
	})
}
function startGreyBoxQuickLook(E, A, D, C, B) {
	if (C != "") {
		greyBoxOptions = {
			attachGreyBoxElementsTo : C,
			onGreyBoxError : function() {
				jQuery(A).unbind("click");
				jQuery(A).css( {
					background : "#FFF"
				})
			}
		}
	} else {
		greyBoxOptions = {
			onGreyBoxError : function() {
				jQuery(A).unbind("click");
				jQuery(A).css( {
					background : "#FFF"
				})
			}
		}
	}
	jQuery.ShowGreyBox(B, greyBoxOptions, {
		data : ( {
			pid : E,
			googleAnalyticsTracking : "" + D
		})
	})
}
function miniProductPageAjax(D, B, A, F) {
	try {
		jQuery("#" + B + " a").click(function() {
			startGreyBox(D, "#" + B, A, F);
			return false
		});
		greyBoxHoverIntentConfig.over = function() {
			startGreyBox(D, "#" + B, A, F)
		};
		jQuery("#" + B).hoverIntent(greyBoxHoverIntentConfig)
	} catch (C) {
	}
}
function miniProductPageMainAjax(H, F, D, E, B, C, A) {
	try {
		if (F == "") {
			divOrClassName = "." + D
		} else {
			divOrClassName = "#" + F
		}
		if (A == null) {
			A = "/browse/miniProductDetail.ajax"
		}
		jQuery(divOrClassName).click(function() {
			startGreyBoxQuickLook(H, divOrClassName, E, C, A);
			return false
		});
		if (B) {
			greyBoxHoverIntentConfig.over = function() {
				startGreyBoxQuickLook(H, divOrClassName, E, C, A)
			};
			jQuery(divOrClassName).hoverIntent(greyBoxHoverIntentConfig)
		}
	} catch (G) {
	}
}
function loadLocalDivInPopup(A, D, B, C, G) {
	try {
		var F = C;
		if (C != "auto") {
			F = F += 1
		}
		jQuery.ShowGreyBox("", {
			localElementSelector : A,
			attachGreyBoxElementsTo : D,
			width : B,
			height : F,
			onGreyBoxShow : G
		}, {})
	} catch (E) {
	}
}
function setupMouseEnterAndMouseLeave(D, C, B, A) {
	jQuery(C).bind("mouseenter", function() {
		jQuery(D).css( {
			backgroundColor : B
		}).corner("round 10px");
		jQuery(C).css("backgroundColor", A).corner("round 8px")
	});
	jQuery(C).bind("mouseleave", function() {
		jQuery(D).css( {
			backgroundColor : A
		});
		jQuery(D + " .jquery-corner").remove()
	})
};