$(document).ready(function(){
	var currentProtocol = (("https:" == document.location.protocol) ? "https:" : "http:");
	if ( ctgyCode == "popular-wedding-favors" ) {
		$(".catSorting").hide();
	}
	/* fairy tale exit survey */
	/*if ( ctgyCode == "FairyTale" ) {
		var theReferrer = document.referrer;
		if ( theReferrer && theReferrer.indexOf("yahoo.com") != -1 ) {
			var engineFlag = "yahoo";
		} else if ( theReferrer && theReferrer.indexOf("google.com") != -1 ) {
			var engineFlag = "google";
		} else {
			var engineFlag = "unknown";
		}
		
		if ( engineFlag != "unknown" ) {
			var exit = true;
			$("a").bind("click", function(){ exit = false; });
			$("form").bind("submit", function(){ exit = false; });
			$("body").append(engineFlag);
			$(window).bind("unload", function(){
								if ( exit ) {
									//alert("exiting");
									var surveyURL = "http://www.favorfavor.com/includes/surveys/exitSurvey.php";
									var height = "550";
									var width = "450";
									var windowName = "FavorFavorExitSurvey";
									var settings = "toolbar=0,directories=0,menubar=0,scrollbars=1,resizable=1,width="+width+",height="+height;
									//alert("exiting");
									window.open( surveyURL, windowName, settings );
									//alert("done exiting");
								}
			});
		}
	}*/
	if ( $.getQueryString({id:"gclid", defaultvalue:""}) != "" ) {
		var WRInitTime=(new Date()).getTime();
		$("body").append("<div id=\"ClickTaleDiv\" style=\"display: none;\"></div>");
		if ( currentProtocol != "https:" ) {
			$("body").append(unescape("%3Cscript src='http://s.clicktale.net/WRb.js' type='text/javascript'%3E%3C/script%3E"));
			window.callCT;
			$(document).ready(function(){
				callCT = setInterval(
					function(){
						if(typeof ClickTale=='function') {
							ClickTale(11564,1,"www02");
							callCT = clearInterval(callCT);
						}
					}, 100 );
			});
		}
	}
});