function showTab( secId, secNum, secTotal )
{
	
	if ( secId == "C")
	{
	    document.location.href="Events.aspx";
	}
		
		
	for ( i = 1; i <= secTotal; i++ )
	{	
		if ( i == secNum )
		{
			document.getElementById("section" + secId + secNum).style.display = "block";
			document.getElementById("tab" + secId + secNum).className = "tabOn";
		}
		else
		{
			document.getElementById("section" + secId + i).style.display = "none";
			document.getElementById("tab" + secId + i).className = "tab";
		}
	}
	
}

function showTab2( secId, secNum, secTotal )
{
	for ( i = 1; i <= secTotal; i++ )
	{	
		if ( i == secNum )
		{
			document.getElementById("ctl00_ContentPlaceHolder1_section" + secId + secNum).style.display = "block";
			document.getElementById("tab" + secId + secNum).className = "tabOn";
		}
		else
		{
			document.getElementById("ctl00_ContentPlaceHolder1_section" + secId + i).style.display = "none";
			document.getElementById("tab" + secId + i).className = "tab";
		}
	}
}

function showTabWithResize( secId, secNum, secTotal, divName, divSize )
{
	for ( i = 1; i <= secTotal; i++ )
	{	
		if ( i == secNum )
		{
			document.getElementById("section" + secId + secNum).style.display = "block";
			document.getElementById("tab" + secId + secNum).className = "tabOn";
			document.getElementById(divName).style.height = divSize + "px";
		}
		else
		{
			document.getElementById("section" + secId + i).style.display = "none";
			document.getElementById("tab" + secId + i).className = "tab";
			document.getElementById(divName).style.height = divSize + "px";
		}
	}
}

function itemOn( elem )
{ elem.style.backgroundColor = "#EBF7F7";
}
function itemOff( elem )
{ elem.style.backgroundColor = "#F8FDFD";
}

function createCalendar( title, monthNum, yearNum, numDays )
{ var startDay = 0;
  var d = new Date();
  d.setMonth( monthNum );
  d.setDate( 1 );
  d.setFullYear( yearNum );
  startDay = d.getUTCDay();
  var boxCount = 0;
  var i = 0;
  var htmlString = "<caption>" + title + "</caption>\n<tr><th class=\"s\">Sun</th><th class=\"w\">Mon</th><th class=\"w\">Tue</th><th class=\"w\">Wed</th><th class=\"w\">Thu</th><th class=\"w\">Fri</th><th class=\"s\">Sat</th></tr>\n<tr>";
  for ( boxCount = 0; boxCount < startDay; boxCount++ )
  { htmlString += "<td class=\"d\">  </td>";
  }
  boxCount = startDay;
  for ( i = 1; i <= numDays; i++, boxCount++ )
  { if( boxCount % 7 == 0 )
    { htmlString += "<tr>";
    }
    if     ( boxCount % 7 == 0 )
    { htmlString += "<td class=\"s\">" + i + "</td>";
    }
    else if( boxCount % 7 == 6 )
    { htmlString += "<td class=\"s\">" + i + "</td></tr>\n";
    }
    else
    { htmlString += "<td class=\"w\">" + i + "</td>";
    }
  }
  boxCount %= 7;
  if( boxCount != 0 )
  { for( boxCount = boxCount; boxCount < 7; boxCount++ )
    { htmlString += "<td class=\"d\">  </td>";
    }
    htmlString += "</tr>\n";
  }
  document.write(htmlString);
}


function showHand(source) 
{
    source.style.cursor='pointer';
}

function showCursor(source) 
{
    source.style.cursor='auto';
}

function showAlbum(album, year) 
{
    document.location.href="Photos.aspx?Album=" + album + "&Year=" + year;
}


function showURL(url) 
{
    document.location.href=url;
}

function showPopUpURL(url, name) 
{
    window.open(url,name, "'menubar=no,scrollbars=no,resizable=no,toolbar=no,titlebar=no,location=no'","'replace=true'");
}


function showPopupEvent(typeId) 
{
    window.open("Popup.aspx?type=Event&typeId="+ typeId,"Event", "'menubar=no,scrollbars=yes,resizable=yes,toolbar=no,titlebar=no,location=no'","'replace=true'");
}

function itemUnderLineOn( elem )
{ 
   //elem.style.text-decoration = "underline";
}
function itemUnderLineOff( elem )
{ 
    //elem.style.text-decoration = "none";
}



// JScript source code

function cycle()
{
 var cycleVar = setTimeout( "rotateImage()", 5000 );
}

function cycleDefault()
{ 
 var cycleVar = setTimeout( "rotateImageDefault()", 5000 );
}


function showmenu(id)
{
document.getElementById(id).style.visibility="visible";
}
function hidemenu(id)
{
document.getElementById(id).style.visibility="hidden";
}



function rotateImage()
{

    var path;
    var begin;
    var newImgNum;
    var newRandNum;
    var oldRandNum;
    var imageNum;
    var maxImg = 3;
    do
    {
    newRandNum = Math.round( Math.random() * (maxImg - 1 ) ) + 1;
    } while ( oldRandNum == newRandNum );

    if ( newRandNum <= 9 ) { newImgNum = "0" + newRandNum; }
    else                   { newImgNum = newRandNum; }

    oldRandNum = newRandNum; 


    path = document.images['adsimage'].src;

    begin = path.indexOf('/main_ad/');
    begin =  path.substr(begin+16, 2);
    imageNum = Number(begin.valueOf());
    imageNum = imageNum + 1;

    //this is count for total of active ads
    if (imageNum > 3)
    {
        imageNum = 1;
    }
    
    if (imageNum < 10)
    {
        begin = "0" + imageNum;
    }
        
    document.images['adsimage'].src = "images/main_ad/adimage" + begin + ".jpg";
    

    if (imageNum == 1)
    {
        document.images['adsimage'].width = "75";
        document.images['adsimage'].height = "107";  
        document.getElementById('imageLink').href = "http://www.webster.com";
    }
    else if (imageNum == 2)
    {
        document.images['adsimage'].width = "75";
        document.images['adsimage'].height = "214";  
        document.getElementById('imageLink').href = "http://www.jampact.org";
 
    }
    else if (imageNum == 3)
    {
        document.images['adsimage'].width = "75";
        document.images['adsimage'].height = "107";  
        document.getElementById('imageLink').href = "http://www.jampact.org/anniversary";
    }
 
   document.images['spacer'].src = "images/web/spacer.gif";

}


function rotateImageDefault()
{

    var path;
    var begin;
    var newImgNum;
    var newRandNum;
    var oldRandNum;
    var imageNum;
    var maxImg = 3;
    do
    {
    newRandNum = Math.round( Math.random() * (maxImg - 1 ) ) + 1;
    } while ( oldRandNum == newRandNum );

    if ( newRandNum <= 9 ) { newImgNum = "0" + newRandNum; }
    else                   { newImgNum = newRandNum; }

    oldRandNum = newRandNum; 


    path = document.images['adsimageDefault'].src;

    begin = path.indexOf('/main_ad/Default/');
    begin =  path.substr(begin+31, 2);
    imageNum = Number(begin.valueOf());
    imageNum = imageNum + 1;

    //this is count for total of active ads
    if (imageNum > 2)
    {
        imageNum = 1;
    }
    
    if (imageNum < 10)
    {
        begin = "0" + imageNum;
    }
    

    
    document.images['adsimageDefault'].src = "images/main_ad/Default/adimageDefault" + begin + ".jpg";
    
    if (imageNum == 1)
    {
        document.images['adsimageDefault'].width = "100";
        document.images['adsimageDefault'].height = "285";  
        document.getElementById('imageLinkDefault').href = "http://www.jampact.org/anniversary";
    }
    else if (imageNum == 2)
    {
        document.images['adsimageDefault'].width = "100";
        document.images['adsimageDefault'].height = "143";  
        document.getElementById('imageLinkDefault').href = "http://www.jampact.org"; 
    }
 
   document.images['spacerDefault'].src = "images/web/spacer.gif";

}


function setFirstAd()
{
    document.images['adsimage'].src = "images/main_ad/adimage02.jpg";
    document.images['adsimage'].width = "75";
    document.images['adsimage'].height = "214";  
    document.getElementById('imageLink').href = "http://www.jampact.org/anniversary";
}

function setFirstAdDefault()
{
    document.images['adsimageDefault'].src = "images/main_ad/Default/adimageDefault01.jpg";
    document.images['adsimageDefault'].width = "100";
    document.images['adsimageDefault'].height = "285";  
    document.getElementById('imageLinkDefault').href = "http://www.jampact.org/anniversary";
}
