

// open / close stuff
	$(document).ready(function(){
		// get video-wrap element height
		var videos_wrap_height = $(".videos-wrap").height();
		var screenshots_wrap_height = $(".screenshots-wrap").height();
		// change height to one row
		var videos_wrap_height_closed = "85px";
		var screenshots_wrap_height_closed = "67px";
	   $(".videos-wrap").height(videos_wrap_height_closed);
	   $(".screenshots-wrap").height(screenshots_wrap_height_closed);
	   // if JS enabled, display 'show-all' links
	   $(".show-all").toggle();


		// click to slide open
		$(".show-all .open a").click(function(){

		 var parent = $(this).parent().parent().parent().parent('div').attr('class'); // col-box screenshots or col-box videos
		 if (parent == "col-box screenshots") {section = "screenshots";}
		 if (parent == "col-box videos") {section = "videos";}

				  	$("." + section + "-wrap").animate({height: section=="videos"? videos_wrap_height : screenshots_wrap_height }, "slow")
				  	$("." + section + " .open").fadeOut()
				  	$("." + section + " .close").fadeIn()
				  	return false;

		});

		// click to slide closed
		$(".show-all .close a").click(function(){
	
		 var parent = $(this).parent().parent().parent().parent('div').attr('class'); // col-box screenshots or col-box videos
		 if (parent == "col-box screenshots") {section = "screenshots";}
		 if (parent == "col-box videos") {section = "videos";}

				  	$("." + section + "-wrap").animate({height: section=="videos"? videos_wrap_height_closed : screenshots_wrap_height_closed }, "slow")
				  	$("." + section + " .open").fadeIn()
				  	$("." + section + " .close").fadeOut()
				  	return false;

		});

	});



// star rating
	$(function(){
	 $('.hover-star').rating({
	  focus: function(value, link){
	    // 'this' is the hidden form element holding the current value
	    // 'value' is the value selected
	    // 'element' points to the link element that received the click.
	    var tip = $('#star-hover-text');
	    tip[0].data = tip[0].data || tip.html();
	    tip.html(link.title || 'value: '+value);
	  },
	  blur: function(value, link){
	    var tip = $('#star-hover-text');
	    $('#star-hover-text').html(tip[0].data || '');
	  }
	 });
	});


// reflect
$(document).ready(function() {
	$('img.reflect').reflect({height: 0.2, opacity: 0.4});
})


// toggle sub nav drop down visibility

$(document).ready(function() {
    var hide = false;
	var link;
	$("a.drop-link").hover(function(){
		var link = $(this).attr('class').split(' ').slice(-1); 
    
    	if (hide) clearTimeout(hide);
        $("ul.drop-down").fadeOut("fast"); // fadeout any open menus
        $("ul." + link + "-menu").toggle(); // show menu
    }, function() {
        hide = setTimeout(function() {$("ul.drop-down").fadeOut("fast");}, 200);
    });
    $("ul.drop-down").hover(function(){
        if (hide) clearTimeout(hide);
    }, function() {
        hide = setTimeout(function() {$("ul.drop-down").fadeOut("fast");}, 200);
    });

	// $("li.drop a").hover(function(){
	//         $(this "ul").toggle();
	// 	alert("h");
	//     });
});                                         


// tabs
$(document).ready(function(){
	$("#news-selector > ul").tabs();
	$("#top-articles > ul").tabs({ fx: { opacity: 'toggle' } });
	$("#rhs-videos-tabbed > ul").tabs({ fx: { opacity: 'toggle' } });
	
	// var TABS_COOKIE = 'tog_tabs_cookie';
	// 		$('#news-selector').tabs($.cookie(TABS_COOKIE) || 1, {
	// 		    onClick: function(clicked) {
	// 		        var lastTab = $(clicked).parents('ul').find('li').index(clicked.parentNode) + 1;
	// 		        $.cookie(TABS_COOKIE, lastTab);
	// 		    }
	// 		});


	// $.favicons();
});

// ahah load
$(document).ready(function() {
var date = new Date(); // Get a new date (this will make the url unique)
var timestamp = date*1; // make into a timestamp   
var login_url = "/forum/login_include.php?" + timestamp; // Append date to url (so the browser doesn't cache the call)
//	alert(login_url);
// Avoid loading global.php on vB pages which load it anyway. Basie 2/03/2010 8:12:40 p.m. 
//$("#rhs-login-load").load(login_url, function(){$("label.overlabel").overlabel();});
($("#vbulletin_showthread_css").length > 0)? null : $("#rhs-login-load").load(login_url, function(){$("label.overlabel").overlabel();});
$("body#forum #vb-latest-content-load").load("/includes_js/tog_latest");
$("body#forum #vb-latest-division-load").load("/includes_js/divisions_latest");
$("body#forum #rhs-poll-load").load("/includes_js/poll");
})
$(document).ready(function() {
    $("label.overlabel").overlabel();
});
