var HomePage = {};
HomePage.MostBox = {};
HomePage.MostBox.Page = 9;
HomePage.MostBox.AnimationActive = false;
HomePage.MostBox.Obj = "MostBox1";
HomePage.MostBox.MoveRight = function(obj){
HomePage.MostBox.Obj = $(obj).attr("action");
var xFunction = "xmostview";
if(HomePage.MostBox.Obj == "MostBox2"){
xFunction = "xnewview";
}
if(!HomePage.MostBox.AnimationActive){
HomePage.MostBox.AnimationActive = true;
$.ajax({
url: "http://colorsofmagic.net/index.php/home/" + xFunction + "/" + HomePage.MostBox.Page,
success: function(Responce){
HomePage.MostBox.AnimateRight(jQuery.parseJSON(Responce));
HomePage.MostBox.Page++;
}
});
}
};
HomePage.MostBox.AnimateRight = function(Item){
$("#"+ HomePage.MostBox.Obj +" .MostBoxPictures").append(HomePage.MostBox.BuildItem(Item));
$("#"+ HomePage.MostBox.Obj +" .MostBoxPictures .Select img").attr("width","75");
$("#"+ HomePage.MostBox.Obj +" .MostBoxPictures .Select img").attr("height","75");
$("#"+ HomePage.MostBox.Obj +" .MostBoxPictures .Select").attr("class","");
$("#"+ HomePage.MostBox.Obj +" .MostBoxPictures a:nth-child(6)").attr("class", "Select");
$("#"+ HomePage.MostBox.Obj +" .MostBoxPictures .Select img").attr("width","93");
$("#"+ HomePage.MostBox.Obj +" .MostBoxPictures .Select img").attr("height","93");
$("#"+ HomePage.MostBox.Obj +" .MostBoxNavigation div").text($("#"+ HomePage.MostBox.Obj +" .MostBoxPictures .Select").attr("user"));
$("#"+ HomePage.MostBox.Obj +" .MostBoxPictures a:nth-child(1)").animate({width : "0px", marginRight: "0px"}, 700, function(){
$("#"+ HomePage.MostBox.Obj +" .MostBoxPictures a:nth-child(1)").remove();
HomePage.MostBox.AnimationActive = false;
});
};
HomePage.MostBox.MoveLeft = function(obj){
HomePage.MostBox.Obj = $(obj).attr("action");
var xFunction = "xmostview";
if(HomePage.MostBox.Obj == "MostBox2"){
xFunction = "xnewview";
}
if(!HomePage.MostBox.AnimationActive && (HomePage.MostBox.Page - 10) >= 0){
HomePage.MostBox.AnimationActive = true;
$.ajax({
url: "http://colorsofmagic.net/index.php/home/" + xFunction + "/" + (HomePage.MostBox.Page - 10),
success: function(Responce){
HomePage.MostBox.AnimateLeft(jQuery.parseJSON(Responce));
HomePage.MostBox.Page--;
}
});
}
};
HomePage.MostBox.AnimateLeft = function(Item){
$("#"+ HomePage.MostBox.Obj +" .MostBoxPictures a:nth-child(1)").before(HomePage.MostBox.BuildZeroItem(Item));
$("#"+ HomePage.MostBox.Obj +" .MostBoxPictures .Select img").attr("width","75");
$("#"+ HomePage.MostBox.Obj +" .MostBoxPictures .Select img").attr("height","75");
$("#"+ HomePage.MostBox.Obj +" .MostBoxPictures .Select").attr("class","");
$("#"+ HomePage.MostBox.Obj +" .MostBoxPictures a:nth-child(5)").attr("class", "Select");
$("#"+ HomePage.MostBox.Obj +" .MostBoxPictures .Select img").attr("width","93");
$("#"+ HomePage.MostBox.Obj +" .MostBoxPictures .Select img").attr("height","93");
$("#"+ HomePage.MostBox.Obj +" .MostBoxNavigation div").text($("#"+ HomePage.MostBox.Obj +" .MostBoxPictures .Select").attr("user"));
$("#"+ HomePage.MostBox.Obj +" .MostBoxPictures a:nth-child(1)").animate({width : "75px", marginRight: "15px"}, 700, function(){
$("#"+ HomePage.MostBox.Obj +" .MostBoxPictures a:nth-child(10)").remove();
HomePage.MostBox.AnimationActive = false;
});
};
HomePage.MostBox.BuildZeroItem = function(ItemValues){
return "";
};
HomePage.MostBox.BuildItem = function(ItemValues){
return "
";
};
HomePage.Moon = {};
HomePage.Moon.AnimationActive = false;
HomePage.Moon.MoveNext = function(){
if(!HomePage.Moon.AnimationActive){
$('.MoonThisWeek').text('Лунен календар 2011');
HomePage.Moon.AnimationActive = true;
var ID = $('#MoonMenu li:nth-child(9)').attr("n");
$.ajax({
url: "http://colorsofmagic.net/index.php/home/xmoon/" + ID,
success: function(Responce){
HomePage.Moon.AnimateRight(jQuery.parseJSON(Responce));
}
});
}
};
HomePage.Moon.AnimateRight = function(Data){
$('#MoonMenu').append(HomePage.Moon.BuildItem(Data, 100, 18));
$('#MoonMenu li:nth-child(1)').animate({width : ["0px" , "linear"] , marginRight : ["0px" , "linear"]},900,function(){
$('#MoonMenu li:nth-child(1)').remove();
HomePage.Moon.AnimationActive = false;
});
$('#MoonMenu li:nth-child(3) img').animate({marginTop: [ "16px","linear"], width : ["46px" , "linear"], height : ["46px" , "linear"]},900);
$('#MoonMenu li:nth-child(4) img').animate({marginTop: [ "8px","linear"], width : ["54px" , "linear"], height : ["54px" , "linear"]},900);
$('#MoonMenu li:nth-child(5) img').animate({marginTop: [ "4px","linear"], width : ["62px" , "linear"], height : ["62px" , "linear"]},900);
$('#MoonMenu li:nth-child(6) img').animate({marginTop: [ "0px","linear"], width : ["70px" , "linear"], height : ["70px" , "linear"]},900);
$('#MoonMenu li:nth-child(7) img').animate({marginTop: [ "4px","linear"], width : ["62px" , "linear"], height : ["62px" , "linear"]},900);
$('#MoonMenu li:nth-child(8) img').animate({marginTop: [ "8px","linear"], width : ["54px" , "linear"], height : ["54px" , "linear"]},900);
$('#MoonMenu li:nth-child(9) img').animate({marginTop: [ "12px","linear"], width : ["46px" , "linear"], height : ["46px" , "linear"]},900);
$('#MoonMenu li:nth-child(10) img').animate({marginTop: [ "16px","linear"], width : ["38px" , "linear"], height : ["38px" , "linear"]},900);
};
HomePage.Moon.BuildItem = function(ItemValues , Width, mRight){
return "

