var IsUserLogined=false;
function dorz(){	

	var dd=document.getElementById("autosize_wrapper");
	var rr=document.getElementById("wrapper");

	var fw=window.document.body.offsetWidth;
	
	if(fw>1000){		
		dd.style.width=fw+"px";
		rr.style.marginLeft=((fw-1000)/2)+"px";
	}else{
		dd.style.width="1000px";
		rr.style.marginLeft="0px";
	}
	
}
function initUserPanel(){	
	$('.loginreg .login').click(ShowLoginForm);
		$.get('/member/AjaxGetUserInfo.action?rand='+Math.random(),function(result){
		var rzarr =	result.split(':');
		
		if(rzarr[0]=='LOGIN'){
			IsUserLogined=true;			
			$('.loginreg').html('<a href="/member/UCenter.action" class="uname">您好,'+rzarr[1]+'</a> <a href="/member/MemberLogout.action" class="logout">[退出]</a>');
		    $('.loginreg').show();
		}else{
			$('.loginreg').show();
		}
		
	});		
}
function initMenu(){
	
	$('.menu_btn').click(function(){return false;});
	
	$('.menu_btn').mouseover(function(){
		var submenus=$(this).parent().find('.menu_submenu .menu_submenu_item').size();
		if(submenus==0){
			$(this).css('color','#FB1B82');
			$(this).css('background-image','url(images/menu2.png)');
			return;
		}
		
		$(this).animate({'top':"105px"});
		var top=100-submenus*20;
		
		$(this).parent().find('.menu_submenu').stop(true,false).animate({'top':top+"px"},500).mouseleave(function(){
				//$(this).parent().find('.menu_btn').stop(true,true).fadeIn('fast');
				$(this).animate({'top':"65px"});
				 $(this).stop().animate({'top':"105px"},function(){
						
				});
		})
		
	}).mouseout(function(){
		var submenus=$(this).parent().find('.menu_submenu .menu_submenu_item').size();
		if(submenus==0){
			$(this).css('color','#ccc');
			$(this).css('background-image','url(images/menu0.png)');
			return;
		}
	})
	$('.menu_btn_box').mouseleave(function(){
		$(this).find('.menu_btn').stop(true,true).animate({'top':"65px"});
		$(this).find('.menu_submenu').stop(true,false).animate({'top':"105px"},function(){
			//$(this).animate({'top':"65px"});$(this).parent().find('.menu_btn').stop(true,true).fadeIn('fast');
		});
	})
}
function HideLoginFrom(uname){
	$('.loginfrombox').hide();
	$('.loginfromcover').stop(true,false).fadeOut();
	
	$('.loginreg').html('<a href="/member/UCenter.action" class="uname">您好,'+uname+'</a> <a href="/member/MemberLogout.action" class="logout">[退出]</a>');
	
	$('.loginfrom').stop(true,false).fadeOut();
}

function ShowLoginForm(){
	$('.loginfrombox').show();
	
	$('.loginfromcover').fadeIn().click(function(){
		$('.loginfrom').stop(true,false).fadeOut();	
		$(this).stop(true,false).fadeOut();		
	})
	$('.loginfrom').fadeIn();
	
	var cheight=$('.loginfromcover').height();
	var cwidth=$('.loginfromcover').width();
	
	if(cheight<100){
		$('.loginfromcover').height($('html').height());
		cheight=$('html').height();
			
	}
	
	
	var ltop=(cheight-$('.loginfrom ').height())/2;
	
	var lleft=(cwidth-$('.loginfrom').width())/2;
	

	
	$('.loginfrom').css({'left':lleft,'top':ltop});
	
	return false;
}

function fixPNG(myImage) {
var arVersion = navigator.appVersion.split("MSIE");
var version = parseFloat(arVersion[1]);
if ((version >= 5.5) && (version < 7) && (document.body.filters))
{
     var imgID = (myImage.id) ? "id='" + myImage.id + "' " : "";
     var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : "";
     var imgTitle = (myImage.title) ? "title='" + myImage.title   + "' " : "title='" + myImage.alt + "' ";
     var imgStyle = "display:inline-block;" + myImage.style.cssText;
     var strNewHTML = "<span " + imgID + imgClass + imgTitle
          + " style=\"" + "width:" + myImage.width
          + "px; height:" + myImage.height
          + "px;" + imgStyle + ";"
          + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
          + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>";
     myImage.outerHTML = strNewHTML;
} } 
