jQuery.noConflict();
(function($) { 
  $(function() {
	  function getInternetExplorerVersion()
	// Returns the version of Internet Explorer or a -1
	// (indicating the use of another browser).
	{
	  var rv = -1; // Return value assumes failure.
	  if (navigator.appName == 'Microsoft Internet Explorer')
	  {
	    var ua = navigator.userAgent;
	    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
	    if (re.exec(ua) != null)
	      rv = parseFloat( RegExp.$1 );
	  }
	  return rv;
	}
$(document).ready(function(){
	var ho;
	var wo;
	var xo;
	var yo;
	var ver = getInternetExplorerVersion();
	$('.close_insert').live('click',function(){$('.main_gallery_item').slideUp();});
	//$('.gallery_image img').css('-webkit-box-reflect','below 0px -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(0.8, transparent), to(white))')
		var navTimers = [];
		if(ver != -1 && ver < 9.0){
			$('.listings_group img').hover(function(){
				xo = ($(this).css('margin-left').replace('px',''))-5;
				yo = ($(this).css('margin-top').replace('px',''))-5;
				$(this).css({'border':'5px solid #ccc','margin-left':xo+'px','margin-top':yo+'px'});
				
			},
			function(){
				xo=xo+5;
				yo = yo+5;
				$(this).css({'border':'none','margin-top':yo+'px','margin-left':xo+'px'});
		        
			
			});

		}
		if(ver == -1 || (ver != -1 && ver >= 9.0)){
	$('.listings_group img').hover(function(){
		
		//$('.listings_group img').stop('true','true');
		
		var h = Math.floor($(this).height()*1.5);
		var w = Math.floor($(this).width()*1.5);
		
		ho = $(this).height();
		wo = $(this).width();
		
		if(ho > wo && ho){
			var extr = Math.floor((200/ho)*wo);
			//var corrwidth = 200-extr;
		ho = 200;
		wo = Math.floor(extr);
		h=Math.floor(ho*1.5);
		w=Math.floor(wo*1.5);
		//console.log('h:'+h+'w:'+w)
		}
		
		var margint = (h-ho)*1.10;
		var marginl = 0.5*(w-wo);
		$(this).css('z-index','1');
		var id = jQuery.data( this ); 
		var $this = $( this );  
		navTimers[id] = setTimeout(function(){
		$this.stop().animate({'opacity':'1.0','width':w+'px','-moz-box-shadow':'0px 5px 5px #666666','box-shadow':'0px 5px 5px #666666','left':'-'+marginl+'px','top':'-'+margint+'px','height':h+'px'}, {duration: 400,easing:'easeInCubic'});
		$('.listings_group img').not($this).animate({'opacity':'0.5'},600);
		navTimers[id] = '';
		},300);
		
	},function(){
		var id = jQuery.data( this );  
        if ( navTimers[id] != "" ) {  
            clearTimeout( navTimers[id] );  
        } else {  
		$(this).css('z-index','0');
		$('.listings_group img').not(this).animate({'opacity':'1.0'},200);
		$(this).stop().animate({'width':wo+'px','-moz-box-shadow':'5px 5px 5px #FFFFFF','box-shadow':'5px 5px 5px #FFFFFF','left':'0px','top':'0px','height':ho+'px'},{duration:200,easing:'easeOutQuad'});
		
        }
	});
		}
});



  });
})(jQuery);
