/* Load Adverstisements after all of our scripts */
window.addEvent('load', function(){
	/* Universal Ad Loader that Reads 'rel' attribute for ad source */
	/* adsPath = location of AD HTML folder */
	var adsPath = '/misc/ads/'
	
	$$('.advertisement').each(function(element){
		if(element.getProperty('rel')){
			element.Src = adsPath + element.getProperty('rel') + '.html';
			element.Frame = new Element('iframe', {
				src: element.Src,
				width: '100%',
				height: '100%',
				scrolling: 'no',
				frameborder: '0',
				marginwidth: '0',
				marginheight: '0'
			});
			element.innerHTML = '';
			element.Frame.inject(element);		
		}
	});
	/* End Universal Ad Loader */


	/* INSERT SKY SCRAPER ADVERTISEMENT CODE */
	if($('adInsertWideSky')){

		var AdCode = new Element('iframe', {
		    'styles': {
			   'width': '160px',
			   'height': '600px',
			   'overflow': 'hidden'
		    },
		    'name': 'adWideScraper',
		    'src': '/misc/ads/ad-wide-skyscraper-asdaq.html',
		    'frameborder': '0',
			'scrolling': 'no'
		});
		AdCode.inject('adInsertWideSky');
	}
	
	/* INSERT RECTANGLE ADVERTISEMENT CODE */
	if($('adInsertRect')){
		var AdCode = new Element('iframe', {
		    'styles': {
			   'width': '300px',
			   'height': '250px',
			   'overflow': 'hidden'
		    },
		    'name': 'adRectangle',
		    'src': '/misc/ads/ad-rectangle-asdaq.html',
		    'frameborder': '0',
			'scrolling': 'no'
		});
		AdCode.inject('adInsertRect');
	}
	
	/* INSERT SKY SCRAPER Google ADVERTISEMENT CODE */
	if($('adInsertWideSkyGoogle')){
		var AdCode = new Element('iframe', {
		    'styles': {
			   'width': '160px',
			   'height': '600px',
			   'overflow': 'hidden'
		    },
		    'name': 'adWideScraper',
		    'src': '/misc/ads/ad-wide-skyscraper-google.html',
		    'frameborder': '0',
			'scrolling': 'no'
		});
		AdCode.inject('adInsertWideSkyGoogle');
	}
	
	/* INSERT RECTANGLE Google ADVERTISEMENT CODE */
	if($('adInsertRectGoogle')){
		var AdCode = new Element('iframe', {
		    'styles': {
			   'width': '300px',
			   'height': '250px',
			   'overflow': 'hidden'
		    },
		    'name': 'adRectangle',
		    'src': '/misc/ads/ad-rectangle-google.html',
		    'frameborder': '0',
			'scrolling': 'no'
		});
		AdCode.inject('adInsertRectGoogle');
	}

	/* INSERT LEADERBOARD Google ADVERTISMENT CODE */
	if($('adInsertLeaderGoogle')){
		var AdCode = new Element('iframe', {
		    'styles': {
			   'width': '728px',
			   'height': '90px',
			   'overflow': 'hidden'
		    },
		    'name': 'adLeaderboard',
		    'src': '/misc/ads/ad-leaderboard-google.html',
		    'frameborder': '0',
			'scrolling': 'no'
		});
		AdCode.inject('adInsertLeaderGoogle');
	}

	if($('adInsertRectCH')) {
		var AdCode = new Element('iframe', {
		    'styles': {
			   'width': '300px',
			   'height': '250px',
			   'overflow': 'hidden'
		    },
		    'name': 'adRectangle',
		    'src': '/misc/ads/ad-rectangle-ch.html',
		    'frameborder': '0',
			'scrolling': 'no'
		});
		AdCode.inject('adInsertRectCH');
	}	
});
