function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/** this code is for the facebook like button **/

(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

/** end facebook code **/


/**
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

	--------------------------------------------------------------------
	
	Simple banner rotator. Version: 1.4.0
	Download and support: http://www.spyka.net 
	(c) Copyright 2008, 2009 spyka Web Group
	

	For full documentation:  http://www.spyka.net/docs/simple-banner-rotator
	For support:			 http://www.spyka.net/forums


**/

//								EDIT FROM HERE
///////////////////////////////////////////////////////////////////////////////////

/**
		Script settings
**/

var settings = {
	
	'force_size':			0,         		// 	if set to 1 all banners will be resized to the width and height in the next to settings
	'img_width':			468,			//	width to resize all banners to, only takes effect if above is 1
	'img_height':			60, 			// 	height to resize all banners to, only takes effect if above is 1
	
	'refresh_time':			0,			//	the seconds between refreshs of the banners - use 0 to disable, WAS 5000
	'refresh_max':			100,				//	maximum number of refreshs on each page load
	
	'duplicate_banners':	0,				//	keep as 0 to make sure the same banner won't show on the same page. will only take effect
											//  if show_banners(); is used more than once. You must make sure you have enough banners to fill
											//  all the slots else the browser may freeze or give a stack overflow error
	
	'location_prefix': 		'adLocation-',	//	The prefix of the IDs of the <div> which wraps the banners - this div is generated dynamically.
											//  a number will be added on the end of this string. adLocation- was used by default before version 1.4.x
											
	'location_class':		'swb',			//  A class to add to all of the <div>s which wrap the banners, ideal to use for styling banners - use .swb img in your CSS	
	
	'window': 				'_blank',		//	Window to open links in, _self = current, _blank = new. Use _top if in a frame!		
	
	'default_ad_loc':		'default'		//	The default adLocation. This is assigned to any banners not given an adLocation in the below banner list
											//  There is no real reason to need to change this
}


/**
		Banners
**/
// banner list syntax: new banner(website_name, website_url, banner_url, show_until_date, adlocation),  DATE FORMAT: dd/mm/yyyy
// if you're not using adlocations just leave it empty like '' as in the last example here
// to make sure a banner is always rotating, just set the date far into the future, i.e. year 3000

var banners = [
	new banner('Website Sponsor','http://cmajournal.com', '/images/websitesponsor_journal.gif','30/04/3019','websiteSponsor'),
	
	new banner('SeeHearNow','http://www.zazzle.com/lookhearnow?rf=238256010193442025', '/images/lhn_bnr02_160x160.gif','30/04/3019','160a'),
// 	new banner('Kung Fu Panda', 	'http://www.kungfuchampionship.com', '/images/KFPBanner300x300v2.gif', '30/04/3019',	'160a'),
	new banner('Martial Arts 411', 'http://www.ma411magazine.com/', '/images/martial_arts_411_160x160.gif','30/04/3019','160a'),	
	
	new banner('Maxwell Medals', 'http://www.maxmedals.com/', '/images/160x60maxwell.gif','30/04/3019','160_60a_left'),
	new banner('Kung Fu Magazine', 'http://www.kungfumagazine.com/', '/images/160x60kungfumag.gif','30/04/3019','160_60a_left'),
	new banner('Pai Lum', 	'http://www.pailumfiredragontemple.com/links.html', '/images/pailum160.gif', '30/04/3019',	'160_60a_left'),
	new banner('Kung Fu TV', 	'http://www.kungfutelevision.com/', '/images/160x60kungfutv.gif', '30/04/3019',	'160_60a_left'),
	new banner('Kung Fu Culture', 	'http://www.kungfuculture.com/', '/images/160x60kungfuculture.gif', '30/04/3019',	'160_60a_left'),
	
	new banner('WSL','http://worldsandaleague.com', '/images/160x500_wsl.gif','30/04/3019','Wsl'),
	
	new banner('YouTube','http://www.youtube.com/kungfuchampionship', 		'/images/youtube160x100.gif',	'10/04/3019',	'YouTube'),
	new banner('Subscribe', 'http://emarketing.tampasource.com/public/quJJ/1Hj/subscribe', 	'/images/email_alerts.gif',	'30/04/3019','Subscribe'),
	new banner('Twitter','http://twitter.com/icmac', '/images/twitter160x60.png', '10/04/3019',	'Twitter'),
	new banner('Facebook', 'http://www.facebook.com/KungFuChampionship', '/images/facebook160x60.png','30/04/3019','Facebook'),

	new banner('Shaolin Kung Fu', 'http://www.houstonshaolin.com/', '/images/shaolin-kung-fu-academy-160x100.gif','30/04/3019','160b'),
	new banner('Shaolin Wushu', 'http://www.usshaolin.com/', '/images/intl-shaolin-wushu-160x100.gif','30/04/3019','160b'),
	
	new banner('Tiger Claw', 'http://www.tigerclaw.com/', '/images/TC_Button_KFM.gif','30/04/3019','tigerclaw'),
	
	
	
	new banner('Energy Arts', 	'http://www.energyarts.com/offer/internal-martial-arts-secrets#a_aid=kungfu&amp;a_bid=d534c582', '/images/energy_arts_02.gif', '30/04/3019',	'energyArts'),
	new banner('CMA Journal', 	'http://www.cmajournal.com', '/images/cmajournal160x160.gif', '30/04/3019',	'cmaJournal'),
	new banner('WhiteCrane','http://www.whitecranemedia.com','/images/whitecrane160x160.gif','30/04/3019','whiteCrane'),
	new banner('Lily Lau', 	'http://www.laufatmangeagleclaw.com/', '/images/160x300_lilylaueagleclaw3.gif', '30/04/3019',	'lilyLau'),
	new banner('HGC', 	'http://www.hgcscholarshipfoundation.org', '/images/HGC_160x200.gif', '30/04/3019',	'hgcscholarship'),

	
	new banner('Sleeping Tiger', 'http://wushutaichicenter.com/awakening-the-sleeping-tiger/','/images/awakening_book160x300.gif','30/04/3019',	'rightFifth'),



	new banner('WhiteCrane','http://www.whitecranemedia.com','/images/whitecrane160x160.gif','30/04/3019','rightFirst')

]

//         				There is no need to edit below here
///////////////////////////////////////////////////////////////////////////////////
var used=0;var location_counter=0;var refresh_counter=1;var map=new Array();function banner(a,b,c,d,e){this.name=a;this.url=b;this.image=c;this.date=d;this.active=1;this.oid=0;if(e!=''){this.loc=e}else{this.loc=settings.default_ad_loc}}function show_banners(a){location_counter=location_counter+1;if(a!=''&&a!=undefined){map[location_counter]=a}else{map[location_counter]=settings.default_ad_loc}var b='<div id="'+settings.location_prefix+location_counter+'" class="'+settings.location_class+'"></div>';document.write(b);display_banners(location_counter)}function display_banners(a){var b=new Array();if(a==''||!a||a<0){return}var c=banners.length;if((c==used)&&settings.duplicate_banners==0){return}for(i=0;i<(banners.length);i++){banners[i].oid=i;if((banners[i].loc==map[a])&&(banners[i].active==1)){b.push(banners[i])}}var d=Math.floor(Math.random()*b.length);var e=b[d];var f=(settings.force_size==1)?' width="'+settings.img_width+'" height="'+settings.img_height+'"':'';var g='<a href="'+e.url+'" title="'+e.name+'" target="'+settings.window+'"><img border="0" src="'+e.image+'"'+f+' alt="'+e.name+'" /></a>';var h=new Date();var j=e.date;j=j.split('/',3);var k=new Date();k.setFullYear(parseInt(j[2]),parseInt(j[1])-1,parseInt(j[0]));if((h<k)&&e.active==1){var l=document.getElementById(settings.location_prefix+a);if(l==null){alert('spyka Webmaster banner rotator\nError: adLocation doesn\'t exist!')}else{l.innerHTML=g;if(settings.duplicate_banners==0){banners[e.oid].active=0;used++}return}}else{display_banners(a)}return}function refresh_banners(){if((refresh_counter==settings.refresh_max)||settings.refresh_time<1){clearInterval(banner_refresh)}used=0;for(j=0;j<(banners.length);j++){banners[j].active=1}for(j=1;j<(location_counter+1);j++){display_banners(j)}refresh_counter++}var banner_refresh=window.setInterval(refresh_banners,settings.refresh_time);
