/*
Math.uuid.js (v1.4)
http://www.broofa.com
mailto:robert@broofa.com

Copyright (c) 2009 Robert Kieffer
Dual licensed under the MIT and GPL licenses.
*/
Math.uuid=(function(){var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");return function(b,e){var g=a,d=[];e=e||g.length;if(b){for(var c=0;c<b;c++){d[c]=g[0|Math.random()*e]}}else{var f;d[8]=d[13]=d[18]=d[23]="-";d[14]="4";for(var c=0;c<36;c++){if(!d[c]){f=0|Math.random()*16;d[c]=g[(c==19)?(f&3)|8:f]}}}return d.join("")}})();

/* jQuery plugin for easy CSS tooltips
 *
 * Based on Tooltip scripts by Alen Grakalic (http://cssglobe.com)
 * For more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 * Extended by Senko Rasic to call arbitrary function which builds tooltip HTML
 *
 * Example plugin usage cases:
 *
 * 1) put a normal tooltip on all anchors having 'tooltip' class, creating a
 *    paragraph with id 'tooltip' to hold the tooltip
 *    
 *      $('a.tooltip').tooltip(function (el) {
 *          return el.anchor_title;
 *      });
 *
 * 2) image preview (image + optional caption) on anchors having 'preview' class,
 *    creating a paragraph with id 'preview' to hold the tooltip
 *    
 *      $('a.preview').tooltip(function (el) {
 *              var c = (el.anchor_title != "") ? "<br/>" + el.anchor_title : "";
 *              return "<img src='"+ el.href +"' alt='image preview' />"+ c;
 *      }, {'tooltipID': 'preview'});
 *
 *
 * 3) url preview (image + optional caption) on anchors having 'screenshot' class,
 *    creating a paragraph with id 'screenshot' to hold the tooltip
 *    
 *      $('a.screenshot').tooltip(function (el) {
 *          var c = (el.anchor_title != "") ? "<br/>" + el.anchor_title : "";
 *         return "<img src='"+ el.rel +"' alt='url preview' />"+ c;
 *      }, {'tooltipID': 'screenshot'});
 */

(function($) {
    function tooltip(el, fn, options) {
	width = 0;
        el.hover(function (e) {
            this.anchor_title = this.title;
            this.title = '';
            
            $('body').append('<p style="width:0px;" id="' + options.tooltipID + '">' + fn(this) + '</p>');
		var img = document.getElementById('preview_image'); 
		//or however you get a handle to the IMG
		width = img.clientWidth;
		height = img.clientHeight;
		if(width > 500 || height > 500){
			width = width * 0.6;
			height = height * 0.6;
			$(img).attr('width', width).attr('height', height);
		}
        }, function () {
            this.title = this.anchor_title;
	    $('#' + options.tooltipID).remove();
        });
        
        el.mousemove(function (e) {
	options.xOffset = $(document).height() - 200;
	var dir = (e.pageX + options.yOffset) < 700 ? "left": "left";
            $('#' + options.tooltipID)
                    .css("top", (e.pageY - options.xOffset) + "px")
                    .css("left", (e.pageX + options.yOffset) < 700?  (e.pageX + options.yOffset) :  ( e.pageX - width - options.yOffset ) + "px")
		    .fadeIn("fast");

        });
    }

    $.fn.tooltip = function(fn, options) {
        options = options || {};
        var defaults = {
            xOffset: 2800,
            yOffset: 30,
            tooltipID: 'tooltip'
        };        
        return this.each(function() {
            tooltip($(this), fn, $.extend(defaults, options));
        });
    }
    
})(jQuery);




jQuery(document).ready(function($){
	jQuery.fn.extend({
	  scrollTo : function(speed, easing) {
		return this.each(function() {
		  var targetOffset = $(this).offset().top;
		  easing= easing?easing:'easeOutExpo';
		  $('html,body').stop(true, true).animate({scrollTop: targetOffset}, speed, easing);
		});
	  }
	});
	jQuery.cookie = function(name, value, options) {
		if (typeof value != 'undefined') { // name and value given, set cookie
			options = options || {};
			if (value === null) {
				value = '';
				options.expires = -1;
			}
			var expires = '';
			if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
				var date;
				if (typeof options.expires == 'number') {
					date = new Date();
					date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
				} else {
					date = options.expires;
				}
				expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
			}
			// CAUTION: Needed to parenthesize options.path and options.domain
			// in the following expressions, otherwise they evaluate to undefined
			// in the packed version for some reason...
			var path = options.path ? '; path=' + (options.path) : '';
			var domain = options.domain ? '; domain=' + (options.domain) : '';
			var secure = options.secure ? '; secure' : '';
			document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
		} else { // only name given, get cookie
			var cookieValue = null;
			if (document.cookie && document.cookie != '') {
				var cookies = document.cookie.split(';');
				for (var i = 0; i < cookies.length; i++) {
					var cookie = jQuery.trim(cookies[i]);
					// Does this cookie string begin with the name we want?
					if (cookie.substring(0, name.length + 1) == (name + '=')) {
						cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
						break;
					}
				}
			}
			return cookieValue;
		}
	};
});

(function($) {

    function maybeCall(thing, ctx) {
        return (typeof thing == 'function') ? (thing.call(ctx)) : thing;
    };

    function Tipsy(element, options) {
        this.$element = $(element);
        this.options = options;
        this.enabled = true;
        this.fixTitle();
    };

    Tipsy.prototype = {
        show: function() {
            var title = this.getTitle();
            if (title && this.enabled) {
                var $tip = this.tip();

                $tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
                $tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
                $tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).prependTo(document.body);

                var pos = $.extend({}, this.$element.offset(), {
                    width: this.$element[0].offsetWidth,
                    height: this.$element[0].offsetHeight
                });

                var actualWidth = $tip[0].offsetWidth,
                    actualHeight = $tip[0].offsetHeight,
                    gravity = maybeCall(this.options.gravity, this.$element[0]);

                var tp;
                switch (gravity.charAt(0)) {
                    case 'n':
                        tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
                        break;
                    case 's':
                        tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
                        break;
                    case 'e':
                        tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset};
                        break;
                    case 'w':
                        tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset};
                        break;
                }

                if (gravity.length == 2) {
                    if (gravity.charAt(1) == 'w') {
                        tp.left = pos.left + pos.width / 2 - 15;
                    } else {
                        tp.left = pos.left + pos.width / 2 - actualWidth + 15;
                    }
                }

                $tip.css(tp).addClass('tipsy-' + gravity);
                $tip.find('.tipsy-arrow')[0].className = 'tipsy-arrow tipsy-arrow-' + gravity.charAt(0);
                if (this.options.className) {
                    $tip.addClass(maybeCall(this.options.className, this.$element[0]));
                }

                if (this.options.fade) {
                    $tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity});
                } else {
                    $tip.css({visibility: 'visible', opacity: this.options.opacity});
                }
            }
        },

        hide: function() {
            if (this.options.fade) {
                this.tip().stop().fadeOut(function() { $(this).remove(); });
            } else {
                this.tip().remove();
            }
        },

        fixTitle: function() {
            var $e = this.$element;
            if ($e.attr('title') || typeof($e.attr('original-title')) != 'string') {
                $e.attr('original-title', $e.attr('title') || '').removeAttr('title');
            }
        },

        getTitle: function() {
            var title, $e = this.$element, o = this.options;
            this.fixTitle();
            var title, o = this.options;
            if (typeof o.title == 'string') {
                title = $e.attr(o.title == 'title' ? 'original-title' : o.title);
            } else if (typeof o.title == 'function') {
                title = o.title.call($e[0]);
            }
            title = ('' + title).replace(/(^\s*|\s*$)/, "");
            return title || o.fallback;
        },

        tip: function() {
            if (!this.$tip) {
                this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>');
            }
            return this.$tip;
        },

        validate: function() {
            if (!this.$element[0].parentNode) {
                this.hide();
                this.$element = null;
                this.options = null;
            }
        },

        enable: function() { this.enabled = true; },
        disable: function() { this.enabled = false; },
        toggleEnabled: function() { this.enabled = !this.enabled; }
    };

    $.fn.tipsy = function(options) {

        if (options === true) {
            return this.data('tipsy');
        } else if (typeof options == 'string') {
            var tipsy = this.data('tipsy');
            if (tipsy) tipsy[options]();
            return this;
        }

        options = $.extend({}, $.fn.tipsy.defaults, options);

        function get(ele) {
            var tipsy = $.data(ele, 'tipsy');
            if (!tipsy) {
                tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options));
                $.data(ele, 'tipsy', tipsy);
            }
            return tipsy;
        }

        function enter() {
            var tipsy = get(this);
            tipsy.hoverState = 'in';
            if (options.delayIn == 0) {
                tipsy.show();
            } else {
                tipsy.fixTitle();
                setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn);
            }
        };

        function leave() {
            var tipsy = get(this);
            tipsy.hoverState = 'out';
            if (options.delayOut == 0) {
                tipsy.hide();
            } else {
                setTimeout(function() { if (tipsy.hoverState == 'out') tipsy.hide(); }, options.delayOut);
            }
        };

        if (!options.live) this.each(function() { get(this); });

        if (options.trigger != 'manual') {
            var binder = options.live ? 'live' : 'bind',
                eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus',
                eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
            this[binder](eventIn, enter)[binder](eventOut, leave);
        }

        return this;

    };

    $.fn.tipsy.defaults = {
        className: null,
        delayIn: 0,
        delayOut: 0,
        fade: false,
        fallback: '',
        gravity: 'n',
        html: false,
        live: false,
        offset: 0,
        opacity: 0.8,
        title: 'title',
        trigger: 'hover'
    };

    // Overwrite this method to provide options on a per-element basis.
    // For example, you could store the gravity in a 'tipsy-gravity' attribute:
    // return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
    // (remember - do not modify 'options' in place!)
    $.fn.tipsy.elementOptions = function(ele, options) {
        return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
    };

    $.fn.tipsy.autoNS = function() {
        return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
    };

    $.fn.tipsy.autoWE = function() {
        return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
    };

    /**
* yields a closure of the supplied parameters, producing a function that takes
* no arguments and is suitable for use as an autogravity function like so:
*
* @param margin (int) - distance from the viewable region edge that an
* element should be before setting its tooltip's gravity to be away
* from that edge.
* @param prefer (string, e.g. 'n', 'sw', 'w') - the direction to prefer
* if there are no viewable region edges effecting the tooltip's
* gravity. It will try to vary from this minimally, for example,
* if 'sw' is preferred and an element is near the right viewable
* region edge, but not the top edge, it will set the gravity for
* that element's tooltip to be 'se', preserving the southern
* component.
*/
     $.fn.tipsy.autoBounds = function(margin, prefer) {
return function() {
var dir = {ns: prefer[0], ew: (prefer.length > 1 ? prefer[1] : false)},
boundTop = $(document).scrollTop() + margin,
boundLeft = $(document).scrollLeft() + margin,
$this = $(this);

if ($this.offset().top < boundTop) dir.ns = 'n';
if ($this.offset().left < boundLeft) dir.ew = 'w';
if ($(window).width() + $(document).scrollLeft() - $this.offset().left < margin) dir.ew = 'e';
if ($(window).height() + $(document).scrollTop() - $this.offset().top < margin) dir.ns = 's';

return dir.ns + (dir.ew ? dir.ew : '');
}
};

})(jQuery);



jQuery(document).ready(function($){
       $('.headline3 a').tooltip(function (el) {
               var c = (el.anchor_title != "") ? "<br/>" + el.anchor_title : "";
               return "<img src='"+ el.href +"' id='preview_image' alt='image preview' />"+ c;
       }, {'tooltipID': 'preview'});
	
	/*
		POP OUT BOXES
	*/
	var pop = function(){
		$('#screen').css({"z-index":"99",	"display": "block", opacity: 0.5, "width":$(document).width(),"height":$(document).height()})
		var button = $(this).attr('id');
		var selector = '#'+button.replace('button', 'box');
		$(selector).css({"display": "block"});
		return false;
	}
	$('#profile-button').click(pop);
	$('#login-cancel,#profile-cancel,#search-cancel').click(function(){
	var button = $(this).attr('id');
	var selector = '#'+button.replace('cancel', 'box');
	$(selector).css("display", "none");$('#screen').css("display", "none"); return false;});
	$(window).resize(function(){
		$('#box').css("display") == 'block'?pop.call($('#button')):"";
	});
	var pop2 = function(){
		var obj = $("#"+$(this).attr('id') + '_menu');
		if(obj.css('display') == 'block')
		obj.css({"display": "none"});
		else{
			$('.dropBox').css({"display": "none"});
			obj.css({"display": "block"});
		}
		return false;
	}
	$('#signin, #register, #ml_section, #ml_category').click(pop2);

	/*
		SELECT BOX TRANSFORM
	*/
	$('select.switch').each(function(){
		var obj = $(this);
		var objParent = obj.parent();
		var str = "";
		obj.hide().find('option').each(function(){
			var innerObj = $(this);
			if(innerObj.val() != ""){
				var isSelected = innerObj.attr('selected')?'checked':'';
				if(obj.hasClass('stage')){
					if(innerObj.html().indexOf("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;") != -1){
						str+='<span class="subcheckbox level4 none">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" '+ isSelected + ' class="checkboxFilter '+innerObj.attr('class')+'" value="'+innerObj.val()+'"></input><span>'+innerObj.html().replace(/&nbsp;/g,"")+'</span></span>';
					}else if(innerObj.html().indexOf("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;") != -1){
						str+='<span class="subcheckbox level3 none">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" '+ isSelected + ' class="checkboxFilter '+innerObj.attr('class')+'" value="'+innerObj.val()+'"></input><span>'+innerObj.html().replace(/&nbsp;/g,"")+'</span></span>';
					}else if(innerObj.html().indexOf("&nbsp;&nbsp;&nbsp;") != -1){
						str+='<span class="subcheckbox level2 none" style="width:100%"> &nbsp;&nbsp;&nbsp;<input type="checkbox" '+ isSelected + ' class="checkboxFilter '+innerObj.attr('class')+'" value="'+innerObj.val()+'"></input><span>'+innerObj.html().replace(/&nbsp;/g,"")+'</span></span>';
					}else if(innerObj.html().indexOf("&nbsp;") == -1){
						str+='<span class="subcheckbox level1" style="width:100%"><input type="checkbox" '+ isSelected + ' class="checkboxFilter '+innerObj.attr('class')+'" value="'+innerObj.val()+'"></input><span>'+innerObj.html()+'</span></span>';
					}
				}else if(objParent.hasClass('gwe_page_city'))
					str+='<span class="subcheckbox none"><input type="checkbox" '+ isSelected + ' class="checkboxFilter '+innerObj.attr('class')+'" value="'+innerObj.val()+'"></input><span>'+innerObj.html()+'</span></span>';
				else
					str+='<span class="subcheckbox"><input type="checkbox" '+ isSelected + ' class="checkboxFilter '+innerObj.attr('class')+'" value="'+innerObj.val()+'"></input><span>'+innerObj.html()+'</span></span>';
			}
		});
		if(objParent.hasClass('gwe_page_city'))
		objParent.append('<div class="checkbox gwe_page_city '+obj.attr('class')+'">'+str+'</div>');
		else
		objParent.append('<div class="checkbox '+obj.attr('class')+'">'+str+'</div>');
	});
	/*
	SUBMIT VALIDATION
	*/
	$('form').submit(function(){
		$('.alert').removeClass('alert');
		var result = true;
		$('form p:visible input.input').each(function(){
			var Obj = $(this);
			if(Obj.attr('value') == ""){
				Obj.addClass('alert');
			}else{
				Obj.removeClass('alert');
			}
		});
		$('form p:visible textarea.input').each(function(){
			var Obj = $(this);
			if(Obj.val() == ""){
				Obj.addClass('alert');
			}else{
				Obj.removeClass('alert');
			}
		});
		if($('#gwe_content_ifr').html() != null && $('#gwe_content_ifr').html() != undefined){
			if(stripHTML($('#gwe_content_ifr').contents().find('#tinymce').html()) == ""){
				$('#gwe_content_tbl').addClass('alert');
			}else{
				$('#gwe_content_tbl').removeClass('alert');
			}
		}
		$('form p:visible .select, .select .checkbox').each(function(){
				$(this).addClass('alert');
		});
		$('form p:visible .select option:selected').each(function(){
			var Obj = $(this);
			if(Obj.val() != ""){
				Obj.parent().removeClass('alert');
				Obj.parent().parent().find('.checkbox').removeClass('alert');
			}
		});

		$('form p:visible input:radio').each(function(){
				$(this).parent().addClass('alert');
		});
		$('form p:visible input:checked').each(function(){
			var Obj = $(this);
			if(Obj.val() != "")
			Obj.parent().removeClass('alert');
		});
		if($('#upload_list').html() == ""){
			$('.file').addClass('alert');
		}else if($('#upload_list').html() != "")
			$('.file').removeClass('alert');
		$('.alert').each(function(){
			result = false;
			return false;
		});
		if(result)
			$(".submit").attr('disabled', 'true');
		else
			alert("We found some problems highlighted in red. Please try again.");
		return result;
	});
	/*
	TIPSY
	*/

	$('.tooltipn').tipsy({gravity: 'sw',html: true});
	$('.tooltips').tipsy({fade:true, gravity: 'w',html: true});
	$('#facebooklike').tipsy({trigger: 'manual', gravity: 'w'}).tipsy("show");
	$('.loggedin').tipsy({fade:true, gravity: 'n',html: true}).trigger('mouseenter');
	$('.tooltipse').tipsy({fade:true, gravity: 'e',html: true});

	/*
	AJAX
	*/

	if($.cookie('morelook') == null || $.cookie('morelook') == ""){
		$.cookie('morelook-vote','', { expires: 90 });
		$.cookie('morelook', Math.uuid(), { expires: 90 });
	}
	var vote = function(){
		var current = $(this);
		var postid = current.parent().attr('class');
		var postid = postid.split('-');
		var postid =  postid[1];
		var path = 'http://morelook.com/content/addons/morelook/morelook-core/ajax/';
		//var path = 'http://morelooks.com/wp-content/plugins/morelook/morelook-core/ajax/';
		if(current.attr('id') == 'trash'){
			var Obj = {
				'id':postid,
				'action':'T',
				'type':'P'
			}
		}else if(current.attr('id') == 'soldout'){
			var Obj = {
				'id':postid,
				'action':'S',
				'type':'P'
			}

		}
		if(Obj != null){
			$.post(path+"post.php", { id: Obj.id, action: Obj.action, type:Obj.type, request: 'A' },
			function(data){
				if(data.result){
					var moretag = "morelook-"+ current.attr('id');
					var title = current.attr('title');
					if(title == "")
						var title = current.attr('original-title');
					var array = title.split('people');
					var newtitle = (parseInt(array[0])+1)+' people '+array[1];
					current.attr('title', newtitle);
					current.attr('id', current.attr('id') + 'ed');
					var value = $.cookie(moretag);
					if(typeof value != 'null' && typeof value != 'undefined' && value != null){
						if(value.indexOf(postid) == -1){
							value = postid +';'+ value;
							$.cookie(moretag, value, { expires: 90 });
						}
					}else{
						value = postid +';'+ value;
						$.cookie(moretag, value);
					}
				}else{
					alert(data.msg);
				}
			}, "json");
		}
		return false;
	}
	$('#trash, #soldout').bind('click', vote);

	/****************************
	*							*
	*		Password Meter		*
	*							*
	****************************/
	$('#user_password').keyup(function(){check_pass_strength.call(this, '#user_password')})
	$('#user_confirm_password').keyup(function(){check_pass_strength.call(this, '#user_confirm_password')})
	function check_pass_strength(selector) {
		var pass = $(selector).val(), user = $('#user_login').val(), strength;

		$('#pass-strength-result').removeClass('short bad good strong');

		if ( ! pass ) {

			$('#pass-strength-result').html( 'Very Weak' );
			return;
		}

		strength = passwordStrength(pass, user);
		switch ( strength ) {
			case 2:
				$('#pass-strength-result').addClass('bad').html( 'Weak' );
				break;
			case 3:
				$('#pass-strength-result').addClass('good').html( 'Medium' );
				break;
			case 4:
				$('#pass-strength-result').addClass('strong').html( 'Strong' );
				break;
			default:
				$('#pass-strength-result').addClass('short').html( 'Very Weak' );
		}
	}
	/****************************
	*							*
	*		CHECKBOX ALL 		*
	*							*
	****************************/
	var checkedALL = function(){
		var obj = $(this);
		if(obj.attr('checked')){
			$('.sub_checkbox, .master_checkbox').attr('checked', true);
		}else{
			$('.sub_checkbox, .master_checkbox').attr('checked', false);
		}
	}
	$('.master_checkbox').bind('click', checkedALL);

	/****************************
	*							*
	*		ADMIN TRASH 		*
	*							*
	****************************/
	$('.entry.admin').hover(function(){
		$(this).css('border', '#CCC dotted 5px');
	},function(){
		$(this).css('border', '');
	});
	$('.entry.admin').live('click', function(){
		$(this).css('border', '').removeClass('admin').addClass('selected');
	});
	$('.entry.selected').live('click', function(){
		$(this).removeClass('selected').addClass('admin');
	});

	$('.admin-junk-empty').bind('click', function(){
		var answer = confirm("Are you sure you want to HIDE these items?")
		if (!answer){
			return false;
		}
		var obj = $(this);
		obj.removeClass('admin-junk-empty').addClass('admin-junk-full');
		var post_array = new Array();
		var path = 'http://morelook.com/content/addons/morelook/morelook-core/ajax/';
		//var path = 'http://morelooks.com/wp-content/plugins/morelook/morelook-core/ajax/';
		$('.entry.selected').each(function(){
			var selected = $(this);
			var postid = selected.parent().attr('id');
			var postid = postid.split('-');
			var postid =  postid[1];
			post_array.push(postid);
		});
		var query = post_array.join(',');
		if(query != ""){
			$.post(path+"update.php", { id: query},
			function(data){
				if(data.result){
					$('.entry.selected').each(function(){
						$(this).parent().remove();
					});
					obj.addClass('admin-junk-empty').removeClass('admin-junk-full');
				}else{
					obj.addClass('admin-junk-empty').removeClass('admin-junk-full');
					alert(data.msg);
				}
			}, "json");
		}else{
			obj.addClass('admin-junk-empty').removeClass('admin-junk-full');
			alert('no item was selected');
		}
	});

	$('.admin-junk-delete').bind('click', function(){
		var answer = confirm("Are you sure you want to DELETE these items?")
		if (!answer){
			return false;
		}

		var obj = $(this);
		obj.removeClass('admin-junk-delete').addClass('admin-junk-deleting');
		var post_array = new Array();
		var path = 'http://morelook.com/content/addons/morelook/morelook-core/ajax/';
		//var path = 'http://morelooks.com/wp-content/plugins/morelook/morelook-core/ajax/';
		$('.entry.selected').each(function(){
			var selected = $(this);
			var postid = selected.parent().attr('id');
			var postid = postid.split('-');
			var postid =  postid[1];
			post_array.push(postid);
		});
		var query = post_array.join(',');
		if(query != ""){
			$.post(path+"update.php", { id: query, deleting: true},
			function(data){
				if(data.result){
					$('.entry.selected').each(function(){
						$(this).parent().remove();
					});
					obj.addClass('admin-junk-delete').removeClass('admin-junk-deleting');
				}else{
					obj.addClass('admin-junk-delete').removeClass('admin-junk-deleting');
					alert(data.msg);
				}
			}, "json");
		}else{
			obj.addClass('admin-junk-delete').removeClass('admin-junk-deleting');
			alert('no item was selected');
		}
	});
});




