 $(function() {
 $('#rotate').tabs({ cache: true }).show().tabs('rotate', 5000); /*{ fx: { slide: 'toggle' }}*/
 $('#listings').tabs({ fx: { opacity: 'toggle', duration: '3000' }, selected: 1} ).show(); /*.tabs('rotate', 2000);*/
 }); 
 function togglethis(what){
 $("#listings .smdets").slideUp("normal");
 $("#_"+what).slideToggle("normal");
 } 
 function dofilter(wht){
 if(wht !=""){
 if($("#LF_"+wht).val()=="S"){ $("#LF_"+wht).val(""); }else{ $("#LF_"+wht).val("S"); }
}
 var Lfilters = ["sport","music","theatre","specials","talk","art","kids","film"];
 for (var i in Lfilters){
 if($("#LF_"+Lfilters[i]).val() == "S"){
 $("#"+Lfilters[i]+"_fil").fadeTo("fast", 1);
 //$("#"+Lfilters[i]+"_fil").removeClass(Lfilters[i] + "_bgcol_o").addClass(Lfilters[i] + "_bgcol");
 $("#listings ."+ Lfilters[i] + "_bcol").show();
 }else{
 $("#"+Lfilters[i]+"_fil").fadeTo("fast", 0.50);
 //$("#"+Lfilters[i]+"_fil").removeClass(Lfilters[i] + "_bgcol").addClass(Lfilters[i] + "_bgcol_o");
 $("#listings ."+ Lfilters[i] + "_bcol").hide();
 }
 }
 wws =0;
 for (var i in Lfilters){
 if($("#LF_"+Lfilters[i]).val() == ""){
 wws++;
 }
 }
 if(wws == 8){
 for (var i in Lfilters){
 $("#"+Lfilters[i]+"_fil").fadeTo("fast", 1);
 //alt = document.getElementById(Lfilters[i]+'_fil'); //alt.className = '' + Lfilters[i] + "_bgcol";
 $("."+ Lfilters[i] + "_bcol").show();
 }
 }
 dsenseHeight();
 } 
function dsenseHeight(){
setTimeout("senseHeight()",100);
} function senseHeight(){
var DATS = ['2010-07-30','2010-07-31','2010-08-01','2010-08-02','2010-08-03','2010-08-04','2010-08-05','2010-08-06','2010-08-07','2010-08-08','2010-08-09','2010-08-10','2010-08-11','2010-08-12','2010-08-13','2010-08-14','2010-08-15','2010-08-16','2010-08-17','2010-08-18','2010-08-19','2010-08-20','2010-08-21','2010-08-22','2010-08-23','2010-08-24','2010-08-25','2010-08-26','2010-08-27','2010-08-28','2010-08-29'];
$('#listings').height();
for (var i in DATS){
if($('#_'+DATS[i]).height()<=30){ $('#_'+DATS[i]+'>.thedate').hide(); }else{
$('#_'+DATS[i]+'>.thedate').show();}
}
if($('#one_szx').height() <= 35){
$('#oneNE').html('<center>Sorry no events like these are on Today,<br/>All in all its a pretty quiet Day</center>');
}else{ $('#oneNE').html('');}
$('#one_cont').scrollTo('0px', 300,{axis:'y'});
$('#two_cont').scrollTo('0px', 300,{axis:'y'});
$('#three_cont').scrollTo('0px', 300,{axis:'y'});
} function addEvent(wht){
 module_diary(wht,1);
 } 
 
function loadleinfo(leid,lenam){
$('#rotate').tabs('rotate', 0); 
$.ajax({
url: '/js/onreturn.php?type='+leid+'&genre='+lenam,
type: 'GET',
dataType: 'html',
timeout: 1000,
error: function(){
 $("#_"+leid+"_cont").html("ERROR LOADING CONTENT");
},
success: function(html){
// $("#_"+leid+"_cont").hide();
// $("#_"+leid+"_cont").addClass("FEATINFO");
// $("#_"+leid+"_cont").html(html);
// $("#_"+leid+"_cont").fadeIn();
}
}); 
} function clearfilters() {
 var Lfilters = ["sport","music","theatre","specials","talk","art","kids","film"];
 for (var i in Lfilters){ $("#LF_"+Lfilters[i]).val(""); }
 } window.onload = clearfilters; $(document).ready(function() {
  $('.infotip').hover(
    function() {
    this.tip = this.title;
    $(this).append(
     '<div class="infotipW">'
          + unescape(this.tip)
      +'</div>'
    );
    this.title = "";
    this.width = $(this).width();
    $(this).find('.infotipW').css({left:this.width +25});
    $('.infotipW').fadeIn(300);
  },

    function() {
      $('.infotipW').fadeOut(100);
      $(this).children().remove();
        this.title = this.tip;
      }
  );

});




  
 $(document).ready(function() {    
   
     //select all the a tag with name equal to modal  
     $('a[name=modal],a[name=imgmodal],a[name=ytube]').click(function(e) {  
         e.preventDefault();  
			opensite($(this).attr("href"), $(this).attr("name"));
});
});


function opensite(hrefd, named){
var id = "extsite";
//alert(hrefd);
		$('#'+id).html('');
if(named=="imgmodal"){
		$('#'+id).html("<iframe id='extcontent' src='/modules/imagefunc/display.php?image="+escape(hrefd)+"' frameborder=0 width='100%' height='95%'></iframe>");
}else{
		$('#'+id).html("<iframe id='extcontent' src='"+hrefd+"' width='100%' frameborder=0 height='95%' class=modaliframe></iframe>");
}
		$('#'+id).show();
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		$(document).scrollTo('0px', 300,{axis:'y'});
		$('#mask').fadeIn();
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
		$("#"+id).css('width', ((winW/100)*95));
		$("#"+id).css('height', (winH));
		//Set the popup window to center
		$("#"+id).css('top',  (winH/2-$('#'+id).height()/2)+20);
		$("#"+id).css('left', winW/2-$('#'+id).width()/2);
		//transition effecT
		$("#extcontrol").show();
		$("#"+id).fadeIn(); 
}

function closeext(){
$("#extcontrol").hide();
$("#extsite").fadeOut().html('');
 $('#mask').fadeOut();
}

function openext(){
locat = $('#extcontent').attr("src");
closeext();
window.open(locat, "_blank");
}

 $(document).ready(function() {    
 $(".olayolay").hover(function() { 
	lid=$(this).attr('id');
	$('#'+lid+'_ol').slideUp()
}, function() {  
	lid=$(this).attr('id');
	$('#'+lid+'_ol').slideDown();
});
$("#a_box_menu").tabs().show().tabs('rotate', 3000);
 
});

function videoWriteIn(divid, key ,wi, hi){
$('#'+divid).html("<object width='"+wi+"' height='"+hi+"'><param name='movie' value='http://www.youtube.com/v/"+key+"'></param><param name='wmode' value='transparent'></param><embed src='http://www.youtube.com/v/"+key+"' type='application/x-shockwave-flash' wmode='transparent' width='"+wi+"' height='"+hi+"'></embed></object>");
}

function F_search(ty){
sqval = $("#s_q"+ty+"_val").val();
if(ty == '1'){
opensite("http://www.google.co.uk/search?q="+sqval, 'modal');
}else if(ty == 2){
opensite("http://en.wikipedia.org/wiki/search-redirect.php?search="+sqval, 'modal');
}else if(ty == 3){
opensite("http://www.bbc.co.uk/cgi-bin/search/results.pl?q="+sqval, 'modal');
}else{

}
}