


$(window).resize( function() { arrange();});

//$(document).ready(function(){ arrange(true);})


function arrange(first){

	var height = $(window).height();
	
	var width = $(window).width();
	
	var contentPar = $("#content").parent();
	
	
	if(window.screen.width==1024 && window.screen.height==768){
	
		
		if(height>650){
			contentPar.css("height",height-59);
			$("#footer").parent().css("top",height-20);
		}else{
			contentPar.css("height",650-59);
			$("#footer").parent().css("top",650-20);
			//contentPar.css("height",550);
		}
		
		var a = 1005;
		
		if(width>a){
		
			$("#content").parent().css('width',"100%");
		}else{
			
			$("#content").parent().css('width',a);
		}
			
		if(width>a){
		
			$("#navigation").parent().css('width',"100%");
			
			$("#footer").parent().css("width","100%");
		}else{
			
			$("#navigation").parent().css('width',a);
			
			$("#footer").parent().css("width",a);
		}
	}else{
		
		
		
		
		
		if(height>650){
			contentPar.css("height",height-59);
			$("#footer").parent().css("top",height-20);
		}else{
			contentPar.css("height",650-59);
			$("#footer").parent().css("top",650-20);
			//contentPar.css("height",550);
		}
		
			//$("#footer").parent().css("top","94%");
	
		
			//$("#footer").parent().css("top","750px")
		
		
		if(width>1024){
		
			$("#content").parent().css('width',"100%");
			
		}else{
			
			$("#content").parent().css('width',1024);
			
		}
		
		
		if(width>1024){
		
			$("#navigation").parent().css('width',"100%");
			
			$("#footer").parent().css("width","100%");
		}else{
			
			$("#navigation").parent().css('width',1024);
			
			$("#footer").parent().css("width",1024);
		}
		
	}	
}


function setNavMaxHeight(){
	
	$("#navigation").parent().css("height","340px");


}


function setNavMinHeight(){
	
	$("#navigation").parent().css("height","50px");

}


function openTerms() {
	var win = window.open("/swf/html/terms.html", "popWin",'width=650,height=600,scrollbars=yes');
	win.focus();
	
}

function openCopyright() {
	var win = window.open("/swf/html/terms.html", "popWin",'width=650,height=600,scrollbars=yes');
	win.focus();
}

function openRss() {
	var win = window.open("http://feeds.feedburner.com/converse/lyrics/cn", "rss");
	win.focus();
}


function gotoTop(){

	
	scrollTo(0,0);
	//document.body.scrollHeight = 0;
}
var navigationName = "navigation";

var footerName = "footer";

function getFlashObj(name){
	var flashObj;
	if(navigator.appName.indexOf ("Microsoft") !=-1){
		flashObj = window[name];
	
	}else{
		flashObj = document[name];
	}
	return flashObj
}


$(window).resize( function(){ adjustNavPos();});

function adjustNavPos(){

	var navObj = getFlashObj(navigationName);
	
	var footerObj = getFlashObj(footerName);
	
	
	var height = $(window).height();
	
	var width = $(window).width();
	
	if(footerObj){
		
		var leftX = 15;
		
		var rightX = 0;
		
		var rightOffx = 140;
		
		/*
		if(window.screen.width==1280 && window.screen.height==1024){
		
			rightOffx = 120;
		}else{
		
			rightOffx = 120;
		}*/
		
		if(width>1024){
			rightX = width + (window.screen.width-1024)/20 - rightOffx;
		}else{
			rightX = 1024 + (window.screen.width-1024)/20 - rightOffx;
		}
	
			
		footerObj.footerResize(leftX,rightX);
	
		
	}
	
	if(navObj){
		
		var logoX = 10;
		
		var musicX = 0;
		
		var rightOffx = 80;
		
		if(width>1024){
			musicX = width + (window.screen.width-1024)/20 - rightOffx;
		}else{
			musicX = 1024 + (window.screen.width-1024)/20 - rightOffx;
		}
		
		/*
		if((window.screen.width==1024 && window.screen.height==768)||(window.screen.width==1440 && window.screen.height==900)||(window.screen.width==1280 && window.screen.height==800)){
			if(width<1024){
		
				musicX = 1024 - 80;
			}else{
			
				musicX =  width - 80;
			}
		
		}else{
			if(width<1024){
		
				musicX = 1024 - 60;
			}else{
			
				musicX =  width - 60;
			}
		}*/
		
		
		navObj.stageResize(logoX,musicX);
		
		
	}
}

function track(code){
	if (code == "/") {
		code = "/nizhizao/artists";
	}
	
	if (code.charAt(code.length-1) == "/") {
		code = code.substring(0,code.length-1);
	}
	
	pageTracker._trackPageview(code);
}

function trackClick(code){
	code = "/click/" + code;
	pageTracker._trackPageview(code);
}


function callMusicPlayer(type){

	window.open('../swf/musicPlayer/musicPlayer.html','newwindow','height=106,width=236');

}

//var navigationObj = navigator.appName.indexOf ("Microsoft") !=-1)?window[navigationName]:document[navigationName];
//alert(navigationObj);

