
var HOST = "http://www.gossipbingo.co.uk/";

/*********** Mirror.co.uk News widget **************************/
$(document).ready(function(){
 news.UKMirror('#GossipNewsUpdates');
});
 var news = {
    
	UKMirror:function(element){
	 $.ajax({
	  type:"GET",
	  url:"http://www.gossipbingo.co.uk/proxy.php?url=http://p.yimg.com/il/rss/entertainment.xml",
	  cache:"false",
	  beforeSend:function(){
	   //$('#GossipNewsUpdates').css({"text-align":"center"});
	   $(element).html('<img src="http://www.gossipbingo.co.uk/images/ajax-thumb-loader.gif" /><br/>Loading UK Gossip...');
	   },
	  dataType:"xml",
	  success:function(xml){
		  var i=0;
		  var done=false;
		 $(element).empty();
		
		 $(xml).find('item').each(function(){
	       
		   var title = $(this).find('title').text();
		   var text = $(this).find('description').text();
		   
		   //if($.browser=='msie' || $.browser=='firefox'){
		   var image = $(this).find("media\\:\\content").attr("url");
			//}
		   $(element).append('<div class="thumb"><a href="cosmopolitan.html" rel="'+ title +'"><img src="'+image+'" width="55px" height="55px" /></a></div>');
		   $('.thumb').fadeIn(1500);
		   //Shows title information like tooltip
		   $('.thumb a').hover(
          function(){
		  if(!done){	  
	      
	      $(this).after('<div id="ToolTipWrap"><div class="NewsToolTip"><b style="color:#dd34ff;font-size:11px;">Gossip Updates:</b><br/><img align="left" src="'+image+'" width="75px" height="75px"/>'+text.substr(0,80)+'...'+'</div></div>');
		  $(this).fadeTo(300,0.5);
		  $('#ToolTipWrap').show();
		  $('#ToolTipWrap').animate({top:"-=10px"},"slow");
		  done=true;
		  }
	       },
	      function(){
	       $('#ToolTipWrap').remove();
		   $(this).fadeTo(100,1);
		   done=false;
	      }
	      );//close tooltip
		   i++;
		   if(i==5)return false;
		 }); 
	   },
	   error:function(){
	   $(element).html('UK Gossip Not avaliable,try later');
	   }
	 });
	},
 }
/******************** Mirror.co.uk news end ***************************/

/****************** Bottom toolbar widget ******************************/
$(document).ready(function(){
  var toolbox = new ToolBoxObject('#ToolBox_Main');
  toolbox.init();
  
});


function ToolBoxObject(element){

this.element = element;
this.complete = false;

 this.init = function(){
 this.createDOM();
 this.addToFavorites();
 this.toolTip();
 this.fadeInOutFB();
 this.slideUp();
 this.PopUpEval();
 
}//end func

this.createDOM = function(){
 if(!this.complete){
 $('body').append('<div id="ToolBox_Main"></div>');
 $('#ToolBox_Main').append('<div id="ToolBox_Inner"></div>');
 $('#ToolBox_Inner').append('<a id="FB_share" rel="Share Us On Facebook" name="fb_share" type="button" share_url="http://www.gossipbingo.co.uk">Share Gossip Bingo</a>');
 this.appendLink("Latest Bingo Jackpots","FreeBingoRooms","Live Bingo Rooms");
 this.appendLink("Free Bingo Bonuses","FreeBingoBonuses","Latest Bingo Bonuses");
 this.appendLink("UK Gossip","GossipNews","UK Gossip - Latest News");
 this.appendLink("<img src='images/toolbox/favorites.png'/>","Bookmark","Bookmark This Page");
 this.scroller('#ToolBox_Inner');
 }
}//end func

this.slideUp = function(){
 $(this.element).animate({bottom:"+=30"},1200);
}//end func

this.fadeInOutFB = function(){
$('#FB_share').effect('pulsate',{},1500);
}//end func

this.appendLink = function(anchorText,linkID,tipText){
	$('#ToolBox_Inner').append('<a id="'+linkID+'" rel="'+tipText+'" href="#">'+anchorText+'</a> ');
}//end func

this.addToFavorites =  function() {
 $('#Bookmark').click(function(){	
 title = document.title; 
 url = window.location.href;
 if (window.sidebar) { // Mozilla Firefox Bookmark
      window.sidebar.addPanel(title, url,"");
 } else if( window.external ) { // IE Favorite
     window.external.AddFavorite( url, title); }
 else if(window.opera && window.print) { // Opera Hotlist
       return true; }
 });//close bookmark click
}//end func

this.toolTip = function toolTip(){
  
  $('#ToolBox_Inner a').hover(function(e){
	var mouseX = e.pageX;
	var mouseY = e.pageY;
   $(this).prepend('<div class="toolTipWrap"><div class="toolTip"></div></div>');
   var tbody = $(this).attr('rel');
   $('.toolTip').html(tbody);
   $('.toolTipWrap').css({"left":"-65px"});	
   $(this).css({"color":"#fff8ce"});
   if($.browser.mozilla){ 
   $('.toolTipWrap').fadeIn();
   }
   else{	   
   $('.toolTipWrap').show();
   }
  },
  function(){
   $(this).css({"color":"#ffffff"});  
   $('.toolTipWrap').remove();
  }
  );//close hover
 
}//end func


 this.PopUpEval = function(){
	 
  var done = false;
  var width = 600;
  var height = 600;
  var left = (screen.width - width)/2;
  var top = (screen.height - height)/2;
 
  $('#FreeBingoRooms').click(function(){
   window.location = "http://www.gossipbingo.co.uk/guaranteed-jackpots.html";
  });//close click
  
  $('#FreeBingoBonuses').click(function(){
   var FreeBingoBonuses = window.open("frags/freeBingoBonuses.php",
   "popupWindow",
   "menubar=0,resizable=0,width=650,height=650,status=0,scrollbars=0,top="+top+",left="+left+",location=0")

  });//close click
  
  $('#GossipNews').click(function(){
   window.location = "http://www.gossipbingo.co.uk/cosmopolitan.html";
  });//close click

 }//close func
 
 this.scroller = function(appendTo){
  var i=0;
 $(appendTo).append('<marquee id="scroller" direction="left" scrollamount="1"  behavior="up" width="175" height="30"></marquee>');
 $.ajax({
 type:"GET",
 url:"proxy.php?url=http://rss.feedsportal.com/c/756/f/10816/index.rss",
 dataType:"xml",
 success:function(xml){
  $("#scroller").empty();
  $(xml).find('item').each(function(){
   var title = $(this).find('title').text();
   $("#scroller").append('<a style="padding-right:5px;padding-left:0px;padding-top:0px;padding-bottom:0px;color:#000000;font-size:11px;border:none;" href="http://www.gossipbingo.co.uk/cosmopolitan.html">&raquo;'+title+'</a>');
  });
 },
 error:function(){
 $("#scroller").html('Cosmo news not avaliable');
 }
 });

 $('#scroller').hover(
 function(){
 $(this).attr({scrollamount:"0"});
 },
 function(){
 $(this).attr({scrollamount:"1"});
 }
);
 }//close func

}//Close Object
/******************* Bottom toolbar end *****************************/