// JavaScript Document
//This function writes a google adsense ad to the ad2 div by creating an I-frame. It takes 1 parameter (source of the page that will be loaded into the I-frame) 
function vWriteGoogleValues(source) {
	document.getElementById("ad2").innerHTML = "<iframe align='left' name='FRAMENAME' src='"+source+"' width='160' height='600' hspace=0 vspace=0 frameborder='0' scrolling='no' allowautotransparency=true></iframe>";
}

//This function writes any generic script ad to the ad2 div by creating an I-frame. It takes 1 parameter (source of the page that will be loaded into the I-frame)
function vWriteScriptValues(source) {
	document.getElementById("ad2").innerHTML = "<iframe align='left' name='FRAMENAME2' src='"+source+"' width='160' height='600' hspace=0 vspace=0 frameborder='0' scrolling='no' allowautotransparency=true></iframe>";
}

//This function writes a google adsense ad to the ad1 div by creating an I-frame. It takes 1 parameter (source of the page that will be loaded into the I-frame)
function hWriteGoogleValues(source) {
	document.getElementById("ad1").innerHTML = "<iframe align='left' name='FRAMENAME1' src='"+source+"' width='728' height='90' hspace=0 vspace=0 frameborder='0' scrolling='no' allowautotransparency=true></iframe>";
}

//This function writes any generic script ad to the ad1 div by creating an I-frame. It takes 1 parameter (source of the page that will be loaded into the I-frame)
function hWriteScriptValues(source) {
	document.getElementById("ad1").innerHTML = "<iframe align='left' name='FRAMENAME3' src='"+source+"' width='728' height='90' hspace=0 vspace=0 frameborder='0' scrolling='no' allowautotransparency=true></iframe>";
}

//Function checks ad file type and writes ad to div ad2 based on type of file.
function writeToAd2(num) {
		switch(vFileTypeArray[num]) {
		case "swf":
   		var so2 = new SWFObject(vFilePathArray[num], 'baseMovie2', vFileWidthArray[num], vFileHeightArray[num], '8', '#ffffff');
   		so2.addParam('scale','noscale');
   		so2.write('ad2');
		break;
		case "jpg":
		document.getElementById("ad2").innerHTML = "<a href='"+vLinkArray[num]+"' target='_blank'><img border='0' src='"+vFilePathArray[num]+"'/></a>";
		break;
		case "gif":
		document.getElementById("ad2").innerHTML = "<a href='"+vLinkArray[num]+"' target='_blank'><img border='0' src='"+vFilePathArray[num]+"'/></a>";
		break;
		case "png":
		document.getElementById("ad2").innerHTML = "<a href='"+vLinkArray[num]+"' target='_blank'><img border='0' src='"+vFilePathArray[num]+"'/></a>";
		break;
		case "gad":
		vWriteGoogleValues(vLinkArray[num]);
		break;
		case "scr":
		vWriteScriptValues(vLinkArray[num]);
		break;
	}
}

//Function checks ad file type and writes ad to div ad1 based on type of file.
function writeToAd1(num) {
		switch(hFileTypeArray[num]) {
		case "swf":
		var so3 = new SWFObject(hFilePathArray[num], 'baseMovie3', hFileWidthArray[num], hFileHeightArray[num], '8', '#ffffff');
   		so3.addParam('scale','noscale');
   		so3.write('ad1');
		break;
		case "jpg":
		document.getElementById("ad1").innerHTML = "<a href='"+hLinkArray[num]+"' target='_blank'><img border='0' src='"+hFilePathArray[num]+"'/></a>";
		break;
		case "gif":
		document.getElementById("ad1").innerHTML = "<a href='"+hLinkArray[num]+"' target='_blank'><img border='0' src='"+hFilePathArray[num]+"'/></a>";
		break;
		case "png":
		document.getElementById("ad1").innerHTML = "<a href='"+hLinkArray[num]+"' target='_blank'><img border='0' src='"+hFilePathArray[num]+"'/></a>";
		break;
		case "gad":
		hWriteGoogleValues(hLinkArray[num]);
		break;
		case "scr":
		hWriteScriptValues(hLinkArray[num]);
		break;
	}
}