/*hfma mag javascript functions*/
/*Ad one------------------------------------------------------------------------------------------------*/
displayAdOne = function () {
var currentdate = 0
var core = 0
function StringArray (n) {
  this.length = n;
  for (var i =1; i <= n; i++) {
    this[i] = ' '

  }
}

image = new StringArray(4)
image[0] = '/images/something.jpg'
image[1] = '/images/another.jpg'
image[2] = '/images/thethird.jpg'
image[3] = '/images/onemore.gif'

var ran = 60/image.length

function ranimage() {
  currentdate = new Date()
  core = currentdate.getSeconds()
  core = Math.floor(core/ran)
  return(image[core])
}
document.write("<img src='" +ranimage()+ "' border=0>")
}
/*Ad Two------------------------------------------------------------------------------------------------*/
displayAdTwo = function () {
var currentdate = 0
var core = 0
function StringArray (n) {
  this.length = n;
  for (var i =1; i <= n; i++) {
    this[i] = ' '

  }
}

image = new StringArray(4)
image[0] = '/shared/img/something.jpg'
image[1] = '/shared/img/another.jpg'
image[2] = '/shared/img/thethird.jpg'
image[3] = '/shared/img/onemore.gif'

var ran = 60/image.length

function ranimage() {
  currentdate = new Date()
  core = currentdate.getSeconds()
  core = Math.floor(core/ran)
  return(image[core])
}
document.write("<img src='" +ranimage()+ "' border=0>")
}
/*Leaderboard------------------------------------------------------------------------------------------------*/
displayAdLeader = function () {
var currentdate = 0
var core = 0
function StringArray (n) {
  this.length = n;
  for (var i =1; i <= n; i++) {
    this[i] = ' '

  }
}

image = new StringArray(4)
image[0] = '/shared/img/something.jpg'
image[1] = '/shared/img/another.jpg'
image[2] = '/shared/img/thethird.jpg'
image[3] = '/shared/img/onemore.gif'

var ran = 60/image.length

function ranimage() {
  currentdate = new Date()
  core = currentdate.getSeconds()
  core = Math.floor(core/ran)
  return(image[core])
}
document.write("<img src='" +ranimage()+ "' border=0>")
}
/*-AD functionality------------------------------------------------------------------------*/
/*Amerinet:
http://www.amerinet-gpo.com 

BE Smith:
www.besmith.com

Kronos:
www.kronos.com/hcleadership 




*/
//******************************************
//********************************************************************************************
//***********      ROTATE ADS 1                               *******************************
var ID = "adRotateOne"; //id of the span or div in the HTML
var POS = 0; //position of the item to display in the IMAGEARRAY
var firstCase = true; //is this the first image being loaded
var IMAGEARRAY = new Array('Amerinet.jpg','BESmith.jpg','Kronos.gif', 'Amerinet.jpg');
var IMAGEARRAYLENGTH = IMAGEARRAY.length - 1; //Length of array in terms of array positioning

//HREF LOCATIONS
var REFARRAY = new Array('http://www.amerinet-gpo.com','http://www.besmith.com','http://www.kronos.com/hcleadership', 'http://www.amerinet-gpo.com');
var NOLINK = "";
var ADDENDTAG = false;

function rotateAdOne()
{	
	//This can be removed this is only optional
	//If this is the first time the code is loaded we will randomly start the 
	//image rotation with a random image in the array. If this section is omitted
	//the images will just be displayed in the order they appear in the IMAGEARRAY
	if(firstCase)
	{
		POS = randomStart();
		firstCase = false;
	}
	//**************************************************//
	//**************************************************//
	
	document.getElementById(ID).innerHTML = generateImageString(IMAGEARRAY[POS]);
	
	if(POS == IMAGEARRAYLENGTH)
		POS = 0;
	else
		POS++;

	//setTimeout("rotateImage()",12000);
}

function generateImageString(imageName)
{
	var imageString = '';
	var PRIMARYLOCATION = REFARRAY[POS];
	//************************************

	
	imageString +='<a href="';
	imageString += PRIMARYLOCATION;
	imageString += '" target="_blank">';
	ADDENDTAG = true;
	//************************************
	//************************************
	
	imageString +='<img src="shared\/img\/ads\/';
	imageString += imageName;
	imageString += '" border="0" alt="HFMA Sponsor">';
	
	//************************************
	//Special script for HFMA to apply </a> tag (can be removed)
	if(ADDENDTAG)
		imageString += "<\/a>";
	//************************************
	//************************************
	
	return imageString;
}//end function generateImageString

function randomStart()
{
	if(IMAGEARRAYLENGTH == null || IMAGEARRAYLENGTH == 0)
		return 0;
	
	//generate the random number	
	var randomnumber = Math.floor(Math.random()*(IMAGEARRAYLENGTH + 1));
	
	//additional validation that the number is a valid array position
	if(randomnumber >= 0 && randomnumber <= IMAGEARRAYLENGTH)
		return randomnumber;
	else 
		return 0;
}
//********************************************************************************************
//***********     END ROTATE ADS 1                            *******************************
//*******************************************************************************************
//


//MedAssets:
//http://www.medassets.com/RevenueSolutions/WhatWeDo/Products.htm 


//Sullivan Cotter:
//http://www.sullivancotter.com


//******************************************
//********************************************************************************************
//***********      ROTATE ADS 2                              *******************************
var IDTwo = "adRotateTwo"; //id of the span or div in the HTML
var POSTwo = 0; //position of the item to display in the IMAGEARRAY
var SecondCase = true; //is this the first image being loaded
var IMAGEARRAYTwo = new Array('MedAssets.jpg','SullivanCotter.jpg', 'MedAssets.jpg','SullivanCotter.jpg');
var IMAGEARRAYLENGTHTwo = IMAGEARRAYTwo.length - 1; //Length of array in terms of array positioning

//HREF LOCATIONS
var REFARRAYTwo = new Array('http://www.medassets.com/RevenueSolutions/WhatWeDo/Products.htm','http://www.sullivancotter.com', 'http://www.medassets.com/RevenueSolutions/WhatWeDo/Products.htm','http://www.sullivancotter.com');

var NOLINKTwo = "";
var ADDENDTAGTwo = false;

function rotateAdTwo()
{	
	//This can be removed this is only optional
	//If this is the first time the code is loaded we will randomly start the 
	//image rotation with a random image in the array. If this section is omitted
	//the images will just be displayed in the order they appear in the IMAGEARRAY
	if(SecondCase)
	{
		POSTwo = randomStart();
		secondCase = false;
	}
	//**************************************************//
	//**************************************************//
	
	document.getElementById(IDTwo).innerHTML = generateImageString2(IMAGEARRAYTwo[POSTwo]);
	
	if(POSTwo == IMAGEARRAYLENGTHTwo)
		POSTwo = 0;
	else
		POSTwo++;

	//setTimeout("rotateImage()",12000);
}

function generateImageString2(imageNameTwo)
{
	var imageStringTwo = '';
	var PRIMARYLOCATIONTwo = REFARRAYTwo[POSTwo];
	//************************************
	imageStringTwo +='<a href="';
	imageStringTwo += PRIMARYLOCATIONTwo;
	imageStringTwo += '" target="_blank">';
	ADDENDTAGTwo = true;
	//************************************
	//************************************
	
	imageStringTwo +='<img src="shared\/img\/ads\/';
	imageStringTwo += imageNameTwo;
	imageStringTwo += '" border="0" alt="HFMA Sponsor">';
	
	//************************************
	//Special script for HFMA to apply </a> tag (can be removed)
	if(ADDENDTAGTwo)
		imageStringTwo += "<\/a>";
	//************************************
	//************************************
	
	return imageStringTwo;
}//end function generateImageString

function randomStart2()
{
	if(IMAGEARRAYLENGTHTwo == null || IMAGEARRAYLENGTHTwo == 0)
		return 0;
	
	//generate the random number	
	var randomnumberTwo = Math.floor(Math.random()*(IMAGEARRAYLENGTHTwo + 1));
	
	//additional validation that the number is a valid array position
	if(randomnumberTwo >= 0 && randomnumberTwo <= IMAGEARRAYLENGTHTwo)
		return randomnumberTwo;
	else 
		return 0;
}
//********************************************************************************************
//***********     END ROTATE ADS 2                            *******************************
//*******************************************************************************************
//

