(function($){$.fn.lazyload=function(options){var settings={threshold:0,failurelimit:0,event:"scroll",effect:"show",container:window};if(options){$.extend(settings,options);}
var elements=this;if("scroll"==settings.event){$(settings.container).bind("scroll",function(event){var counter=0;elements.each(function(){if($.abovethetop(this,settings)||$.leftofbegin(this,settings)){}else if(!$.belowthefold(this,settings)&&!$.rightoffold(this,settings)){$(this).trigger("appear");}else{if(counter++>settings.failurelimit){return false;}}});var temp=$.grep(elements,function(element){return!element.loaded;});elements=$(temp);});}
this.each(function(){var self=this;if(undefined==$(self).attr("original")){$(self).attr("original",$(self).attr("src"));}
if("scroll"!=settings.event||undefined==$(self).attr("src")||settings.placeholder==$(self).attr("src")||($.abovethetop(self,settings)||$.leftofbegin(self,settings)||$.belowthefold(self,settings)||$.rightoffold(self,settings))){if(settings.placeholder){$(self).attr("src",settings.placeholder);}else{$(self).removeAttr("src");}
self.loaded=false;}else{self.loaded=true;}
$(self).one("appear",function(){if(!this.loaded){$("<img />").bind("load",function(){$(self).hide().attr("src",$(self).attr("original"))
[settings.effect](settings.effectspeed);self.loaded=true;}).attr("src",$(self).attr("original"));};});if("scroll"!=settings.event){$(self).bind(settings.event,function(event){if(!self.loaded){$(self).trigger("appear");}});}});$(settings.container).trigger(settings.event);return this;};$.belowthefold=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).height()+$(window).scrollTop();}else{var fold=$(settings.container).offset().top+$(settings.container).height();}
return fold<=$(element).offset().top-settings.threshold;};$.rightoffold=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).width()+$(window).scrollLeft();}else{var fold=$(settings.container).offset().left+$(settings.container).width();}
return fold<=$(element).offset().left-settings.threshold;};$.abovethetop=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).scrollTop();}else{var fold=$(settings.container).offset().top;}
return fold>=$(element).offset().top+settings.threshold+$(element).height();};$.leftofbegin=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).scrollLeft();}else{var fold=$(settings.container).offset().left;}
return fold>=$(element).offset().left+settings.threshold+$(element).width();};$.extend($.expr[':'],{"below-the-fold":"$.belowthefold(a, {threshold : 0, container: window})","above-the-fold":"!$.belowthefold(a, {threshold : 0, container: window})","right-of-fold":"$.rightoffold(a, {threshold : 0, container: window})","left-of-fold":"!$.rightoffold(a, {threshold : 0, container: window})"});})(jQuery);


/*
* Version: Beta 1 WATERMARK
* Release: 2007-06-01
*/
(function ($) {
	
	$("#ctl00_Entertainment_RentboyEnter").css({display:"block"});
	
	var map = new Array();
    $.Watermark = {
        ShowAll: function () {
            for (var i = 0; i < map.length; i++) {
                if (map[i].obj.val() == "") {
                    map[i].obj.val(map[i].text);
                    map[i].obj.css("color", map[i].WatermarkColor);
                } else {
                    map[i].obj.css("color", map[i].DefaultColor);
                }
            }
        },
        HideAll: function () {
            for (var i = 0; i < map.length; i++) {
                if (map[i].obj.val() == map[i].text)
                    map[i].obj.val("");
            }
        }
    }

    $.fn.Watermark = function (text, color) {
        if (!color)
            color = "#aaa";
        return this.each(
			function () {
			    var input = $(this);
			    var defaultColor = input.css("color");
			    map[map.length] = { text: text, obj: input, DefaultColor: defaultColor, WatermarkColor: color };
			    function clearMessage() {
			        if (input.val() == text)
			            input.val("");
			        input.css("color", defaultColor);
			    }

			    function insertMessage() {
			        if (input.val().length == 0 || input.val() == text) {
			            input.val(text);
			            input.css("color", color);
			        } else
			            input.css("color", defaultColor);
			    }

			    input.focus(clearMessage);
			    input.blur(insertMessage);
			    input.change(insertMessage);

			    insertMessage();
			}
		);
    };
})(jQuery);

/**
* hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne brian(at)cherne(dot)net
*/
(function ($) { $.fn.hoverIntent = function (f, g) { var cfg = { sensitivity: 7, interval: 100, timeout: 0 }; cfg = $.extend(cfg, g ? { over: f, out: g} : f); var cX, cY, pX, pY; var track = function (ev) { cX = ev.pageX; cY = ev.pageY }; var compare = function (ev, ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); if ((Math.abs(pX - cX) + Math.abs(pY - cY)) < cfg.sensitivity) { $(ob).unbind("mousemove", track); ob.hoverIntent_s = 1; return cfg.over.apply(ob, [ev]) } else { pX = cX; pY = cY; ob.hoverIntent_t = setTimeout(function () { compare(ev, ob) }, cfg.interval) } }; var delay = function (ev, ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); ob.hoverIntent_s = 0; return cfg.out.apply(ob, [ev]) }; var handleHover = function (e) { var ev = jQuery.extend({}, e); var ob = this; if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t) } if (e.type == "mouseenter") { pX = ev.pageX; pY = ev.pageY; $(ob).bind("mousemove", track); if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout(function () { compare(ev, ob) }, cfg.interval) } } else { $(ob).unbind("mousemove", track); if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout(function () { delay(ev, ob) }, cfg.timeout) } } }; return this.bind('mouseenter', handleHover).bind('mouseleave', handleHover) } })(jQuery);



$(function () {
    $("#MainMenu a").tipTip({ attribute: 'title', defaultPosition: 'top', maxWidth: "150px" });
	
	 $('.ApprovedPendingHelp').tipTip({ attribute: 'alt', defaultPosition: 'top', maxWidth: "150px" });
     
	 //PREVENT SCROLLING WHEN CCOLORBOX IS OPEN
	 	$(document).bind('cbox_open', function(){ $('html').css({overflow:'hidden'}); 
			}).bind('cbox_closed', function(){ $('html').css({overflow:'auto'}); 
		}); 
	
	
	//hide stat card link
	//$('.linkStatCard').hide();	
	 
    // for advertiser scalable buttons
    //$('.btn').each(function(){
    //				var b = $(this);
    //				var tt = b.text() || b.val();
    //				if ($(':submit,:button',this)) {
    //					b = $('<a>').insertAfter(this). addClass(this.className).attr('id',this.id);
    //					$(this).remove();
    //				}
    //				b.text('').css({cursor:'pointer'}). prepend('<i></i>').append($('<span>').
    //				text(tt).append('<i></i><span></span>'));
    //			});
    
	//$("#tabs").show();

   // $("#tabs").tabs(); //for new mega menu/navigation
	
	// $("#megaMaptabs").tabs(); //for new mega browse menu

    //On Hover Over
//    function megaHoverOver() {
//		$(this).find(".sub").stop().fadeTo('fast', 1).show(); //Find sub and fade it in
//        (function ($) {
//            //Function to calculate total width of all ul's
//            jQuery.fn.calcSubWidth = function () {
//                rowWidth = 0;
//                //Calculate row
//                $(this).find("ul").each(function () { //for each ul...
//                    rowWidth += $(this).width(); //Add each ul's width together
//                });
//            };
//        })(jQuery);

//        if ($(this).find(".row").length > 0) { //If row exists...

//            var biggestRow = 0;

//            $(this).find(".row").each(function () {	//for each row...
//                $(this).calcSubWidth(); //Call function to calculate width of all ul's
//                //Find biggest row
//                if (rowWidth > biggestRow) {
//                    biggestRow = rowWidth;
//                }
//            });

//           // $(this).find(".sub").css({ 'width': biggestRow }); //Set width
//            $(this).find(".row:last").css({ 'margin': '0' });  //Kill last row's margin

//        } else { //If row does not exist...

//            $(this).calcSubWidth();  //Call function to calculate width of all ul's
//          //  $(this).find(".sub").css({ 'width': rowWidth }); //Set Width

//        }
//    }
//    //On Hover Out
//    function megaHoverOut() {
//        $(this).find(".sub").stop().fadeTo('fast', 0, function () { //Fade to 0 opactiy
//            $(this).hide();  //after fading, hide it
//        });
//    }

    //Set custom configurations
//    var config = {
//        sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
//        interval: 100, // number = milliseconds for onMouseOver polling interval
//        over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
//        timeout: 500, // number = milliseconds delay before onMouseOut
//        out: megaHoverOut // function = onMouseOut callback (REQUIRED)
//    };
	
////	$("#MegaNav .sub").css({ 'display': 'none' }); //Fade sub nav to 0 opacity on default
////	$("#MegaNav li").hoverIntent(config); //Trigger Hover intent with custom configurations
////	
////	$(".megabrowse").hover(  //hide/show quicksearch control from leftcolumn
////	  function () {
////		$('#LeftColumnDiv #ViewListingsByLocationDiv').fadeOut("3000");
////		//$('.megamyaccount').css( {'position':'absolute', 'top':'0', 'left':'50px'});
////	  }, 
////	  function () {
////		$('#LeftColumnDiv #ViewListingsByLocationDiv').fadeIn("5000");
////		//$('.megamyaccount').css( 'position','relative');
////	  }
////	);
////	
////	$('.closeX').click(function() {
////		$('.sub').css({ 'display': 'none' });
////	});
	
		//$('#coda-slider-2').codaSlider({
//         // dynamicArrows: false,
//           dynamicTabs: false
//       });
// JQUERY POPUP WINDOW


});


(function($){ 		  
	$.fn.popupWindow = function(instanceSettings){
		
		return this.each(function(){
		
		$(this).click(function(){
		
		$.fn.popupWindow.defaultSettings = {
			centerBrowser:0, // center window over browser window? {1 (YES) or 0 (NO)}. overrides top and left
			centerScreen:0, // center window over entire screen? {1 (YES) or 0 (NO)}. overrides top and left
			height:500, // sets the height in pixels of the window.
			left:0, // left position when the window appears.
			location:0, // determines whether the address bar is displayed {1 (YES) or 0 (NO)}.
			menubar:0, // determines whether the menu bar is displayed {1 (YES) or 0 (NO)}.
			resizable:0, // whether the window can be resized {1 (YES) or 0 (NO)}. Can also be overloaded using resizable.
			scrollbars:0, // determines whether scrollbars appear on the window {1 (YES) or 0 (NO)}.
			status:0, // whether a status line appears at the bottom of the window {1 (YES) or 0 (NO)}.
			width:500, // sets the width in pixels of the window.
			windowName:null, // name of window set from the name attribute of the element that invokes the click
			windowURL:null, // url used for the popup
			top:0, // top position when the window appears.
			toolbar:0 // determines whether a toolbar (includes the forward and back buttons) is displayed {1 (YES) or 0 (NO)}.
		};
		
		settings = $.extend({}, $.fn.popupWindow.defaultSettings, instanceSettings || {});
		
		var windowFeatures =    'height=' + settings.height +
								',width=' + settings.width +
								',toolbar=' + settings.toolbar +
								',scrollbars=' + settings.scrollbars +
								',status=' + settings.status + 
								',resizable=' + settings.resizable +
								',location=' + settings.location +
								',menuBar=' + settings.menubar;

				settings.windowName = this.name || settings.windowName;
				settings.windowURL = this.href || settings.windowURL;
				var centeredY,centeredX;
			
				if(settings.centerBrowser){
						
					if ($.browser.msie) {//hacked together for IE browsers
						centeredY = (window.screenTop - 120) + ((((document.documentElement.clientHeight + 120)/2) - (settings.height/2)));
						centeredX = window.screenLeft + ((((document.body.offsetWidth + 20)/2) - (settings.width/2)));
					}else{
						centeredY = window.screenY + (((window.outerHeight/2) - (settings.height/2)));
						centeredX = window.screenX + (((window.outerWidth/2) - (settings.width/2)));
					}
					window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + centeredX +',top=' + centeredY).focus();
				}else if(settings.centerScreen){
					centeredY = (screen.height - settings.height)/2;
					centeredX = (screen.width - settings.width)/2;
					window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + centeredX +',top=' + centeredY).focus();
				}else{
					window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + settings.left +',top=' + settings.top).focus();	
				}
				return false;
			});
			
		});	
	};
})(jQuery);


function isiPad() {
    return navigator.userAgent.match(/iPad/i); 
}

//DETECT MOBILE
function is_mobile() {
    var agents = ['android', 'webos', 'iphone', 'ipad', 'ipod', 'blackberry'];
    for(i in agents) {
        if(navigator.userAgent.match('/'+agents[i]+'/i')) {
            return true;
        }
    }
    return false;
};




