$(function () {
    news.init();
});

var news = {

    change: 0,
    animationDiv: 'news_container',
    objDetail: new Object(),
    
    init: function() {
        if ($.browser.msie)
        {
            $('.news_item').mouseover(function(){
                $(this).css("background-color","#E6EAF0");
            }).mouseout(function(){
                $(this).css("background-color","#fff");
            });
        }
        news.load_detail();
    },

    detail: function(i) {
        news.set_detail(i);
        news.animationDiv = 'news_container';
        news.change = -587;
        $("#"+news.animationDiv).animate({"left": "+="+news.change+"px"});
    },

    list: function() {
        news.animationDiv = 'news_container';
        news.change = 587;
        $("#"+news.animationDiv).animate({"left": "+="+news.change+"px"});
    },
    
    next: function() {
        news.animationDiv = 'news_list_container';
        news.change = -562;
        $("#"+news.animationDiv).animate({"top": "+="+news.change+"px"});
    },
    
    prev: function() {
        news.animationDiv = 'news_list_container';
        news.change = 562;
        $("#"+news.animationDiv).animate({"top": "+="+news.change+"px"});
    },
    
    load_detail: function() {
        $.ajax({
     //       type: "GET",
     //       url: "news.php",
            data: "action=detail",
            success: function(sJSON){
                news.objDetail = eval( "("+ sJSON +")" );
                
                for ( keyVar in news.objDetail ) 
                {
                    $.preloadImages(news.objDetail[keyVar].image_2);
                }
            }
        });
    },
    
    set_detail: function(i) {
		
       if(i == 18)
	   {
		   var sHTML = '<img src=images/thumus-client-big-hardum.jpg alt=""/>'+
		   '<h2>Hardum</h2>'+
		   '<p>Explore a Treasure trove of Freebies, Play with your pets and get rewards, Bag the job and the right salary you always deserved, Make a killer deal for you and the buyer, Display your talents and get an audience, Read News in the way you want.</p>' +
		   
		   '<ul class="pagination">'+
        '<li class="back"><a href="javascript: void(0)" onclick="news.list()" class="white">Back</a></li>'+
        '</ul>';
	   }
	   else if(i == 19)
	   {
		     var sHTML = '<img src=images/thumus-client-big-granitedepot.jpg alt=""/>'+
		   '<h2>Granite Depot Online</h2>'+
		   '<p>We have 33 years of combined experience in stone trade, construction, and customer service. We are also the direct importers of stones from Brazil, China, India, and Europe. You can trust our experienced staff to provide you with top quality service. We handle the details, so you can focus on enjoying your beautiful new countertop. Granite Depot can give you the best price for a turnkey project, meaning removing the old ones and installing new ones including backsplash.We do have wide selection of colors, shades, and finishes in granite, marble, and travertine. We assure you that we can offer best prices that can satisfy every budget, design and lifestyle.</p>' +
		   '<p>We can even simulate "before and after" view of your kitchen using different stone colors. We have developed an in-house sophisticated computer program to provide this service for you.Granite Depot is committed to your total satisfaction. How can you go wrong? </p>'+

		   '<ul class="pagination">'+
        '<li class="back"><a href="javascript: void(0)" onclick="news.list()" class="white">Back</a></li>'+
        '</ul>';
	   }
	    else if(i == 20)
	   {
		     var sHTML = '<img src=images/thumus-client-big-expresswithmusic.jpg alt=""/>'+
		   '<h2>Express With Music</h2>'+
		   '<p>Looking for something unique for your loved one? Then why give them the same old gift boxed up in a different package? Move away from the old clichéd stuff and make your special person feel special with a gift made exclusively for them. With our songs express WHAT you want to in the way YOU want to. Give your dear ones the surprise of their lifetime.</p>'+
		    '<p>Let our music and lyrics enchant you and make your loved one feel the exquisite pleasure that comes from being someone special. Pamper them with our exclusive songs. Pour out your hearts desire in a dazzling display of musical notes and words that capture your sentiments and render them into a beautiful melody of love. </p>'+
			 '<p>Wanna say I love You, Happy Birthday Mom, I’m going to miss you buddy, Congrats Dear sister, Can you mend my heart sweetiepie? Say everything that you feel to your loved ones with a beautiful song which has never been heard before.</p>'+
		   '<ul class="pagination">'+
        '<li class="back"><a href="javascript: void(0)" onclick="news.list()" class="white">Back</a></li>'+
        '</ul>';
	   }
	    else if(i == 21)
	   {
		   var sHTML = '<img src=images/thumus-client-big-spacecitysolar.jpg alt=""/>'+
		   '<h2>Space City Solar</h2>'+
		   '<p>The United States and the world need to find new sources of clean energy. Space Solar Power gathers energy from sunlight in space and transmits it wirelessly to Earth. Space solar power can solve our energy and greenhouse gas emissions problems. Not just help, not just take a step in the right direction, but solve. Space solar power can provide large quantities of energy to each and every person on Earth with very little environmental impact.</p>'+


   '<p>The solar energy available in space is literally billions of times greater than we use today. The lifetime of the sun is an estimated 4-5 billion years, making space solar power a truly long-term energy solution. As Earth receives only one part in 2.3 billion of the Suns output, space solar power is by far the largest potential energy source available, dwarfing all others combined. Solar energy is routinely used on nearly all spacecraft today. This technology on a larger scale, combined with already demonstrated wireless power transmission can supply nearly all the electrical needs of our planet </p>'+
		   '<ul class="pagination">'+
        '<li class="back"><a href="javascript: void(0)" onclick="news.list()" class="white">Back</a></li>'+
        '</ul>';
	   }
	    else if(i == 22)
	   {
		   var sHTML = '<img src=images/thumus-client-big-aclickwork.jpg alt=""/>'+
		   '<h2>A click works</h2>'+
		   '<p>A click works is powered by a Content Management System called Pligg. It is a social bookmarking website which aggregates funny and weird news from across the globe. </p>'+
		   '<ul class="pagination">'+
        '<li class="back"><a href="javascript: void(0)" onclick="news.list()" class="white">Back</a></li>'+
        '</ul>';
	   }
	   else if(i == 23)
	   {
		   var sHTML = '<img src=images/thumus-client-big-annarathna.jpg alt=""/>'+
		   '<h2>Annarathna Group of Industries</h2>'+
		   '<p>Annarathna Group of Industries is a reputed manufacturer and exporter of Cardboard Matches, Veneer Matches, Wax Matches, etc.</p>'+

'<p>Annarathna Group of Match Industries incorporated in 1976 with Aruna Match Works at Kovilpatti in Tamil Nadu and expanded its production facilities to Annarathna Match Industries at the same town in Tamil Nadu.</p>'+

'<p>Annarathna is the one of the largest safety matches manufacturer in India and is widely present in the Indian market through various brands of matches like- Deepak and A-1.</p>'+

'<p>We are synonymous with superior quality, safe and consumer friendly goods. Having a wide distribution network, we are holding our dominant brandings in the states of Gujarat, Himachal Pradesh & Uttar Pradesh. We also export our safety matches to various countries around the world. The companys export markets include Yemen, Egypt & Latvia.  </p>'+
		   '<ul class="pagination">'+
        '<li class="back"><a href="javascript: void(0)" onclick="news.list()" class="white">Back</a></li>'+
        '</ul>';
	   }
	   else if(i == 24)
	   {
		   var sHTML = '<img src=images/thumus-client-big-sai.jpg alt=""/>'+
		   '<h2>Sai Photographs</h2>'+
		   '<p>5 years in the field of photography, having worked with senior and illustrious photographers in Chennai, Mumbai and New Delhi.</p>'+

'<p>As a photographer I have worked on various themes including landscape, nature, wildlife, fine art, travel, documentary, movies, architecture and advertising. Feel free to explore the gallery and the testimonial from Thottatharani!</p>'+
		   '<ul class="pagination">'+
        '<li class="back"><a href="javascript: void(0)" onclick="news.list()" class="white">Back</a></li>'+
        '</ul>';
	   }
	   else if(i == 25)
	   {
		   var sHTML = '<img src=images/thumus-client-big-spacecitysolar.jpg alt=""/>'+
		   '<h2>Space City Solar</h2>'+
		   '<p>The United States and the world need to find new sources of clean energy. Space Solar Power gathers energy from sunlight in space and transmits it wirelessly to Earth. Space solar power can solve our energy and greenhouse gas emissions problems. Not just help, not just take a step in the right direction, but solve. Space solar power can provide large quantities of energy to each and every person on Earth with very little environmental impact.</p>'+


   '<p>The solar energy available in space is literally billions of times greater than we use today. The lifetime of the sun is an estimated 4-5 billion years, making space solar power a truly long-term energy solution. As Earth receives only one part in 2.3 billion of the Suns output, space solar power is by far the largest potential energy source available, dwarfing all others combined. Solar energy is routinely used on nearly all spacecraft today. This technology on a larger scale, combined with already demonstrated wireless power transmission can supply nearly all the electrical needs of our planet </p>'+
		   '<ul class="pagination">'+
        '<li class="back"><a href="javascript: void(0)" onclick="news.list()" class="white">Back</a></li>'+
        '</ul>';
	   }
		   
	   /*}
        var sHTML = '<img src="'+ news.objDetail['news'+i].image_2 +'" alt="" />'+
        '<h2>'+ news.objDetail['news'+i].title +'</h2>'+
        '<p>'+ news.objDetail['news'+i].html_text +'</p>'+
        '<ul class="pagination">'+
        '    <li class="back"><a href="javascript: void(0)" onclick="news.list()">Back</a></li>'+
        '</ul>';*/
        
        $('#news_detail').html(sHTML);
        sHTML = null;
    }
};

$.preloadImages = function()
{
    for(var i = 0; i<arguments.length; i++)
    {
        img = new Image();
        img.src = arguments[i];
    }
}
