///////////////
// encrypt() //
///////////////

function encrypt(username,hostname,linktext,subject,message){
var username = username || 'autohome';
var hostname = hostname || 'tbaytel.net';
var address = username + '&#64;' + hostname;
var linktext = linktext || address;
var subject = subject || '';
if (subject != '') {
subject = '?subject=' + subject;
}
var message = message || '';
if (message != '') {
message = '?body=' + message;
}
var output = '<a href="&#109;&#97;&#105;&#108;' + '&#116;&#111;&#58;'+ address + subject + message +'" class="email">'+ linktext +'</a>';
document.write(output);
}

////////////////
// menuInit() //
////////////////

function menuInit() {
$('#side_nav ul ul').hide();
$('#side_nav li a').click(
function() {
var checkElement = $(this).next();
if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
checkElement.animate({opacity: 'hide', height: 'hide'}, 'normal');
}
if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
$('#side_nav ul ul:visible').animate({opacity: 'hide', height: 'hide'}, 'normal');
checkElement.animate({opacity: 'show', height: 'show'}, 'normal');
}
}
);
}

$(document).ready(function() {

var urlHash = window.location.hash;

if (urlHash) {
var t = setTimeout(function() {
$('#content').scrollTo($(urlHash),1000, {onAfter:function(){ window.location.hash = $(urlHash).attr('name');}});
},1000);
}

$('#front a').each(function(){
var href = $(this).attr('href');
$(this).attr('href','javascript:;');
$(this).click(function(){
$('#content').stop(true);
$('#content').scrollTo($(href),1000, {onAfter:function(){ window.location.hash = $(href).attr('name');}});
});
});

$('#content').wrap('<div id="content_container"></div>');
$('#content_container').css('position','absolute');
$('#content_container').css('top','105px');
$('#content_container').css('width','900px');
$('#content_container').css('height','390px');
$('#content_container').css('overflow','auto');

// $('#content').css('overflow','auto');
// $('#content').css('padding','0px 17px 17px 0px');

// $('#content').css('top','105px');
$('#content').css('height','390px');
$('#content').css('position','absolute');

$('#content').children('div').each(function(i){
var width = 0;
$(this).children('div').each(function(j){
width += $(this).width();
$(this).css('float','left');
$(this).css('padding-top','0px');
});
$(this).css('width',width +'px');
$(this).css('height','390px');
});

menuInit();

});
