// JavaScript Document
$(function(){
		   
		   
		   //autowidowobj
		   autowidowobj(".gg-sidebar");
		   
		   //verticalobj
  		   verticalobj(".contact-content");
		   verticalobj(".chuangyi-content");
		   verticalobj(".news-content");
          verticalobj(".flash");  
           //lefttab
		   lefttab();
		   //switchtab
		  switchtab(".subnav a","on",".company");
		//  switchtab(".subnav-two a","on",".play-list");
		  
		  //playlistobj
	      playlistobj2();
        //autoheightobj
		   autoheightobj(".sidebar","#content",".sidebar-left");
		   })
//ҳ�桢�˵�������ҳ�߶�ͳһ
var autoheightobj = function(leftheight,rightheight,total){
	
	var lheight = parseInt($(leftheight).height());
	
	var wheight = parseInt($(document).height());
	
	if(lheight < wheight)
	{
		lheight = wheight;
		$(total).css("height",lheight);
		dheightd(lheight);
	}
	
	var rheight = parseInt($(rightheight).height());
	
	if(lheight > rheight)
	{
		$(rightheight).css("height",lheight);
		dheightd(lheight);
	}else
	{
	    $(leftheight).css("height",rightheight);	
		dheightd(rightheight);
	}
	                                           };
//��һ�ĸ߶�ͳһ
var autowidowobj = function(obj){
	
var wheight = 0;
var winHeight = $(window).height();
if(winHeight!=null) {
	wheight = parseInt();
}
	
	var oheight = parseInt($(obj).height());
	
	if(oheight < wheight)
	{
	    $(obj).css("height",wheight);	
	}
	
	
	
	                               };

//��ֱ����
var verticalobj = function(obj){
	
	var wheight = parseInt($(window).height());
	
	var wwidth = parseInt($(window).width());
	
	var objheight = parseInt($(obj).height());

	var objwidth = parseInt($(obj).width());
	
	var lleft = (wwidth/2)-(objwidth/2);
	
	var ttop = (wheight/2)-(objheight/2);
   

	$(obj).css({"left":lleft,"top":ttop});

	};

//���˵��л�
var lefttab = function(){
	   
	   $(".gg-sidebar a").hover(function(){
							   $(this).parent().hide();
							   $(".sidebar").show();
							   },function(){
								   
								   
								   });
	   $(".sidebar").hover(function(){
							
									},function(){
								$(this).hide();
								$(".gg-sidebar").show();
										});
	   
	};
//�˵�tab�л�
var switchtab = function(obj,cllass,target){
	$(obj).click(function(){
                     
						  $(obj).removeClass("on");
						  $(this).addClass("on");
						  var xtype = $(this).attr("xtype");
						  $(target).hide();
						  $(target+"[tab='"+xtype+"']").show();
						  
						  
						  },function(){});
	
	};
//
var playlistobj2 = function(){
	$(".play-list a").click(function(){
							    
								var positionobj = $(this).offset();
								var pleft = parseInt(positionobj.left)+46;
								var ptop = parseInt(positionobj.top)+54;
								$(".play-list-spc").css({"left":pleft,"top":ptop});
								$(".play-list-spc").show();
								
									 },function(){
								$(".play-list-spc").hide();     	 
									    });
	};

//�����б��Ч��



	
var dheightd = function(obj){
	var dheight = $(document).height();
	obj = parseInt(obj);
	$(".gg-sidebar").css("height",obj);
	$(".allbackbg").css("height",dheight);
	
	};
















