/******************************************************************************************
 * - GLOBAL METHODS 
*******************************************************************************************/

/** open popUp */
function pop( id, url ) 
{
		var page;
		var name;
		var w;
		var h;
		
		switch ( id ) 
		{
			case "share":
				page 	= url;
				name 	= id;
				w 		= 640;
				h 		= 390;
				break;
				
		}
		
		var winl = ( screen.width-w )/2;
		var wint = ( screen.height-h )/2;
		if ( winl < 0 ) winl = 0;
		if ( wint < 0 ) wint = 0;
		var settings = 'height=' + h + ',';
		settings += 'width=' + w + ',';
		settings += 'top=' + wint + ',';
		settings += 'left=' + winl + ',';
		settings += 'location=no,';
		settings += 'status=no,';
		settings += 'scrollbars=0,';
		settings += 'titlebar=no';
		
		var win;// = window.open( page + "?referer=" + encodeURI(window.location.href.split(/^(http:\/\/[^\/]+)((?:\/[^\/]+)+(?=\/))?\/?(?:[^\/]+)?$/i)[1]) ,name, settings );
		
		if( id=="share" )
		{
			win = window.open( page ,name, settings );
		}
		else
		{
			win = window.open( page + "?referer=" + encodeURI(window.location.href.split(/^(http:\/\/[^\/]+)((?:\/[^\/]+)+(?=\/))?\/?(?:[^\/]+)?$/i)[1]) ,name, settings );
		}
			
		
		if( window.focus )
		{
			win.focus();
		}
}

/** DEV */
function devLog( message )
{
//	alert( message );
}

/** tracking */
function track( tag ){
	pageTracker._trackPageview( tag );
}

/** window scrolling **/
function scrollTop()
{
	setTimeout( 
			function()
			{
				$( 'html:not(:animated),body:not(:animated)' ).animate( { scrollTop:0 }, 800 );
			}
		, 500 )
}

function scrollBotton()
{
	setTimeout( 
			function()
			{			
				var html_h = $( 'html' )[ 0 ].scrollHeight;
	
				$( 'html:not(:animated),body:not(:animated)' ).animate( { scrollTop: (html_h-windowClientHeight ) }, 800 );
			}
	    , 500 )
}

/** FACEBOOK LIKE BUTTON */
function showLikeButton( url )
{
	$( "#fb_like_modal" ).html( "" );
	$( '<iframe src="http://www.facebook.com/plugins/like.php?href=' + url + '&amp;layout=button_count&amp;show_faces=false&amp;width=170&amp;action=like&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="margin: 0 0 0 628px; border:none; overflow:hidden; width:170px; height:21px;float:left;" allowtransparency="true"></iframe>' ).appendTo( '#fb_like_modal' );
	$( "#fb_like_modal" ).slideDown( 'slow' );
}

function hideLikeButton()
{
	$( "#fb_like_modal" ).slideUp( 'slow' );
}

function determineBrowser()
{
    // do whatever browser checks you prefer here, then return
    // a value (a string would probably work best) that will indicate
    // to your flash what browser it is

    // I'm just gonna copy and paste an extremely
    // simple one for example purposes

    if(navigator.appName == "Netscape")
    {
        return "Netscape";
    }
    if(navigator.appName == "Microsoft Internet Explorer")
    {
        return "Internet Explorer";
    }

    return "Not IE or Netscape";
}
