<!-- Author: Brian Mackenzie -->
<!-- Scripts for Sports Coach -->
function GetCookie (name) 
{  
 var arg = name + "=";  
 var alen = arg.length;  
 var clen = document.cookie.length;  
 var i = 0;  
 while (i < clen) 
 {    
  var j = i + alen;    
  if (document.cookie.substring(i, j) == arg)      
  return getCookieVal (j);    
  i = document.cookie.indexOf(" ", i) + 1;    
  if (i == 0) break;   
 }  
 return null;
}

function SetCookie (name, value, expires) 
{  
 var argv = SetCookie.arguments;  
 var argc = SetCookie.arguments.length;  
 var expires = (argc > 2) ? argv[2] : null;  
 var path = (argc > 3) ? argv[3] : null;  
 var domain = (argc > 4) ? argv[4] : null;  
 var secure = (argc > 5) ? argv[5] : false;  
 document.cookie = name + "=" + escape (value) + 
 ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
 ((path == null) ? "" : ("; path=" + path)) +  
 ((domain == null) ? "" : ("; domain=" + domain)) +    
 ((secure == true) ? "; secure" : "");
}

function getCookieVal(offset) 
{
 var endstr = document.cookie.indexOf (";", offset);
 if (endstr == -1)
 endstr = document.cookie.length;
 return unescape(document.cookie.substring(offset, endstr));
}

function checkCount(name) 
{
 <!-- Code for the floater -->
 var sname ='pup';
 var count = GetCookie(sname);
 var floater = document.getElementById("floater");
 if (count == null )
  {
   count=1;
   SetCookie(sname, count, null, "/");
  }
 if (count < 7)
  {
  if (count == 2 || count == 6)
   {
    floater.style.display = "block";
   }
  count++;
  SetCookie(sname, count, null, "/");
  }
}

function closeban()
{
 <!-- Code for the floater -->
 var floater = document.getElementById("floater");
 floater.style.display = "none";
}

function floaterpage()
{
<!-- Code for floater for all pages except home page -->
 document.write('<DIV ID="floater" style="display:none"> <DIV ID="floaterTop"><a href="javascript:closeban()">Close this window</a></DIV> <DIV ID="floaterText"> <P style="font: bold 20px Verdana, Arial, sans-serif; margin: 10px, 10px 0 10px;">Free Downloads!  Discover the Secrets to Training for Speed, Power & Strength</p> <p style="font: bold 18px Verdana, Arial, sans-serif; margin: 10px, 10px 0 10px;">Start reading now and we will also send you a <br />Free weekly Sports Training ezine</p>  <p style="font: bold 12px Verdana, Arial, sans-serif; margin: 10px, 10px 0 10px;">For Free Downloads and Weekly Expert Advice - Enter email address:</p> <form action="http://www.pponline.co.uk/miff_external" method="post"> <input type="text" name="email" size="25" maxlength="50"> <input type="hidden" name="source" value="SCphpSCMcore"> <input type="hidden" name="accName" value="sports-performance"> <input type="hidden" name="welcomepage" value="http://www.pponline.co.uk/prewp/freedownload/scmiffwelcome.html"> <input name="unsubscribe" type="submit" title="Submit" value="Submit"> </FORM> <p>We will never give or sell your details to a 3rd party<br /> <a href="http://www.sports-coach.net/scpriv.html">Privacy Policy</a></p> <p><a href="javascript:closeban()">Close this window</a></p> </DIV> </DIV>');
}

function miffboxt(dir)
{
  <!-- Peak Performance Free Reports ad top of each page-->
document.write('<table width="250" align="center" border="0" height="120" background="http://www.brianmac.co.uk/pictures/mifftopblue.jpg"> <td align="center" ><p> <font style="font-family: Verdana; font-size: 10pt; color: black">Get 4 </font> <font style="color:red"> FREE </font> <font style="color:black">Reports to boost<br />your Speed, Strength and Fitness<br />Submit your email address below<br /></font><form action="http://www.pponline.co.uk/miff_external" method="post"><input type="text" name="email" size="20" maxlength="45" style="font-size: 8pt"><input type="hidden" name="source" value="SCylpSCMground"><input type="hidden" name="accName" value="sports-performance"><input type="hidden" name="welcomepage" value="http://www.pponline.co.uk/prewp/freedownload/scmiffwelcome.html"><input name="unsubscribe" type="submit" title="Submit" value="Submit" style="font-size: 8pt"><font style="font-size: 8pt"></font></form></p></td></table>'); 
}

function miffbox(dir)
{
  <!-- Peak Performance Free Reports ad bottom of each page-->
document.write('<h3>Get your FREE Reports from "Peak Performance"</h3><table  align="center" border="0"  width="530" height="130" background="http://www.brianmac.co.uk/pictures/miffbottomblue.jpg"><td align="center"><form action="http://www.pponline.co.uk/miff_external" method="post"><p><font style="font-family: Verdana; font-size: 11pt; color: black">Get 4 </font><font style="color:red"> FREE </font><font style="color:black"> Reports To Boost Your Speed, Strength & Fitness<br /><br />Register FREE today for breakthrough tips to enhance your performance<br />Enter your email address below to get your reports (each worth $24.99)</font><br /><input type="text" name="email" size="40" maxlength="45" style="font-size: 11pt"><input type="hidden" name="source" value="SCylpSCMground"><input type="hidden" name="accName" value="sports-performance"><input type="hidden" name="welcomepage" value="http://www.pponline.co.uk/prewp/freedownload/scmiffwelcome.html"><input name="unsubscribe" type="submit" title="Submit" value="Submit" style="font-size: 10pt"></p></form></td></table><p>&nbsp;</p>');
document.write('<table width="100%" border="0" cellspacing="2" cellpadding="2"> <tr>'); 
  <!-- share this with friends ad -->
document.write('<td align="left"><script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script><script type="text/javascript">stLight.options({publisher:"01f3d0e9-cba0-4bad-ae1c-d1fbe4d29e6a"});</script>');
document.write('<h3>Share this page with Friends</h3><span class="st_twitter_large" displayText="Tweet"></span><span class="st_facebook_large" displayText="Facebook"></span><span class="st_ybuzz_large" displayText="Yahoo! Buzz"></span><span class="st_gbuzz_large" displayText="Google Buzz"></span><span class="st_email_large" displayText="Email"></span><span class="st_sharethis_large" displayText="ShareThis"></span></td>');
  <!-- Google Profile Button -->
document.write('<td align="left"><a rel="author" href="https://profiles.google.com/" target="_blank"><img src="https://www.google.com/images/icons/ui/gprofile_button-64.png" width="64" height="64"></a></td>');
  <!-- do not copy ad -->
document.write('<td align="center"><A HREF="http://www.copyscape.com/web-copyright-protection/" target="_blank"><IMG SRC=" http://www.brianmac.co.uk/pictures/copy.jpg " ALT="Protected by Copyscape Website Copyright Protection" TITLE="Protected by Copyscape Plagiarism Checker - Do not copy content from this page." width="120" height="60" border="0"></A></td></tr></table>');
}

function adsenset(t)
{
<!-- AdSense top of the page -->
google_ad_client = "pub-6580312449935063";
google_ad_slot = "5029917193";
google_ad_width = 468;
google_ad_height = 60;
 document.write('<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>');
}

function adsensem(m)
{
<!-- AdSense middle of the page -->
google_ad_client = "pub-6580312449935063";
google_ad_slot = "7768333893";
google_ad_width = 468;
google_ad_height = 60;
 document.write('<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>');
}

function adsenseb(b)
{
<!-- AdSense bottom of the page -->
 document.write('<h3>Additional Information</h3>');
google_ad_client = "pub-6580312449935063";
google_ad_slot = "6059399553";
google_ad_width = 336;
google_ad_height = 280;
 document.write('<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>');
}

function topadverts(dir) 
{
 <!-- 2 book images top of the page -->
bm="http://www.brianmac.co.uk/pictures/adverts/";
pp="http://www.pponline.co.uk/";
document.write('<a href="'+pp+'gold-membership-from-brian-mac" target="_blank"><img src="'+bm+'pplogot.jpg" width="86" height="120" border="0"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
document.write('<a href="http://www.pponline.co.uk/prewp/solus/science-libraryAFF.html" target="_blank"><img src="'+bm+'pplibraryt.jpg" width="85" height="120" border="0"></a>');
}

function advertise(dir,num)  
{
  <!-- ad images at the side of each page -->
var img = [,"http://sports-psychology-tips.com/images/86x120.jpg","http://www.brianmac.co.uk/pictures/adverts/siblogot.jpg","http://www.brianmac.co.uk/pictures/adverts/pumpupt.jpg","http://www.brianmac.co.uk/pictures/adverts/pplogot.jpg","http://www.brianmac.co.uk/pictures/adverts/bbn.jpg","http://www.brianmac.co.uk/pictures/adverts/pplibraryt.jpg","pp101t.jpg","ppyoungathletest.jpg","ppct.jpg","ppspeedt.jpg","ppmar4t.jpg","ppendurancet.jpg","ppbackpaint.jpg","ppbuttockst.jpg","ppcoret.jpg","ppstrengtht.jpg","pphrt.jpg","ppfitnesst.jpg","ppo40t.jpg","ppcyclet.jpg"];
  <!-- links for ad images at the side of each page -->
var add = [,"http://www.on2url.com/app/adtrack.asp?MerchantID=118071&AdID=492079","http://www.pponline.co.uk/prewp/solus/aff-sportsinjurybulletin-BM.html","http://www.illpumpyouup.com","http://www.pponline.co.uk/gold-membership-from-brian-mac","http://www.bestpricenutrition.com","http://www.pponline.co.uk/prewp/solus/science-libraryAFF.html","books/101-evaluation-tests-for-fitness-training","books/coaching-young-athletes","books/complete-guide-circuit-training","books/training-speed-power-strength","prewp/solus/affiliate/bm-marathonprogramme.html","books/training-for-maximum-endurance","prewp/solus/affiliate/bm-backpain.html","prewp/solus/affiliate/bm-unbeatablebuttocks.html","prewp/solus/affiliate/bm-strongercore.html","prewp/solus/affiliate/bm-strengthtraining.html ","books/heart-rate-training","prewp/solus/affiliate/bm-advancedfitness.html","prewp/solus/affiliate/bm-over40s.html","prewp/solus/affiliate/bm-cyclingtrainingsecrets.html"];

  for (i=1; i<21; i++)
  {
	  if(i<7)
	  {
     document.write('<p>&nbsp;</p><p>&nbsp;</p><p align="center"> <a href="'+add[i]+'" target="_blank"> <img src='+img[i]+' width=85 height=121 border="0"></a><p>&nbsp;</p>');
	  }
	  else
	  {
     document.write('<p>&nbsp;</p><p>&nbsp;</p><p align="center"> <a href="http://www.pponline.co.uk/'+add[i]+'" target="_blank"> <img src="http://www.brianmac.co.uk/pictures/adverts/'+img[i]+'" width=85 height=120 border="0"></a><p>&nbsp;</p>');
	  }
  }
}

function schelp(dir,page)
{
document.write('<p>&nbsp;</p><h3>Need more help?</h3> <p>If you are unable to find the information you are looking for then please <a href="mailto:brian@brianmac.co.uk?subject=Advice required on ' + page + ' "> select this link to email me your query</a> or email me at brian@brianmac.co.uk</p>');
document.write('<p>&nbsp;</p><h3>Tell me what you think of the Sports Coach Web Site</h3><p>I would value your feedback on the Sports Coach Web Site as it will help me improve its content and layout. <a href="http://www.brianmac.co.uk/visitorfb.htm">Please select this link to provide your feedback</a>.</p><p>&nbsp;</p>');
}

function footer(mdate)
{
 <!-- Display a footer at the bottom of the page -->
 <!-- debug code - document.write('Date passed - '+mdate+''); -->
 if (isNaN(parseInt(mdate.substr(0,1)))) 
 {
	 <!-- Opera date format - Thu, 11 Aug 2011 13:32:17 GMT -->
	 ndate=mdate.substr(5,11);
 }
 else
 {
  <!-- Chrome, Fox, Explorer date format - 08/11/2011 13:41:46 -->
  var m=[,"January","February","March","April","May","June","July","August","September","October","November","December"];
  d=parseInt(mdate.substr(3,2),10);
  t="th";
  if(d==2 || d==22) t="nd";
  if(d==1 || d==21 || d==31) t="st";
  if(d==3 || d==23) t="rd";
  ndate=d+t+" "+m[parseInt(mdate.substr(0,2),10)]+" "+mdate.substr(6,4);
 }
 <!-- get the current year-->
 date=new Date();
 year=date.getFullYear();
 document.write('<HR> <table width="100%" cellpadding="1" cellspacing="5"><tr>');
 document.write('<td width="9%" align="center" BGcolor="#66CCFF"><a href="#top"> <SPAN style="font-family:arial;font-size:8pt" title="Return to the top of this page">Top of Page</SPAN></a></td>'); 
 document.write('<td width="9%" align="center" BGcolor="#66CCFF"><a href="http://www.brianmac.co.uk/"> <SPAN style="font-family:arial;font-size:8pt" title="Go to the Sports Coach Home Page">Home Page</SPAN></a></td>'); 
 document.write('<td width="82%" align="RIGHT"><SPAN style="font-family:arial;font-size:8pt">&copy; 1996-'+year+' BrianMac Sports Coach - http://www.brianmac.co.uk : Page Last Modified - ' + ndate + '</SPAN> </td>'); 
 document.write('</tr></table>');
}

