
var show_menu = false;
var sel_menu  = 0;
var SM_TIMER  = null;
var SM_INTERVAL = 4000;



/*
function showSubMenu(obj){
    
    var cat = obj.attr('rel');
            
            if (sel_menu != cat){            
                show_menu = true;
                sel_menu = cat;
                
               $('.sub_x').hide();
               $('#sub' + cat).show();
               show_menu = false;
               
               clearTimeout(SM_TIMER);
            }
}*/

$(function(){    
    $(window).load(function(){
        
        $('img.detail_picture, img.preview_picture, img.cornerPic').each(function(){        
        
            html = '';
            src  = $(this).attr('src');
            
            width = $(this).attr('width');
            height = $(this).attr('height');
            
            if (!width) width = $(this).width();
            if (!height) height = $(this).height();
            
            add_style = $()
            
            
            html = '<div class="'+$(this).attr('class')+'" style="'+$(this).attr('style')+';"><div>'+
            '<div class="cornerImg rounded rc5" style="background: url('+src+') no-repeat; width:'+width+'px; height:'+height+'px; background-position:50% 50%; border: 1px solid #D9D9BF"><!-- --></div>'+
            '</div></div>';
            
            $(this).replaceWith(html);
        
        });
        
        
        
        if ($.browser.mozilla || $.browser.safari){
            
            $('.cornerImg').css('-moz-border-radius', '8px');
            $('.cornerImg').css('-webkit-border-radius', '8px');
            $('.cornerImg').css('border-radius', '8px');
        } else {
            //$('.cornerImg').corner('8px');
            
            $('.cornerImg').corner("8px").parent().css('padding', '1px').corner("8px")
        }
        
    });
});

function open_window(url, width, height, windowname)
{
	if(!windowname) windowname = window;
	if(!width) width = 800;
	if(!height) height = 600;
	var left = (screen.width - width)/2;
	//alert(wnd.opener);
	//if (wnd.opener){alert("win true");}
	//else {alert("win false");}
	var wnd = window.open(url , windowname,"left="+left+",top=100,width=" + width + ",height=" + height + ",directories=no,menubar=no,status=yes,resizable=yes,scrollbars=yes,toolbar=no");
	if (wnd.opener == null){ wnd.opener = self; }
	wnd.focus();
}

$().ready(function() {
	$("a.detail-link").click(function(){
		var url = $(this).attr("href");
		open_window(url,'681','800', 'detail');
		return false;
	});
});

