/**
* Created by IntelliJ IDEA.
* User: Elisa
* Date: 16-ago-2010
* Time: 15.19.03
* To change this template use File | Settings | File Templates.
*/
var feed = "rss/sponsor.xml";
var feed_news = "rss/news.xml";
var tot_elem_news = 0;
var num_page_news = 0;
var curr_page_news = 0;
var feed_games = "rss/games.xml";
var tot_elem_games = 0;
var num_page_games = 0;
var curr_page_games = 0;
var feed_team = "rss/team.xml";
function loadSponsor() {
$.ajax({
dataType: "text/xml",
url: feed,
type:"GET",
success: function(xml){
$('item', xml).each(function(i){
$("#partners").append(
'
'
);
})
},
error: function(){
$("#partners").append('Sorry, there is a server error, we will repair this problem as soon as possible !
');
},
complete: function(){
}
});
}
function loadNews() {
$.ajax({
dataType: "text/xml",
url: feed_news,
type:"GET",
success: function(xml){
$('item', xml).each(function(i){
tot_elem_news++;
});
if(tot_elem_news<=3){
$('item', xml).each(function(i){
$("#main").append(
''+
'
'+
'
Release Date: '+$(this).find('pubDate').text()+'
'+
'
'+
'
'+
'
'+$(this).find('description').text()+'
'+
'
'+
'
'
);
})
}else{
if(tot_elem_news%3 == 0){
num_page_news = tot_elem_news / 3;
}else{
num_page_news = parseInt(tot_elem_news / 3);
}
$('item', xml).each(function(i){
//alert(i);
if(i<3){
$("#main").append(
''+
'
'+
'
Release Date: '+$(this).find('pubDate').text()+'
'+
'
'+
'
'+
'
'+$(this).find('description').text()+'
'+
'
'+
'
'
);
}else{
}
});
$("#main").append('');
}
},
error: function(){
$("#main").append('Sorry, there is a server error, we will repair this problem as soon as possible !
');
},
complete: function(){
//alert("tot_elem: "+tot_elem+" , curr_page: "+curr_page+" , num_page: "+num_page);
loadSponsor();
}
});
}
function goBackNews(){
if(curr_page_news == 0){
}else{
curr_page_news--;
$("#main").children().remove();
$.ajax({
dataType: "text/xml",
url: feed_news,
type:"GET",
success: function(xml){
$('#main').append('News
');
$('item', xml).each(function(id){
if(id==(curr_page_news*3) || id==(curr_page_news*3)+1 || id==(curr_page_news*3)+2){
$("#main").append(
''+
'
'+
'
Release Date: '+$(this).find('pubDate').text()+'
'+
'
'+
'
'+
'
'+$(this).find('description').text()+'
'+
'
'+
//'
'+
//'
'+
'
'
);
}else{
}
});
},
complete: function(){
$("#main").append('');
//alert("tot_elem: "+tot_elem+" , curr_page: "+curr_page+" , num_page: "+num_page);
}
});
}
}
function goForwardNews(){
if(curr_page_news == num_page_news){
}else{
curr_page_news++;
$("#main").children().remove();
$.ajax({
dataType: "text/xml",
url: feed_news,
type:"GET",
success: function(xml){
$('#main').append('News
');
$('item', xml).each(function(id){
if(id==(curr_page_news*3) || id==(curr_page_news*3)+1 || id==(curr_page_news*3)+2){
$("#main").append(
''+
'
'+
'
Release Date: '+$(this).find('pubDate').text()+'
'+
'
'+
'
'+
'
'+$(this).find('description').text()+'
'+
'
'+
//'
'+
//'
'+
'
'
);
}else{
}
});
},
complete: function(){
$("#main").append('');
//alert("tot_elem: "+tot_elem+" , curr_page: "+curr_page+" , num_page: "+num_page);
}
});
}
}
function loadGames() {
$.ajax({
dataType: "text/xml",
url: feed_games,
type:"GET",
success: function(xml){
$('item', xml).each(function(i){
tot_elem_games++;
});
if(tot_elem_games <=3 ){
$('item', xml).each(function(i){
$("#main").append(
''+
'
'+
'
Release Date: '+$(this).find('pubDate').text()+'
'+
'
'+
'
'+
'
'+$(this).find('description').text()+'
'+
'
'+
//'
'+
'
'
);
})
}else{
if(tot_elem_games%3 == 0){
num_page_games = tot_elem_games / 3;
}else{
num_page_games = parseInt(tot_elem_games / 3);
}
$('item', xml).each(function(i){
//alert(i);
if(i<3){
$("#main").append(
''+
'
'+
'
Release Date: '+$(this).find('pubDate').text()+'
'+
'
'+
'
'+
'
'+$(this).find('description').text()+'
'+
'
'+
'
'
);
}else{
}
});
$("#main").append('');
}
},
error: function(){
$("#main").append('Sorry, there is a server error, we will repair this problem as soon as possible !
');
},
complete: function(){
//alert("tot_elem: "+tot_elem+" , curr_page: "+curr_page+" , num_page: "+num_page);
loadSponsor();
}
});
}
function goBackGames(){
if(curr_page_games == 0){
}else{
curr_page_games--;
$("#main").children().remove();
$.ajax({
dataType: "text/xml",
url: feed_games,
type:"GET",
success: function(xml){
$('#main').append('Games
');
$('item', xml).each(function(id){
if(id==(curr_page_games*3) || id==(curr_page_games*3)+1 || id==(curr_page_games*3)+2){
$("#main").append(
''+
'
'+
'
Release Date: '+$(this).find('pubDate').text()+'
'+
'
'+
'
'+
'
'+$(this).find('description').text()+'
'+
'
'+
//'
'+
//'
'+
'
'
);
}else{
}
});
},
complete: function(){
$("#main").append('');
//alert("tot_elem: "+tot_elem+" , curr_page: "+curr_page+" , num_page: "+num_page);
}
});
}
}
function goForwardGames(){
if(curr_page_games == num_page_games){
}else{
curr_page_games++;
$("#main").children().remove();
$.ajax({
dataType: "text/xml",
url: feed_games,
type:"GET",
success: function(xml){
$('#main').append('Games
');
$('item', xml).each(function(id){
if(id==(curr_page_games*3) || id==(curr_page_games*3)+1 || id==(curr_page_games*3)+2){
$("#main").append(
''+
'
'+
'
Release Date: '+$(this).find('pubDate').text()+'
'+
'
'+
'
'+
'
'+$(this).find('description').text()+'
'+
'
'+
//'
'+
//'
'+
'
'
);
}else{
}
});
},
complete: function(){
$("#main").append('');
//alert("tot_elem: "+tot_elem+" , curr_page: "+curr_page+" , num_page: "+num_page);
}
});
}
}
function loadAboutUs() {
$.ajax({
dataType: "text/xml",
url: feed_team,
type:"GET",
success: function(xml){
$('item', xml).each(function(i){
$("#main").append(
''+
'
'+$(this).find('title').text()+'
'+
'
'+
'
'+
'
'+$(this).find('description').text()+'
'+
'
'+
'
'
);
})
},
error: function(){
$("#main").append('Sorry, there is a server error, we will repair this problem as soon as possible !
');
},
complete: function(){
//alert("tot_elem: "+tot_elem+" , curr_page: "+curr_page+" , num_page: "+num_page);
loadSponsor();
}
});
}