/*
Site Global JS Functions 
*/

var i, n, f;  
var PHP    = { 
	Global : '/includes/ajax.global.php', 
	Social : '/includes/ajax.social.php'  
}; 

/*
Basic sharing social features 
*/

var SHARE = {
	//
	Mail: function( url, text )
	{
		var u = ( typeof url === 'string' ) ? encodeURIComponent( url ) : encodeURIComponent( top.location.href.toString() ); 
		var t = ( typeof text === 'string' ) ? encodeURIComponent( text ) : encodeURIComponent( document.title ); 
		var w = window.open( 'mailto:CHOOSE?subject='+t+'&body='+u ) || alert( 'Could not open new window or tab.' ); 
	}, 
	// 
	Tweet: function( url, text )
	{
		var u = ( typeof url === 'string' ) ? encodeURIComponent( url ) : encodeURIComponent( top.location.href.toString() ); 
		var t = ( typeof text === 'string' ) ? encodeURIComponent( text ) : encodeURIComponent( document.title ); 
		var p = $utils.PopPos( 700, 420 ); 
		var w = window.open( 'http://twitter.com/share?url='+u+'&text='+t, p.name, p.params ); 
		if( w ){ w.moveTo( p.left, p.top ); }else{ alert( 'Please allow pop-ups for this feature to work.' ); } 
	}, 
	//
	Fbook: function( url, text )
	{
		var u = ( typeof url === 'string' ) ? encodeURIComponent( url ) : encodeURIComponent( top.location.href.toString() ); 
		var t = ( typeof text === 'string' ) ? encodeURIComponent( text ) : encodeURIComponent( document.title ); 
		var p = $utils.PopPos( 700, 420 ); 
		var w = window.open( 'http://facebook.com/sharer.php?u='+u+'&t='+t, p.name, p.params ); 
		if( w ){ w.moveTo( p.left, p.top ); }else{ alert( 'Please allow pop-ups for this feature to work.' ); } 
	}, 
	//
	More: function( url, text )
	{
		var u = ( typeof url === 'string' ) ? encodeURIComponent( url ) : encodeURIComponent( top.location.href.toString() ); 
		var t = ( typeof text === 'string' ) ? encodeURIComponent( text ) : encodeURIComponent( document.title ); 
		var p = $utils.PopPos( 520, 700, true ); 
		var w = window.open( 'http://addthis.com/bookmark.php?url='+u+'&title='+t, p.name, p.params ); 
		if( w ){ w.moveTo( p.left, p.top ); }else{ alert( 'Please allow pop-ups for this feature to work.' ); } 
	}
}; 

/*
On DOM-Ready Handler 
*/

$(function() 
{
	// mouseover image fader 
	$( '.imgfx' ).hover( function(){$( this ).fadeTo(300,0.60);}, function(){$( this ).fadeTo(300,1);} ); 
	// setup input objects, focus, autosize, .. 
	$( 'input, textarea' ).setupforms(); 
	// setup data tables
	$( '.dbtb' ).attr( { 'cellpadding':'0', 'cellspacing':'0', 'border':'0', 'width':'100%' } ); 
	// fade out and disable features 
	$( '.disabled' ).css( { opacity:0.30 } ).bind( 'click', function(){ return false; } );  
	// setup tooltips
	$( '.tip' ).tooltip(); 
	// slimbox for images 
	$( 'a[rel^="slimbox"]' ).slimbox( {}, null ); 
}); 


