$(function() {

  $('a.tblank').attr('target','_blank');

  if($('div.home').length)
  {
    //PNG Fixes
    $('.fix,.sec_2,.media,.bottom_cbox,.last_sec .inner').supersleight();
    
    loadVideo('video1-container','WR1ipaE7CMo',1,275,227)
    
    //click here
    $('a[href=#sendtrial]').bind('click.sendtrial', function() {
      $('html,body').animate({scrollTop: $('div.form').offset().top},'slow');
      return false;
    });

    $('a[href=#submit]').bind('click.submitform', function() {
      $('form[title=Smoke Relief Form]').submit();
      return false;
    });
        
  }
  
  if($('div.order').length)
  {
    //PNG Fixes
    $('.fix,.product span,.actnow .arrow').supersleight();
    
    if($('input[name=is_billing_same]:checked').val() == 0) $('div.form div.billing').removeClass('no');
    
    $('input[name=is_billing_same]').change(function() {
      if ($(this).val() == 0)
      {
        $('div.form div.billing').removeClass('no');
      }
      else
      {
        $('div.form div.billing input').val('');
        $('div.form div.billing').addClass('no');
      }
    });
    
  	$('.ccid a').bind('click.ccid', function() {
  		window.open( "ccid.html", "ccid", "status = 1, height = 230, width = 530, resizable = 1" );
  		return false;
  	});
  }
  
	$('a[href=#terms]').bind('click.terms', function() {
		window.open( "terms.html", "terms", "status = 1, height = 800, width = 800, resizable = 1" );
		return false;
	});
  
	$('a[href=#privacy]').bind('click.privacy', function() {
		window.open( "privacy.html", "privacy", "status = 1, scrollbars=1, height = 800, width = 800, resizable = 1" );
		return false;
	});
	
});

function loadVideo(containerID, videoID,autoplay,width,height)
{
  var atts = { id: containerID };
  swfobject.embedSWF("http://www.youtube.com/v/" + videoID + "&enablejsapi=1&playerapiid=ytplayer&fs=1&"+((autoplay)?'autoplay=1':''),
                    containerID, width, height, "8");
}
