﻿var maxcols = 5;
var maxrows = 19;

function ShowTags()
{

    if(document.getElementById) 
    {
        divshowtag = document.getElementById('ShowTag');
        divtagtitle = document.getElementById('tagtitle'); 
        divtagheadertitle = document.getElementById('tagheadertitle');
        divcrumb = document.getElementById('idbreadcrumb');
     }   
		
    if(divshowtag.innerHTML=='[Hide]')
    {
		divshowtag.innerHTML='[Show]';
		divtagheadertitle.style.display = "block";
		divcrumb.style.display = "none";

    	for(i=1;i<5;i++)
		{
			if(document.getElementById('tagcontainerd' + i))
				document.getElementById("tagcontainerd" + i).style.display = "none";
			if(document.getElementById('clearfilterd' + i))
				document.getElementById("clearfilterd" + i).style.display = "none";
		}
    }
    else if(divshowtag.innerHTML=='[Show]')
    {
		divtagheadertitle.style.display = "block";
		divcrumb.style.display = "block";
    	for(i=1;i<5;i++)
		{
			if(document.getElementById('d' + i).style.display == "block")
			{
				document.getElementById("tagcontainerd" + i).style.display = "block";
				document.getElementById("clearfilterd" + i).style.display = "block";
				divshowtag.innerHTML='[Hide]';
				break;
			}
		}
    }
}

function ShowSearch()
{

    if(document.getElementById) 
    {
        div = document.getElementById('SearchBox'); 
    }   
        
    if(div.style.display == '')
        div.style.display = 'none';
        
    div.style.display = (div.style.display==''||div.style.display=='block')?'none':'block'; 
    
}

function ClosePopUp(sessioncode)
{
    var div; 
    if(document.getElementById) 
        // Standard way to get element 
        div = document.getElementById('popupWindow' + sessioncode); 
    else if(document.all) 
        // Get the element in old IE's 
        div = document.all['popupWindow' + sessioncode];    

	backgroundFilter(sessioncode);
	link = false;
	div.style.display = 'none';
}

function DisplayPopUp(sessioncode)
{
	if(!link)
	{
	    document.getElementById(sessioncode).style.display = 'block';
		backgroundFilter(sessioncode);
		popUp(sessioncode);
	}
	link = false;
}

// To enable/disable the background:  
function backgroundFilter(sessioncode) 
{ 
    var div; 
    if(document.getElementById) 
        // Standard way to get element 
        div = document.getElementById('backgroundFilter' + sessioncode); 
    else if(document.all) 
        // Get the element in old IE's 
        div = document.all['backgroundFilter' + sessioncode];    



    // if the style.display value is blank we try to check it out here 
    if(div.style.display== '' && div.offsetWidth != undefined && div.offsetHeight != undefined) 
    { 
        div.style.display = (div.offsetWidth!=0 && div.offsetHeight!=0)?'block':'none'; 
    } 

    // If the background is hidden ('none') then it will display it ('block'). 
    // If the background is displayed ('block') then it will hide it ('none'). 
    div.style.display = (div.style.display==''||div.style.display=='block')?'none':'block'; 
    
}  
// To display/hide the popup:  
function popUp(sessioncode) 
{ 
    var div; 
    if(document.getElementById) 
        // Standard way to get element 
        div = document.getElementById('popupWindow' + sessioncode); 
    else if(document.all) 
        // Get the element in old IE's 
        div = document.all['popupWindow' + sessioncode];    

   // if the style.display value is blank we try to check it out here 
    if(div.style.display== '' && div.offsetWidth != undefined && div.offsetHeight != undefined) 
    { 
        div.style.display = (div.offsetWidth!=0 && div.offsetHeight!=0)?'block':'none'; 
    } 

$(document).ready(function() {
    $(div).centerInClient();
});

    if(div.style.display==''||div.style.display=='block')
        div.style.display = 'none'
    else    
    	div.style.display = 'block'
  //      $(div).animate({width:'toggle'},450);    

} 
function LoadSB(dayid)
{

	var navLocationLoad=location.pathname.toLowerCase();
	if (navLocationLoad.indexOf("pages/members/sessionbrowser.aspx") < 0) 
		return;

	if(dayid == "")
		dayid = "1";

		document.getElementById('d' + dayid).style.display = "block";
		//display the tag container
		document.getElementById("tagcontainerd" + dayid).style.display = "block";
}

function SwitchDay(dayid)
{
	ar_ph = [];
    ar_tag = [];
	ar_newtag = [];	
	ar_crumb = [];
	
	hd_df = "";
	hd_tv = "";
	hd_dn = "";
	hd_tc = "";

	CloseDays();

	if(document.getElementById('d' + dayid))
		document.getElementById('d' + dayid).style.display = "block";
		document.getElementById('idbreadcrumb').innerHTML = "";
		
	for(i=1;i<5;i++)
	{
		document.getElementById('navday' + i).setAttribute("class", "DayContent"); 
		document.getElementById('navday' + i).setAttribute("className", "DayContent"); 	//for IE
		document.getElementById("ph_taglistd" + i).style.display = 'none';
		document.getElementById("clearfilterd" + i).style.display = 'none';
	}
	
	document.getElementById('navday' + dayid).setAttribute("class", "SelectedDay"); 
	document.getElementById('navday' + dayid).setAttribute("className", "SelectedDay"); 	//for IE


	divshowtag = document.getElementById('ShowTag'); 
		
    if(divshowtag.innerHTML=='[Hide]')
    {
    	document.getElementById("tagcontainerd" + dayid).style.display = "block";
    	document.getElementById("taglistd" + dayid).style.display = "block";
	}
	else if(divshowtag.innerHTML=='[Show]')
    {
	    for(i=1;i<5;i++)
		{
			document.getElementById("tagcontainerd" + i).style.display = "none";
		}
    }


	for(var columncount = 1; columncount < maxcols + 1; columncount++)
	{
		brk = document.getElementById("brk" + columncount + 'd' + dayid);
		ts = document.getElementById("ts" + columncount + 'd' + dayid);
		phts = document.getElementById('phts' + columncount + 'd' + dayid);
		if(ts)
			ts.style.display="block";
		if(brk)
			brk.style.display="block";
		if(phts)
			phts.innerHTML = "";
			
		    for(var rowcount = 1; rowcount < maxrows+1; rowcount++)
			{
	        	try
	        	{
					divmain = document.getElementById("wr_maincolumncontentc" + columncount + "r" + rowcount + "d" + dayid);
					divph = document.getElementById("wr_ph_maincolumncontentc" + columncount + "r" + rowcount + "d" + dayid);
					if(divmain)
						divmain.style.display="block";
					if(divph)
						divph.style.display="none";


				}
				catch(err){}
			}
	}
	
	//clear out the old stuff
	
	//hide the time header display

	for(var i = 0; i < ar_ph.length; i++)
	{		
		//clearing out any existing html from our placeholders
		document.getElementById(ar_ph[i]).innerHTML = "";
		
		//setting the placeholders back to being hidden
		document.getElementById(ar_ph[i]).style.display="none";
	}	
}

function CloseDays()
{
	for(i=1;i<5;i++)
	{
		document.getElementById('navday' + i).setAttribute("class", "DayContent"); 
		document.getElementById('navday' + i).setAttribute("className", "DayContent"); 	//for IE


		if(document.getElementById('d' + i))
			document.getElementById('d' + i).style.display = "none";
			
			
		if(document.getElementById('tagcontainerd' + i))
			document.getElementById("tagcontainerd" + i).style.display = "none";
	}
}
var link=false;
function AddToCalendar(sessioncode, sessionid)
{
	link = true;	//this keeps the popup box from popping up

	if(sessioncode == '0')
		return;

	var add_id = 'add_' + sessioncode;
	var popadd = 'popadd_' + sessioncode;
	var rem_id = 'rem_' + sessioncode;
	var poprem = 'poprem_' + sessioncode;
	var divid = 'fw_' + sessioncode;

	document.getElementById(add_id).style.display="none";
	document.getElementById(popadd).style.display="none";

	document.getElementById(rem_id).style.display="block";
	document.getElementById(poprem).style.display="block";
	
	document.getElementById(divid).setAttribute("class", "SelectedSession"); 
	document.getElementById(divid).setAttribute("className", "SelectedSession"); 	//for IE

	document.getElementById('st_' + sessioncode).setAttribute("class", "SelectedSessionTitle"); 
	document.getElementById('st_' + sessioncode).setAttribute("className", "SelectedSessionTitle"); 	//for IE

	document.getElementById('pb_' + sessioncode).setAttribute("class", "SelectedPresentedBy"); 
	document.getElementById('pb_' + sessioncode).setAttribute("className", "SelectedPresentedBy"); 	//for IE
	
	var hosturl = GetHost();
	try
	{
		
		var qs = location.search;
		var sendurl = hosturl + "/pages/members/sessionadd.aspx?id=" + sessionid;	// + "&stype=" + stype + "&" + qs;
		if(window.XDomainrequst)
		{
		
		}
		else if (window.XMLHttpRequest) 
		{
			try
			{	
				req = new XMLHttpRequest();
 			   	req.onreadystatechange = voteprocessUpdate;
		  		req.open("POST", sendurl, true);
		  		req.send("");
			}
			catch(e)
			{
				req = new XDomainRequest();
 			   	req.onreadystatechange = voteprocessUpdate;
		  		req.open("POST", sendurl, true);
		  		req.send("");
			}
		}
		else
		{
			if (window.ActiveXObject) 
			{
				// ...otherwise, use the ActiveX control for IE5.x and IE6.
				req = new ActiveXObject('MSXML2.XMLHTTP.3.0');
			   	req.onreadystatechange = voteprocessUpdate;
			  	req.open("POST", sendurl, true);
				req.send("");
			}
		}		
	
	}
	catch(e)
	{
	}

	SearchSessionGroup(hd_df, hd_tv, hd_dn, hd_tc)
	
}

function RemoveFromCalendar(sessioncode, sessionid)
{
	link = true;
	var add_id = 'add_' + sessioncode;
	var popadd = 'popadd_' + sessioncode;
	var rem_id = 'rem_' + sessioncode;
	var poprem = 'poprem_' + sessioncode;
	var divid = 'fw_' + sessioncode;

	document.getElementById(add_id).style.display="block";
	document.getElementById(popadd).style.display="block";

	document.getElementById(rem_id).style.display="none";
	document.getElementById(poprem).style.display="none";
	
	document.getElementById(divid).setAttribute("class", "FooterWrapper"); 
	document.getElementById(divid).setAttribute("className", "FooterWrapper"); 	//for IE

	document.getElementById('st_' + sessioncode).setAttribute("class", "SessionTitleContent"); 
	document.getElementById('st_' + sessioncode).setAttribute("className", "SessionTitleContent"); 	//for IE

	document.getElementById('pb_' + sessioncode).setAttribute("class", "PresentedBy"); 
	document.getElementById('pb_' + sessioncode).setAttribute("className", "PresentedBy"); 	//for IE
	
		var hosturl = GetHost();

		try
		{
			var sendurl = hosturl + "/pages/members/sessiondelete.aspx?id=" + sessionid;	// + "&stype=" + stype;
			if (window.XMLHttpRequest) 
			{
				try
				{	
					req = new XMLHttpRequest();
	 			   	req.onreadystatechange = voteprocessUpdate;
			  		req.open("POST", sendurl, true);
			  		req.send("");
				}
				catch(e)
				{
					req = new XDomainRequest();
	 			   	req.onreadystatechange = voteprocessUpdate;
			  		req.open("POST", sendurl, true);
			  		req.send("");
				}
			}
			else
			{
				if (window.ActiveXObject) 
				{
					req = new ActiveXObject('MSXML2.XMLHTTP.3.0');
			   		req.onreadystatechange = voteprocessUpdate;
			  		req.open("POST", sendurl, true);
					req.send("");
				}
			}
		}
		catch(e)
		{
		}
		
	SearchSessionGroup(hd_df, hd_tv, hd_dn, hd_tc)
}

function WatchSession(sessioncode)
{
	link = true;	//this keeps the popup box from popping up
	document.location.href="/pages/members/sessiondetails.aspx?sid=" + sessioncode;
}

function DownloadPresentation(sessiondownload, sessioncode)
{

	link = true;	//this keeps the popup box from popping up
	if(sessiondownload != '0')
	{
		document.location.href="/_layouts/SessionDeckLogin.aspx?deckpath=" + sessiondownload;
		//document.location.href=sessiondownload;
	}
}
function FillOutEvaluation(guid)
{
	link = true;	//this keeps the popup box from popping up

	var navLocationLoad=location.pathname.toLowerCase();
	if (navLocationLoad.indexOf("members/mycalendar.aspx") >= 0) 
		refpage = "mycalendar.aspx";	
	else
		refpage = "sessionbrowser.aspx";

	if(guid != '0'){
		document.location.href="/pages/members/sessionevaluation.aspx?guid=" + guid + "&refpage=" + refpage;
	}
}
function OpenSearch()
{
	var objk = document.getElementById('searchk'); 
	document.location.href = "/pages/members/sessionsearch.aspx?k=" + objk.value;
}

/* Calendar Functions */
function C_WatchSession(sessioncode)
{
	document.location.href="/pages/members/sessiondetails.aspx?sid=" + sessioncode;
}

function RemoveSession(sessionid)
{	
	var hosturl = GetHost();
	document.location.href = hosturl + "/pages/members/sessiondelete.aspx?urlid=1&id=" + sessionid;
}
/* Calendar Functions */
function PrintCalendar(userguid)
{
	window.open('http://www.mssharepointconference.com/pages/members/CalendarPrint.aspx', 'Print','top=Width=700,height=700,toolbar=yes,scrollbar=no');
}
function AddToOutLook(urllink)
{
	document.location.href=urllink;
}

/* Calendar Functions */

	var ar_ph = [];
    var ar_tag = [];
	var ar_newtag = [];	
	var ar_crumb = [];
	var int_crumb;

var hd_df = "", hd_tv = "", hd_dn = "", hd_tc = "";
function SearchSessionGroup(datafield, tagvalue, daynumber, tagcnt)
{

if(daynumber == "")
	return;
		
datafield = datafield.toLowerCase();

//these are so when we are on the search results we can call it again using the same arguments to set the background/foreground
hd_df = datafield;
hd_tv = tagvalue;
hd_dn = daynumber;
hd_tc = tagcnt;

//if a value is zero for the group is clicked, nothing should happen.
if( tagcnt=='0')
	return;

	var ar_hdtag = [];
	var ar_alltag = [];
	var ar_leveltag = [];	
	var ar_audiencetag = [];
	var ar_capabilitytag = [];
	var ar_presentedbytag = [];
		
	var isnew = false;
    var int_ph = 0;
    var int_tag = 0;
    var int_alltag = 0;

	var int_hdtag = 0;
    var int_leveltag = 0;
    var int_audiencetag = 0;
    var int_capabilitytag = 0;
    var int_presentedbytag = 0;    
    
    var strinnerhtml = '';

if(ar_newtag == "")
	isnew = true;

if(!ar_crumb.length)
	int_crumb = 0;
else
	int_crumb++
	
	ar_crumb[int_crumb] = tagvalue;

//remove the main tag container display
document.getElementById("taglistd" + daynumber).style.display = 'none';

ClearPlaceHolderData(daynumber, maxcols, maxrows, ar_ph)
ar_ph = [];

    var colnumber = 1;	//colnumber begins with 1 since our columns are based on 1 through n

    for(var columncount = 1; columncount < maxcols + 1; columncount++)
    {

	    var rownumber = 1;
	    
        for(var rowcount = 1; rowcount < maxrows+1; rowcount++)
	    {

				var idsuffix = "c" + columncount + "r" + rowcount + "d" + daynumber;
				
                //iterate through the grid and get the Id for each session div box
            	//this information is used below to return the innerhtml of the div containers session data
                iddivcol = "wr_maincolumncontent" + idsuffix ;
                idts = 'ts' + columncount + 'd' + daynumber;  //contains the actual time value
		

                //this hidden tag contains the tagging information we are searching in.
                var hiddentag = 'hd_' + datafield + '_' + idsuffix;
				
				//this set of hidden tags is so we can get the data from each session and apply it when the search tag is found
				var hdalltag = 'hd_tags_c' + columncount + "r" + rowcount + "d" + daynumber;

				var hdleveltag 			= 'hd_level_' + idsuffix;
				var hdaudiencetag 		= 'hd_audience_' + idsuffix;
				var hdcapabilitytag 	= 'hd_capability_' + idsuffix;
				var hdpresentedbytag 	= 'hd_presentedby_' + idsuffix;
							
				//since the tags value can contain comma delimited strings, we need to search the entire string for our tag
				//strtag holds the string value in our hidden element
				var strtag = '', stralltag = '', strleveltag = '', straudiencetag = '', strcapabilitytag = '', strpresentedbytag = '';
				
				if(document.getElementById(hiddentag))
				    strtag = document.getElementById(hiddentag).innerHTML;
				    
				if(document.getElementById(hdalltag))
				    stralltag = document.getElementById(hdalltag).innerHTML;

				if(document.getElementById(hdleveltag))
				    strleveltag = document.getElementById(hdleveltag).innerHTML;

				if(document.getElementById(hdaudiencetag))
				    straudiencetag = document.getElementById(hdaudiencetag).innerHTML;

				if(document.getElementById(hdcapabilitytag))
				    strcapabilitytag = document.getElementById(hdcapabilitytag).innerHTML;

				if(document.getElementById(hdpresentedbytag))
				    strpresentedbytag = document.getElementById(hdpresentedbytag).innerHTML;


				//arrtag is an array of values to iterate through
				var arrTag 		= strtag.split(",");					//what we are searching for
				var arrallTag 	= stralltag.split(",");					//getting the "Tag" counts
				
				var arrlevelTag = strleveltag.split(",");				//getting the level counts
				var arraudienceTag = straudiencetag.split(",");			//getting the audience counts
				var arrcapabilityTag = strcapabilitytag.split(",");		//getting the capability counts
				var arrpresentedbyTag = strpresentedbytag.split(",");	//getting the presentedby counts
				
				
				var found = false;
				if(isnew == false)		//we are coming in again with a new search criteria.
				{
					if(ar_newtag.toString().search(idsuffix) > -1)
						found = true;
				}
				else
					found = true;



				if(found == true)
				{
					
	                if(arrTag.length > 1)
					{
					    for(var arrid=0; arrid < arrTag.length; arrid++)
						{

							//found the tag we're looking for.
			                if(arrTag[arrid] == tagvalue)
			                {
								//build and array of the idsuffixes that are found
	                            ar_hdtag[int_hdtag] = idsuffix;
	                            int_hdtag++;
	
	
			                    //build an array for the group list
			                    for(var arrtagid=0; arrtagid < arrTag.length; arrtagid++)
						        {
	                                ar_tag[int_tag] = arrTag[arrtagid];
	                                int_tag++;
	                            }
								
								//build an array for the tag list	
			                    for(var arralltagid=0; arralltagid < arrallTag.length; arralltagid++)
						        {
	                                ar_alltag[int_alltag] = arrallTag[arralltagid];
	                                int_alltag++;
	                            }
	
	                            for(var arrleveltagid=0; arrleveltagid < arrlevelTag.length; arrleveltagid++)
						        {
	                                ar_leveltag[int_leveltag] = arrlevelTag[arrleveltagid];
	                                int_leveltag++;
	                            }
							
	                            for(var arraudiencetagid=0; arraudiencetagid < arraudienceTag.length; arraudiencetagid++)
						        {
	                                ar_audiencetag[int_audiencetag] = arraudienceTag[arraudiencetagid];
	                                int_audiencetag++;
	                            }

	                        	for(var arrcapabilitytagid=0; arrcapabilitytagid < arrcapabilityTag.length; arrcapabilitytagid++)
						        {
	                                ar_capabilitytag[int_capabilitytag] = arrcapabilityTag[arrcapabilitytagid];
	                                int_capabilitytag++;
	                            }

	                            for(var arrpresentedbytagid=0; arrpresentedbytagid < arrpresentedbyTag.length; arrpresentedbytagid++)
						        {
	                                ar_presentedbytag[int_presentedbytag] = arrpresentedbyTag[arrpresentedbytagid];
	                                int_presentedbytag++;
	                            }
								
									
								//the first time in, colnumber and rownumber are assigned a value of 1.
								//the next time we come in here, we need to increment by 1 so the 
								//placeholder div boxes know their position.
				
								//the placeholders are built starting in the top left and fill the row
								//and then move to the next column and fill that row with data.
				
				                //this is the time header at the top of each column.  It was created as an empty placeholder
				                idphts = 'phts' + colnumber + "d" + daynumber;
								
								//this is the div box in the grid and was created as an empty placeholder
	                            //idphcol = 'wr_ph_maincolumncontent' + 'c' + colnumber + "r" + rownumber + "d" + daynumber;    //this is our content element placeholder

								//need to use the actual column number
								originalcolnumber = idsuffix.substring(1,2);

								idphcol = 'wr_ph_maincolumncontent' + 'c' + originalcolnumber + "r" + rownumber + "d" + daynumber;    //this is our content element placeholder
	                            			                
				                //since we found a tag match, we have the real position of the div box by knowing
				                //the column, row and day.  Using the id, we can return the innerhtml and set
				                //set the html of the placeholder with that information
				                
				                //document.getElementById(idphts).innerHTML = document.getElementById(idts).innerHTML;
				                brk = document.getElementById("brk" + columncount + 'd' + daynumber);	//contains the break data
				                if(brk)
									brk.style.display="block";

				                document.getElementById(idphcol).innerHTML = document.getElementById(iddivcol).innerHTML;
				                
				                //show the div placeholder
				                document.getElementById(idphts).style.display="block";
				                document.getElementById(idphcol).style.display="block";
				                
				                //we dump this into an array so when we clean up, we only clean up what we used.
								ar_ph[int_ph] = idphcol;
				                int_ph++;
				                
				                //increment rownumber so it matches the rowcount value.  We only do this when we have found a match.
								//we use the rownumber to keep track of howmany rows we need to fill in when there is no more data.
								rownumber++;
	
				                //once we found the tag, bail out.
				                break;
							}
							
						}
					}
					else	//if there was only one tag in the string, check for the match
					{
						if(strtag == tagvalue)
		                {

	                        //build an array for the tag list
	                        ar_tag[int_tag] = strtag;
	                        int_tag++;                            
	                        
							//build and array of the idsuffixes that are found
	                        ar_hdtag[int_hdtag] = idsuffix;
	                        int_hdtag++;
	
							//build an array for the tag list	
		                    for(var arralltagid=0; arralltagid < arrallTag.length; arralltagid++)
					        {
	                            ar_alltag[int_alltag] = arrallTag[arralltagid];
	                            int_alltag++;
	                        }
	                        
	
                            for(var arrleveltagid=0; arrleveltagid < arrlevelTag.length; arrleveltagid++)
					        {
                                ar_leveltag[int_leveltag] = arrlevelTag[arrleveltagid];
                                int_leveltag++;
                            }

                            for(var arraudiencetagid=0; arraudiencetagid < arraudienceTag.length; arraudiencetagid++)
					        {
                                ar_audiencetag[int_audiencetag] = arraudienceTag[arraudiencetagid];
                                int_audiencetag++;
                            }

                            for(var arrcapabilitytagid=0; arrcapabilitytagid < arrcapabilityTag.length; arrcapabilitytagid++)
					        {
                                ar_capabilitytag[int_capabilitytag] = arrcapabilityTag[arrcapabilitytagid];
                                int_capabilitytag++;
                            }
                        
                            for(var arrpresentedbytagid=0; arrpresentedbytagid < arrpresentedbyTag.length; arrpresentedbytagid++)
					        {
                                ar_presentedbytag[int_presentedbytag] = arrpresentedbyTag[arrpresentedbytagid];
                                int_presentedbytag++;
                            }
	                                            
	                        
							idphts = 'phts' + colnumber + "d" + daynumber;                      //this is our time element placeholder

							originalcolnumber = idsuffix.substring(1,2);
							idphcol = 'wr_ph_maincolumncontent' + 'c' + originalcolnumber + "r" + rownumber + "d" + daynumber;    //this is our content element 
	
			                brk = document.getElementById("brk" + columncount + 'd' + daynumber);	//contains the break data
			                if(brk)
								brk.style.display="block";


			                document.getElementById(idphcol).innerHTML = document.getElementById(iddivcol).innerHTML;   //actual content element data
							
			                document.getElementById(idphts).style.display="block";
			                document.getElementById(idphcol).style.display="block";
			                
			                //we dump this into an array so when we clean up, we only clean up what we used.
							ar_ph[int_ph] = idphcol;            
			                int_ph++;
	
			                //increment rownumber so it matches the rowcount value.  We only do this when we have found a match.
							//we use the rownumber to keep track of howmany rows we need to fill in when there is no more data.
							rownumber++;
						
						}
					}//end of "if/else (arrTag.length > 1)"
				}//end of found == true
		
        }//end of for(var rowcount

        //build the rest of the rows layout
		//each time we enter this, it starts from the far left column so start incrementing from there

		if(rownumber > 0)	//if rownumber is greater than 1, then we found a match above.
		{
			if(rownumber <= maxrows)
			{
				for (var rn = rownumber; rn < maxrows; rn++)
				{
					try{
		                idphcol = 'wr_ph_maincolumncontent' + 'c' + colnumber + "r" + rn + "d" + daynumber;    //this is our content element placeholder
		                document.getElementById(idphcol).style.display="block";
		                
                		document.getElementById(idphcol).setAttribute("class", "MainColumnContentOuterLeftNoData_ph"); 
						document.getElementById(idphcol).setAttribute("className", "MainColumnContentOuterLeftNoData_ph"); 	//for IE
	                }
	                catch(err){}
				}
				//after we build the rows which build the column, then we can increment our column counter.
				colnumber++;

			}
		}
		else if(rownumber == 0)	//if rownumber is greater than 1, then we found a match above.
		{
			rownumber = rownumber++;
			if(rownumber <= maxrows)
			{
				for (var rn = rownumber; rn < maxrows; rn++)
				{
					try{

	                idphcol = 'wr_ph_maincolumncontent' + 'c' + colnumber + "r" + rn + "d" + daynumber;    //this is our content element placeholder
	                document.getElementById(idphcol).style.display="block";
	                
            		document.getElementById(idphcol).setAttribute("class", "MainColumnContentOuterLeftNoData_ph"); 
					document.getElementById(idphcol).setAttribute("className", "MainColumnContentOuterLeftNoData_ph"); 	//for IE
	                }
	                catch(err){}
				}
				//after we build the rows which build the column, then we can increment our column counter.
				colnumber++;

			}
		}


    }//end of columncount loop
    
//////////////////////////////////////////////////////////////////////////////////////////
//create the rest of the columns to fill out the grid


	//build out the rest of the columns.
	var truecount = 0;
	if(colnumber <= maxcols)
	{
        for(var colcount = colnumber; colcount < maxcols + 1; colcount++)
        {

        	try{
        	    idphts = 'phts' + colcount + "d" + daynumber;                      //this is our time element placeholder

        	    document.getElementById(idphts).style.display="block";
                brk = document.getElementById("brk" + colcount + 'd' + daynumber);	//contains the break data
                if(brk)
					brk.style.display="block";

        	    //document.getElementById(idphts).innerHTML = "<span class='TimeHeaderPlaceHolder'>SharePoint</span>";
        	    truecount++;
        	}
        	catch(err){}
			
			for (var rn = 1; rn < maxrows; rn++)
			{
				try{
                idphcol = 'wr_ph_maincolumncontent' + 'c' + colcount + "r" + rn + "d" + daynumber;    //this is our content element placeholder
                document.getElementById(idphcol).style.display="block";

        		document.getElementById(idphcol).setAttribute("class", "MainColumnContentOuterLeftNoData_ph"); 
				document.getElementById(idphcol).setAttribute("className", "MainColumnContentOuterLeftNoData_ph"); 	//for IE                
                }
                catch(err){}
			}
		}
	}
	
	
ar_newtag = ar_hdtag;

//display the new tag contents
var myArray = ar_tag;
var results = new Array();
//for the groups
for (var j=0; j<myArray.length; j++) 
{
    var key = myArray[j].toString(); // make it an associative array
    if (!results[key]) 
        results[key] = 1
    else
        results[key] = results[key] + 1;
}

	
var myArrayall = ar_alltag;
var resultsall = new Array();
//for keywords
for (var j=0; j<myArrayall.length; j++) 
{
    var keyall = myArrayall[j].toString(); // make it an associative array
    if (!resultsall[keyall]) 
        resultsall[keyall] = 1
    else
        resultsall[keyall] = resultsall[keyall] + 1;
}

var myArraylevel = ar_leveltag;
var resultslevel = new Array();

for (var j=0; j<myArraylevel.length; j++) 
{
    var keylevel = myArraylevel[j].toString(); // make it an associative array
	    if (!resultslevel[keylevel]) 
	        resultslevel[keylevel] = 1
	    else
	        resultslevel[keylevel] = resultslevel[keylevel] + 1;

}


var myArrayaudience = ar_audiencetag;
var resultsaudience = new Array();

for (var j=0; j<myArrayaudience.length; j++) 
{
    var keyaudience = myArrayaudience[j].toString(); // make it an associative array
    if (!resultsaudience[keyaudience]) 
        resultsaudience[keyaudience] = 1
    else
        resultsaudience[keyaudience] = resultsaudience[keyaudience] + 1;
}

	                        	
var myArraycapability = ar_capabilitytag;
var resultscapability = new Array();
for (var j=0; j<myArraycapability.length; j++) 
{
    var keycapability = myArraycapability[j].toString(); // make it an associative array
    if (!resultscapability[keycapability]) 
        resultscapability[keycapability] = 1
    else
        resultscapability[keycapability] = resultscapability[keycapability] + 1;
}

var myArraypresentedby = ar_presentedbytag;

var resultspresentedby = new Array();
for (var j=0; j<myArraypresentedby.length; j++) 
{
    var keypresentedby = myArraypresentedby[j].toString(); // make it an associative array
    if (!resultspresentedby[keypresentedby]) 
        resultspresentedby[keypresentedby] = 1
    else
        resultspresentedby[keypresentedby] = resultspresentedby[keypresentedby] + 1;
}


strinnerhtml = "<div style='clear:both;'></div>";
strinnerhtml = strinnerhtml + "<span class='SessionGroupTagTitle'>Audience:</span>";

var it = '0', dev = '0', arc = '0'
for (var tagname in resultsaudience) {
	switch(tagname.toLowerCase())
	{
		case 'it professional': 
			it = (resultsaudience[tagname] != ",") ? resultsaudience[tagname] : '0';
			break;
		case 'developer': 
			dev = (resultsaudience[tagname] != ",") ? resultsaudience[tagname] : '0';
			break;
	}
}	
strinnerhtml = strinnerhtml + "<span class='SessionTag' onclick=\"SearchSessionGroup('Audience','Developer','" + daynumber + "','" + dev + "');\"  >Developer(" + dev + ")</span>";
strinnerhtml = strinnerhtml + "<span class='SessionTag' onclick=\"SearchSessionGroup('Audience','IT Professional','" + daynumber + "','" + it + "');\"  >IT Professional(" + it + ")</span>";

strinnerhtml = strinnerhtml + "<div style='clear:both;'></div>";

strinnerhtml = strinnerhtml + "<span class='SessionGroupTagTitle'>Level:</span>";

var tag100 = '0', tag200 = '0', tag300 = '0', tag400 = '0'
for (var tagname in resultslevel) {
	switch(tagname)
	{
		case '100': 
			tag100 = (resultslevel[tagname] != ",") ? resultslevel[tagname] : '0';
			break;
		case '200': 
			tag200 = (resultslevel[tagname] != ",") ? resultslevel[tagname] : '0';
			break;
		case '300': 
			tag300 = (resultslevel[tagname] != ",") ? resultslevel[tagname] : '0';
			break;
		case '400': 
			tag400 = (resultslevel[tagname] != ",") ? resultslevel[tagname] : '0';
			break;						
	}
}	
strinnerhtml = strinnerhtml + "<span class='SessionTag' onclick=\"SearchSessionGroup('Level','100','" + daynumber + "','" + tag100 + "');\"  >100(" + tag100 + ")</span>";
strinnerhtml = strinnerhtml + "<span class='SessionTag' onclick=\"SearchSessionGroup('Level','200','" + daynumber + "','" + tag200 + "');\"  >200(" + tag200 + ")</span>";
strinnerhtml = strinnerhtml + "<span class='SessionTag' onclick=\"SearchSessionGroup('Level','300','" + daynumber + "','" + tag300 + "');\"  >300(" + tag300 + ")</span>";
strinnerhtml = strinnerhtml + "<span class='SessionTag' onclick=\"SearchSessionGroup('Level','400','" + daynumber + "','" + tag400 + "');\"  >400(" + tag400 + ")</span>";		


strinnerhtml = strinnerhtml + "<div style='clear:both;'></div>";

strtiptext = "";
strtiptext = strtiptext + "<b>Insights:</b>  Insights focuses on enabling Business Intelligence to empower your users with the right information to make starter, more relevant, business decisions.<br /><br />";
strtiptext = strtiptext + "<b>Composites:</b>  SharePoint Composites include the capabilities in SharePoint that allow people to rapidly create SharePoint applications with no-code tools, from SharePoint Designer and Workflow to Forms Services, Visio Services, and Access Services, and the ability to include external data through Business Connectivity Services.<br /><br />";
strtiptext = strtiptext + "<b>Search:</b>  Microsoft Search including SharePoint Search and FAST<br /><br />";
strtiptext = strtiptext + "<b>Content:</b>  Content covers everything under the Enterprise Content Management umbrella including Document Management, Records Management, Web Content Management, Rich Media Management and Document Output Management.<br /><br />";
strtiptext = strtiptext + "<b>Sites:</b>  SharePoint Sites covers information access and management across intranets, extranets, and the internet.<br /><br />";
strtiptext = strtiptext + "<b>Communities:</b>  SharePoint Communities allow your people to collaborate in groups, share knowledge and ideas, connect with colleagues, and find information and experts naturally. Features include team sites, My Site profiles, social tagging and bookmarking, enterprise wikis, blogs, and more!";

strinnerhtml = strinnerhtml + "<span class='SessionGroupTagTitleTip'>Capability:<p class='ToolTip'>" + strtiptext + "</p></span>";

var comm = '0', comp = '0',  cont = '0', ins = '0', sea = '0', sit = '0'
for (var tagname in resultscapability) {
	switch(tagname.toLowerCase())
	{
		case 'communities': 
			comm = (resultscapability[tagname] != ",") ? resultscapability[tagname] : '0';
			break;
		case 'composites': 
			comp = (resultscapability[tagname] != ",") ? resultscapability[tagname] : '0';
			break;
		case 'content': 
			cont = (resultscapability[tagname] != ",") ? resultscapability[tagname] : '0';
			break;			
		case 'insights': 
			ins = (resultscapability[tagname] != ",") ? resultscapability[tagname] : '0';
			break;
		case 'search': 
			sea = (resultscapability[tagname] != ",") ? resultscapability[tagname] : '0';
			break;
		case 'sites': 
			sit = (resultscapability[tagname] != ",") ? resultscapability[tagname] : '0';
			break;
	}
}
strinnerhtml = strinnerhtml + "<span class='SessionTag' onclick=\"SearchSessionGroup('Capability','Communities','" + daynumber + "','" + comm + "');\"  >Communities(" + comm + ")</span>";	
strinnerhtml = strinnerhtml + "<span class='SessionTag' onclick=\"SearchSessionGroup('Capability','Composites','" + daynumber + "','" + comp + "');\"  >Composites(" + comp + ")</span>";	
strinnerhtml = strinnerhtml + "<span class='SessionTag' onclick=\"SearchSessionGroup('Capability','Content','" + daynumber + "','" + cont + "');\"  >Content(" + cont + ")</span>";	
strinnerhtml = strinnerhtml + "<span class='SessionTag' onclick=\"SearchSessionGroup('Capability','Insights','" + daynumber + "','" + ins + "');\"  >Insights(" + ins + ")</span>";	
strinnerhtml = strinnerhtml + "<span class='SessionTag' onclick=\"SearchSessionGroup('Capability','Search','" + daynumber + "','" + sea + "');\"  >Search(" + sea + ")</span>";	
strinnerhtml = strinnerhtml + "<span class='SessionTag' onclick=\"SearchSessionGroup('Capability','Sites','" + daynumber + "','" + sit + "');\"  >Sites(" + sit + ")</span>";	
	

strinnerhtml = strinnerhtml + "<div style='clear:both;'></div>";
strinnerhtml = strinnerhtml + "<span class='SessionGroupTagTitle'>Presented By:</span>";

var anal = '0', cust = '0',  micr = '0', mvp = '0', part = '0'
for (var tagname in resultspresentedby) {
	switch(tagname.toLowerCase())
	{
		case 'analyst': 
			anal = (resultspresentedby[tagname] != ",") ? resultspresentedby[tagname] : '0';
			break;
		case 'customer': 
			cust = (resultspresentedby[tagname] != ",") ? resultspresentedby[tagname] : '0';
			break;
		case 'microsoft': 
			micr = (resultspresentedby[tagname] != ",") ? resultspresentedby[tagname] : '0';
			break;			
		case 'mvp': 
			mvp = (resultspresentedby[tagname] != ",") ? resultspresentedby[tagname] : '0';
			break;
		case 'partner': 
			part = (resultspresentedby[tagname] != ",") ? resultspresentedby[tagname] : '0';
			break;
	}
}	
strinnerhtml = strinnerhtml + "<span class='SessionTag' onclick=\"SearchSessionGroup('PresentedBy','Analyst','" + daynumber + "','" + anal + "');\"  >Analyst(" + anal + ")</span>";	
strinnerhtml = strinnerhtml + "<span class='SessionTag' onclick=\"SearchSessionGroup('PresentedBy','Customer','" + daynumber + "','" + cust + "');\"  >Customer(" + cust + ")</span>";	
strinnerhtml = strinnerhtml + "<span class='SessionTag' onclick=\"SearchSessionGroup('PresentedBy','Microsoft','" + daynumber + "','" + micr + "');\"  >Microsoft(" + micr + ")</span>";	
strinnerhtml = strinnerhtml + "<span class='SessionTag' onclick=\"SearchSessionGroup('PresentedBy','MVP','" + daynumber + "','" + mvp + "');\"  >MVP(" + mvp + ")</span>";	
strinnerhtml = strinnerhtml + "<span class='SessionTag' onclick=\"SearchSessionGroup('PresentedBy','Partner','" + daynumber + "','" + part + "');\"  >Partner(" + part + ")</span>";	

strinnerhtml = strinnerhtml + "<div style='clear:both;'><br /></div>";


strinnerhtml = strinnerhtml + "<div><span class='SessionGroupTagTitle'>Keywords</span><br /></div><div style='clear:both;'></div>";

for (var tagnameall in resultsall) {
    strinnerhtml = strinnerhtml + "<span class='SessionTag' onclick=\"SearchSessionGroup('Tags','" + tagnameall + "','" + daynumber + "','" + resultsall[tagnameall] + "');\"  >" + tagnameall + "(" + resultsall[tagnameall] +")</span>";
}

var strcrumbhtml = "";
ar_crumb.sort();
var newcrumb = "";
for (i=0;i<ar_crumb.length; i++) {
		if(ar_crumb[i] != newcrumb)
	    	strcrumbhtml = strcrumbhtml + "<span class='BreadCrumb'>[" + ar_crumb[i] + "]</span>";
	    		    
	    newcrumb = ar_crumb[i];	
}
         
document.getElementById("ph_taglistd" + daynumber).innerHTML = strinnerhtml;
document.getElementById("ph_taglistd" + daynumber).style.display = 'block';
document.getElementById("clearfilterd" + daynumber).style.display = 'block';
document.getElementById("idbreadcrumb").innerHTML = strcrumbhtml;
document.getElementById("idbreadcrumb").style.display = 'block';



}//end of function


function ClearPlaceHolderData(daynumber, maxcols, maxrows, ar_ph)
{

	//hide the time header display
    for(var columncount = 1; columncount < maxcols + 1; columncount++){
        try{
            document.getElementById('phts' + columncount + 'd' + daynumber).innerHTML = "";
        }
        catch(err){}
    }

    for(var columncount = 1; columncount < maxcols + 1; columncount++)
    {

	    for(var rowcount = 1; rowcount < maxrows+1; rowcount++)	
			{
	        	try{
					document.getElementById("wr_maincolumncontentc" + columncount + "r" + rowcount + "d" + daynumber).style.display="none";
				}
				catch(err){}
			}
	}

	for(var i = 0; i < ar_ph.length; i++)
	{		
		//clearing out any existing html from our placeholders
		document.getElementById(ar_ph[i]).innerHTML = "";
		
		//setting the placeholders back to being hidden
		document.getElementById(ar_ph[i]).style.display="none";
	}		
}
