jQuery.easing.def = "easeOutExpo";
var bar_width = 350;
var min_bar_width = 10;
var t = '';
var kotjeopen ='1';


$(document).ready(function(){
     // need to dynamically write the iframe, prevent the browser from caching and regenerating the process upon revisiting this page
          rand = Math.floor(Math.random()*9999+1);
          $('#progress_iframe').html( '<iframe src="blank.php?rand=' + rand + '" name="progress_' + rand + '" id="progress" marginwidth="0" marginheight="0" frameborder="0" ></iframe>' );
          $('#scraper_form').attr( 'target', 'progress_' + rand );
     $('#email_link').bind( 'click', mail_click );
     $('#questions').bind( 'click', q_slide );
     $('#contact').bind( 'click', q_slide2 );
     $('#request').bind( 'click', q_slide3 );
     $('#account').bind( 'blur', check_account );
} );


function check_account() {
     var brokenstring = $('#account').val().split('/');
     if( brokenstring.length > 1 )
          $('#account').val( brokenstring[4] );
}


function mail_click() {
     var link = 'mailto:' + $('#email_link').html();
     link += '?subject=FCKTV!'
     if( $('#account').val() != '' )
          link += '&body=account:%20' + $('#account').val() + "%0D%0D%0D";
     document.location = link;
     return false;
} // end function mail_send()




function error_show( msg ) {
     $('#error').html( msg );
     $('#activity').slideUp( 
          1000, 
          function() {
               $('#account').val();
               $('#account')[0].focus();
               $('#error').slideDown( 1000 );
               $('#btn_submit').css( 'opacity', 1 );
               $('#scraper_form input').attr( 'disabled', false );
               $('#scraper_form input.text').css( 'borderColor', '#000000' );
               $('#scraper_form').submit( function() {return true; } );
          } 
     );
     // enable form
} // end function error_show()


function q_slide() {
     $('#questions').unbind( 'click', q_slide );
     if( $('#col_q').css( 'left' ) != '680px' ) { // slide left
          pos_x = '680px';
          label = '     Close';
          delay = 40;
		  
     }

     else { // slide right
          pos_x = '2000px';
          label = 'About';
          delay = 110;
     }
	 

     setTimeout( function() { $('#questions').html( label ); }, delay );
     $("#col_q").animate( 
          { left: pos_x }, 
          1200, 
          'swing', 
          function() { $('#questions').bind( 'click', q_slide ); }
     );
} // end function q_slide()


function q_slide2() {
     $('#contact').unbind( 'click', q_slide2 );

     if( $('#col_q_contact').css( 'left' ) != '680px' ) { // slide left
          pos_x = '680px';
          label = '     Close';
          delay = 40;

     }

     else { // slide right
          pos_x = '2000px';
          label = 'Shout';
          delay = 110;
     }

     setTimeout( function() { $('#contact').html( label ); }, delay );
     $("#col_q_contact").animate( 
          { left: pos_x }, 
          1200, 
          'swing', 
          function() { $('#contact').bind( 'click', q_slide2 ); }
     );
} // end function q_slide()


function q_slide3() {
     $('#request').unbind( 'click', q_slide3 );
     if( $('#col_q_request').css( 'left' ) != '680px' ) { // slide left
          pos_x = '680px';
          label = '      Close';
          delay = 40;
		  	 	 this.style.textalign="right";


     }
     else { // slide right
          pos_x = '2000px';
          label = 'Request';
          delay = 110;
     }
     setTimeout( function() { $('#request').html( label ); }, delay );
     $("#col_q_request").animate( 
          { left: pos_x }, 
          1200, 
          'swing', 
          function() { $('#request').bind( 'click', q_slide3 ); }
     );
} // end function q_slide()

