
var arr = new Array(
// display hyperlink:  #link# http://cloudchannelsummit.com/wp-content/uploads/2011/08/EileenBoerger_h1.jpg #$Eileen Boerger $#

	{ Event: { date: 22, month: 'Jun', year: 2011, description: 'Event'} },
	{ Event: { date: 27, month: 'Jun', year: 2011, description: 'Event'} },
	{ Event: { date: 28, month: 'Jan', year: 2011, description: 'Event'} },
    { Event: { date: 31, month: 'Oct', year: 2011, description: 'NEWS FLASH!!!!! Eileen Boerger, President of Agilis Solutions to present in Safenet\'s Webcast Series #startlink# http://www.prweb.com/releases/prweb2011cloud-computing/10software-development/prweb8917877.htm #linktext#\"Let\'s do it in the Cloud... A Software Vendor\'s Guide to Profitable Cloud Service Delivery\"#endlink#'} },
    { Event: { date: 15, month: 'Nov', year: 2011, description: 'Agilis Solution\'s President Eileen Boerger will be a featured speaker at SIIA\'s #startlink# http://www.siia.net/aam/2011/speakers.asp #linktext#All About Mobile#endlink# conference in San Francisco'} },
	{ Event: { date: 01, month: 'May', year: 2011, description: 'Event'} }
	
);


var arrayMonths = new Array();

function CreateEvent(date, month, year, description) {
        
        do {
            description = description.replace("#startlink#", "<a style='color:red' href='");
            description = description.replace("#linktext#", "'>");
            description = description.replace("#endlink#", "</a>");
        } while (description.indexOf("#startlink#") > -1 || description.indexOf("#linktext#") > -1 || description.indexOf("#endlink#") > -1)

    var liTag = "<li>";
	liTag += "<div class='rtable'><span>" + month + ". " + date + ", " + year + "</span></div>"
    liTag += "<div class='newstext'>" + description +"</div></li>";
       
		
	return liTag;		
}

function BindingImages(isRebind){
	var index = 0;
	
	if (!isRebind)
	{
		for (i=0; i < arr.length; i++){
				
			if (index == 12)
				break;
		
			if (arr[i].Event.month == 'Jan' && arrayMonths.toString().indexOf('Jan') < 0){
				AddImageSource('images/events/newsnavi-01.gif', 'images/events/newsnavi-over-01.gif', 'monthJan', 'month01');
				arrayMonths[index] = 'Jan'
				index ++;
			}
			else if (arr[i].Event.month == 'Feb' && arrayMonths.toString().indexOf('Feb') < 0){
				AddImageSource('images/events/newsnavi-02.gif', 'images/events/newsnavi-over-02.gif', 'monthFeb', 'month02');
				arrayMonths[index] = 'Feb'
				index ++;
			}
			else if (arr[i].Event.month == 'Mar' && arrayMonths.toString().indexOf('Mar') < 0){
				AddImageSource('images/events/newsnavi-03.gif', 'images/events/newsnavi-over-03.gif', 'monthMar', 'month03');
				arrayMonths[index] = 'Mar'
				index ++;
			}
	
			else if (arr[i].Event.month == 'Apr' && arrayMonths.toString().indexOf('Apr') < 0){
				AddImageSource('images/events/newsnavi-04.gif', 'images/events/newsnavi-over-04.gif', 'monthApr', 'month04');
				arrayMonths[index] = 'Apr'
				index ++;
			}
	
			else if (arr[i].Event.month == 'May' && arrayMonths.toString().indexOf('May') < 0){
				AddImageSource('images/events/newsnavi-05.gif', 'images/events/newsnavi-over-05.gif', 'monthMay', 'month05');
				arrayMonths[index] = 'May'
				index ++;
			}
	
			else if (arr[i].Event.month == 'Jun' && arrayMonths.toString().indexOf('Jun') < 0){
				AddImageSource('images/events/newsnavi-06.gif', 'images/events/newsnavi-over-06.gif', 'monthJun', 'month06');
				arrayMonths[index] = 'Jun'
				index ++;
			}
			
			else if (arr[i].Event.month == 'Jul' && arrayMonths.toString().indexOf('Jul') < 0){
				AddImageSource('images/events/newsnavi-07.gif', 'images/events/newsnavi-over-07.gif', 'monthJun', 'month07');
				arrayMonths[index] = 'Jul'
				index ++;
			}
	
			else if (arr[i].Event.month == 'Aug' && arrayMonths.toString().indexOf('Aug') < 0){
				AddImageSource('images/events/newsnavi-08.gif', 'images/events/newsnavi-over-08.gif', 'monthAug', 'month08');
				arrayMonths[index] = 'Aug'
				index ++;
			}
	
			else if (arr[i].Event.month == 'Sep' && arrayMonths.toString().indexOf('Sep') < 0){
				AddImageSource('images/events/newsnavi-09.gif', 'images/events/newsnavi-over-09.gif', 'monthSep', 'month09');
				arrayMonths[index] = 'Sep'
				index ++;
			}
	
			else if (arr[i].Event.month == 'Oct' && arrayMonths.toString().indexOf('Oct') < 0){
				AddImageSource('images/events/newsnavi-10.gif', 'images/events/newsnavi-over-10.gif', 'monthOct', 'month10');
				arrayMonths[index] = 'Oct'
				index ++;
			}
			
			else if (arr[i].Event.month == 'Nov' && arrayMonths.toString().indexOf('Nov') < 0){
				AddImageSource('images/events/newsnavi-11.gif', 'images/events/newsnavi-over-11.gif', 'monthNov', 'month11');
				arrayMonths[index] = 'Nov'
				index ++;
			}
	
			else if (arr[i].Event.month == 'Dec' && arrayMonths.toString().indexOf('Dec') < 0){
				AddImageSource('images/events/newsnavi-12.gif', 'images/events/newsnavi-over-12.gif', 'monthDec', 'month12');
				arrayMonths[index] = 'Dec'
				index ++;
			}
	
		}
	}
	else
	{
			if (arrayMonths.toString().indexOf('Jan') >= 0){
				AddImageSource('images/events/newsnavi-01.gif', 'images/events/newsnavi-over-01.gif', 'monthJan', 'month01');
			}
			if (arrayMonths.toString().indexOf('Feb') >= 0){
				AddImageSource('images/events/newsnavi-02.gif', 'images/events/newsnavi-over-02.gif', 'monthFeb', 'month02');
			}
			if (arrayMonths.toString().indexOf('Mar') >= 0){
				AddImageSource('images/events/newsnavi-03.gif', 'images/events/newsnavi-over-03.gif', 'monthMar', 'month03');
			}
	
			if (arrayMonths.toString().indexOf('Apr') >= 0){
				AddImageSource('images/events/newsnavi-04.gif', 'images/events/newsnavi-over-04.gif', 'monthApr', 'month04');
			}
	
			if (arrayMonths.toString().indexOf('May') >= 0){
				AddImageSource('images/events/newsnavi-05.gif', 'images/events/newsnavi-over-05.gif', 'monthMay', 'month05');
			}
	
			if (arrayMonths.toString().indexOf('Jun') >= 0){
				AddImageSource('images/events/newsnavi-06.gif', 'images/events/newsnavi-over-06.gif', 'monthJun', 'month06');
			}
			
			if (arrayMonths.toString().indexOf('Jul') >= 0){
				AddImageSource('images/events/newsnavi-07.gif', 'images/events/newsnavi-over-07.gif', 'monthJun', 'month07');
			}
	
			if (arrayMonths.toString().indexOf('Aug') >= 0){
				AddImageSource('images/events/newsnavi-08.gif', 'images/events/newsnavi-over-08.gif', 'monthAug', 'month08');
			}
	
			if (arrayMonths.toString().indexOf('Sep') >= 0){
				AddImageSource('images/events/newsnavi-09.gif', 'images/events/newsnavi-over-09.gif', 'monthSep', 'month09');
			}
	
			if (arrayMonths.toString().indexOf('Oct') >= 0){
				AddImageSource('images/events/newsnavi-10.gif', 'images/events/newsnavi-over-10.gif', 'monthOct', 'month10');
			}
			
			if (arrayMonths.toString().indexOf('Nov') >= 0){
				AddImageSource('images/events/newsnavi-11.gif', 'images/events/newsnavi-over-11.gif', 'monthNov', 'month11');
			}
	
			if (arrayMonths.toString().indexOf('Dec') >= 0){
				AddImageSource('images/events/newsnavi-12.gif', 'images/events/newsnavi-over-12.gif', 'monthDec', 'month12');
			}

	}
	
}

function AddImageSource(imageSrc, swapImageSrc, swapId, imgName){

	swapImage(imgName,'',imageSrc,1);
	
	var swapEvent = document.getElementById(swapId);
	
	var mouseover = document.createAttribute("onmouseover");
    mouseover.nodeValue = "swapImage('" + imgName + "','','" + swapImageSrc + "',1);";
	swapEvent.setAttributeNode(mouseover);
	
	var mouseout = document.createAttribute("onmouseout");
    mouseout.nodeValue = "swapImage('" + imgName + "','','" + imageSrc+ "',1);";
	swapEvent.setAttributeNode(mouseout );


}

function findEvents(year, month, imgName, imageSrc, swapId){

	if (arrayMonths.toString().indexOf(month) > -1)
	{
		var tags = '';
		for (i=0; i < arr.length; i++){
		    if (arr[i].Event.month == month && arr[i].Event.year == year) {
			    tags += CreateEvent(arr[i].Event.date, arr[i].Event.month, arr[i].Event.year, arr[i].Event.description);
			}
		}
		
		if (tags != ''){
			var newsdate = document.getElementById("eventsDetail");
			newsdate.innerHTML = tags ;
			
			BindingImages(true);
			swapImage(imgName,'',imageSrc,1);
			var swapEvent = document.getElementById(swapId);
			swapEvent.removeAttribute('onmouseover');
			swapEvent.removeAttribute('onmouseout');		
		}
	}
}

function findObj(n, d) { //v3.0
  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=findObj(n,d.layers[i].document); return x;
}

function swapImage() { //v3.0
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

