// JavaScript Document
var jQ = jQuery.noConflict();
jQ(document).ready(function()
{
	// Profile Page, narrow width
	if 	(window.location.href.indexOf("/user/") != -1)   {
		jQ("#ipbwrapper").css({'width':'980px'});
	}
	// Stex search results, narrow width
		if (window.location.href.indexOf("module=search") != -1)   {
		jQ("#ipbwrapper").css({'width':'980px'});
	}
	// Journal Listing page, table format
		//if (window.location.href.indexOf("/forum/journals/page__type__all") != -1)   {
		//jQ("#ipbwrapper").css({'width':'980px'});
	//}	

	// CJ tab in user profile page
	jQ("#tab_link_blog\\:blog > a").html("City Journal");	
	// CJ menu in user profile dropdown
	jQ("#user_blog > a").html("My City Journals");
	
	// CJ main columns equal heights
	//jQ("div.with_right > div#main_column, div.cblock").equalHeights();
	
	// Status Update character counter
	jQ("#statusUpdate").charCount();
	jQ(".counter").html("140");

	// Live Chat Alerts
	jQ(".chat-no").click(function(){
		alert("You have been banned from the Live Chat.");
		return false;
	});	
	jQ(".chat-login").click(function(){
		alert("You must be logged in to use the Live Chat.");
		return false;
	});		
	jQ(".up_vote_button").click(function(){
		var id = this.id.split("_")[2];
		var currentVotes = parseInt(jQ('#rating_hits_'+id).html());
		var $this = jQ(this);
		setTimeout(function(){
			$this .fadeOut(400);			
			jQ('#rating_hits_'+id).html(currentVotes + 1);
		},1500);
	});
	
	//Home page content slider
	jQ('#features') 
		.cycle({ 
		    fx:     'fade', 
			speed:   900, 
			timeout: 6000, 
			pause:   1 ,
			next:   '#fnext', 
		    prev:   '#fprev' 
	});
	
	// Sidebar bigbox fade cycle
    jQ('div#sidebigbox').cycle({
		fx: 'fade' ,
		speed:   1500, 
		timeout: 4000 
	});
	
})

/*
jQ(window).load(function()
{	
	jQ("div.cblock").height(jQ("div.with_right > div#main_column").height());

})
*/



// Live chat popup
function popup(url) 
{
 var width  = 750;
 var height = 520;
 var left   = (screen.width  - width)/2;
 var top    = (screen.height - height)/2;
 var params = 'width='+width+', height='+height;
 params += ', top='+top+', left='+left;
 params += ', directories=no';
 params += ', location=no';
 params += ', menubar=no';
 params += ', resizable=yes';
 params += ', scrollbars=no';
 params += ', status=no';
 params += ', toolbar=no';
 newwin=window.open(url,'livechat', params);
 if (window.focus) {newwin.focus()}
 return false;
}

