$(document).ready(function(){
	
	$('.leftmenu > li > a').append('<img src="/img/corn.png" class="png corn">');
	
	$('.rightmenu > li[class!=sel]').mouseenter(function(){
		$(this).animate({marginLeft:'-10px'},100);
		//$(this).addClass('hov')
	});
	$('.rightmenu > li[class!=sel]').mouseleave(function(){
		//$(this).removeClass('hov')
		$(this).animate({marginLeft:'0'},50);
	});
	
	$('.grayborder').append('<img src="/img/wcorn_tl.gif" class="wctl"><img src="/img/wcorn_tr.gif" class="wctr"><img src="/img/wcorn_bl.gif" class="wcbl"><img src="/img/wcorn_br.gif" class="wcbr">');
	
	$('.photo140, .photo120, .photorounded').append('<img src="/img/corn_tl.png" class="png ctl"><img src="/img/cort_tr.png" class="png ctr"><img src="/img/corn_bl.png" class="png cbl"><img src="/img/corn_br.png" class="png cbr">');
});

function initGalleryMul()
{
	$('#photogallery_medphoto').load(function(){
		$(this).parent().parent().css('height','auto');
		$(this).fadeIn(300)
	});
	
	$('.thumbblock > .inner > .item > a').click(function(){
		$rel=$(this).attr('rel');
		$hre=$(this).attr('href');

		$('#photogallery_medphoto').parent().parent().css('height',$('#photogallery_medphoto').height()+'px');
		$('#photogallery_medphoto').fadeOut(200,function(){
			$('#photogallery_medphoto').attr('src',$rel);
			$('#photogallery_medphoto').parent().attr('href',$hre);
		});
    			
    return false;
  });	
  
  $('.thumbblock > .inner:gt(0)').hide();
  
  $('.thumbblock > .name > a').click(function(){
  	rel=$(this).attr('rel');

		$('.thumbblock > .inner').parent().css('height','auto');
  	$('.thumbblock > .inner[id!='+rel+']').slideUp(300);
  	$('#'+rel).slideDown(400,function(){$('#'+rel).parent().css('height',$('#'+rel).parent().height()+'px')});

		return false;  	
  });
}


function openWindow(url, x, y, name, scroll, resize) {
  var cx = screen.width / 2 - (x / 2);
  var cy = screen.height / 2 - (y / 2);

  if(cx < 0) {
    x  = 0.8 * screen.width;
    cx = 0.1 * screen.width;
  }

  if(cy < 0) {
    y  = 0.8 * screen.height;
    cy = 0.1 * screen.height;
  }
  
  var isscrollbars = (scroll) ? 'yes' : 'no';
  var resizable = (resize) ? 'yes' : 'no';

  if(scroll == 'yes' ) {
    x += 25;
    y += 25;
  }

  window.open(url, name, "toolbar=no,status=no,directories=no,menubar=no,resizable=" + resizable + ",width=" + x + ", height=" + y + ", scrollbars=" + isscrollbars + ",top=" + cy + ",left=" + cx);

  return false;
}
