window.$i = function(id){
	return document.getElementById(id);
}
String.prototype.trim = function(){
    return this.replace(/(^\s*)|(\s*$)/g,"");
}
function goToLoginFrame(url)
{
	if(loginFrameWindow != null)
	{
		 loginFrameWindow.close();
	}
	var left = Math.floor( (screen.width - 420) / 2);
	var top = Math.floor( (screen.height - 300) / 2);
    loginFrameWindow = window.open("/user/loginframe.screen?pourl="+encodeURI(url),"","width="+420+",height=300,top="+top+",left="+left);
}
var open_zhuWin;
function winOpen(url)
{
	if(open_zhuWin !=null && open_zhuWin.open && !open_zhuWin.closed)
	{
		open_zhuWin.focus();
		open_zhuWin.window.location = url;
	}
	else
	{
	    open_zhuWin = window.open(url);
	}
}
function goMy12530()
{
	if(loginflag)
	{
		AJLOG.G_mod('1.5');
	    winOpen('/user/my_index.screen');
	}
	else
	{
		winOpen('/user/index.screen?lgw=2');
	}
}
//****************************

//滚动导航栏
function initScrollTop()
{
    $(".scr_navbtn1").mouseover(function(){
       $(this).addClass("scr_navbtn2").mouseout(function(){
	       $(this).removeClass("scr_navbtn2");
	   });
   });
   window.setInterval(function(){ 
       if($("#scrolltopdiv").offset().top != document.documentElement.scrollTop)
       $("#scrolltopdiv").animate({top:document.documentElement.scrollTop+"px"},500);

   },500);
}
//载入铃音
function loadTones()
{
	$("#sping_infodiv").html(loadingStr);
	$.get("sv.jsp?mt=t&hid="+arr_hid[0]+"&r="+Math.random(),function(data){
	    $("#sping_infodiv").html($.trim(data));
	});
    
	$("#summer_infodiv").html(loadingStr);
	$.get("sv.jsp?mt=t&hid="+arr_hid[1]+"&r="+Math.random(),function(data){
	    $("#summer_infodiv").html($.trim(data));
	});

    $("#autumn_infodiv").html(loadingStr);
	$.get("sv.jsp?mt=t&hid="+arr_hid[2]+"&r="+Math.random(),function(data){
	    $("#autumn_infodiv").html($.trim(data));
	});

    $("#winter_infodiv").html(loadingStr);
	$.get("sv.jsp?mt=t&hid="+arr_hid[3]+"&r="+Math.random(),function(data){
	    $("#winter_infodiv").html($.trim(data));
	});
}
//载入sub链接
function loadSubs()
{
	$("#subs_infodiv").html(loadingStr);
	$.get("sv.jsp?mt=sb&r="+Math.random(),function(data){
	    $("#subs_infodiv").html($.trim(data));
	})
}
function init_window()
{
	window.setInterval(function(){
		var w = $("#bg_top").width() < 968 ? '968px' : document.body.scrollWidth+'px';
		$("#scrolltopdiv").width(w);
		$("#bg_top").width(w);
		$("#bg_foot").width(w);
	},500);
}
$(document).ready(function(){
    initScrollTop();
    loadTones();
    loadSubs();
	init_window();
});
