﻿// This Function has been designed for the demo of the Skinning
    function hideIFrameShowWidgets()
    {
        if(document.getElementById('SkinningAppliedWidgets1') != null)
            document.getElementById('SkinningAppliedWidgets1').style.display = 'block';
        if(document.getElementById('showPageIframe') != null)
            document.getElementById('showPageIframe').style.display = 'none';
        if(document.getElementById('showPage') != null)
            document.getElementById('showPage').style.display = 'none';
         
            
            
        document.getElementById("menuStartPage").className = "current";
        document.getElementById("menuCalendar").className = "";         
        
    }   
// to open event calendar in the iframe
function show_EventCalendar_Iframe1(myEventId)
{
var urlValue="";
var strUrl=WidgetHandler.GetPageUrlFromPageId(430);
if(strUrl!="")
urlValue=strUrl.value+"?EId="+myEventId;
loadintoIframe('showPageIframe', urlValue, "EVENT KALENDAR");
}
function loadintoIframe(iframeid, url, myHeading){
    if (document.getElementById)
    { 
        myUrl = url;
        document.getElementById("menuStartPage").className = "";
        document.getElementById("menuCalendar").className = "current";
        document.getElementById('SkinningAppliedWidgets1').style.display = 'none';
        document.getElementById(iframeid).style.display = 'block';        
        document.getElementById(iframeid).src=url;        
    }
}


//event mouse hover//
function showOverEffect(obj)
{
    obj.style.cursor="pointer";
    var cssName = obj.className;
    var cssNames = cssName.split(' ');
    if(cssNames.length > 0)
    {
        obj.className = cssNames[0] + ' mouseHover';
    }   
}

function showOutEffect(obj)
{
    obj.style.cursor="";
    var cssName = obj.className;
    var cssNames = cssName.split(' ');
    if(cssNames.length > 0)
    {
        if(cssNames[0] == 'details1')
        obj.className = cssNames[0] + ' mouseOutOdd';
        else
        obj.className = cssNames[0] + ' mouseOutEven';
    }    
}
    function PersistColorChangesOnAsyncPostBack()
    {
        document.getElementById('LoginView1_DivLoginView1_txtWidFooterFontColor').style.background = document.getElementById('LoginView1_txtWidFooterFontColor').value;
        document.getElementById('LoginView1_DivLoginView1_txtWidFooterBGColor').style.background = document.getElementById('LoginView1_txtWidFooterBGColor').value;
        document.getElementById('LoginView1_DivLoginView1_txtContentBGColor').style.background = document.getElementById('LoginView1_txtContentBGColor').value;
        document.getElementById('LoginView1_DivLoginView1_txtActiveColor').style.background = document.getElementById('LoginView1_txtActiveColor').value;
        document.getElementById('LoginView1_DivLoginView1_txtSecondaryTextColor').style.background = document.getElementById('LoginView1_txtSecondaryTextColor').value;
        document.getElementById('LoginView1_DivLoginView1_txtTextColor').style.background = document.getElementById('LoginView1_txtTextColor').value;
        document.getElementById('LoginView1_DivLoginView1_txtSiteBGColor').style.background = document.getElementById('LoginView1_txtSiteBGColor').value;
        document.getElementById('LoginView1_DivLoginView1_txtWidFooterAlternateFontColor').style.background = document.getElementById('LoginView1_txtWidFooterAlternateFontColor').value;
        document.getElementById('LoginView1_DivLoginView1_txtWidFooterAlternateBGColor').style.background = document.getElementById('LoginView1_txtWidFooterAlternateBGColor').value;
        
        
    }
    function CheckIfUserModifyingPublishedTheme()
    {
        var themeDropdown = document.getElementById("LoginView1_ddl_themes");
        var selThemeName =themeDropdown[themeDropdown.selectedIndex].text;
        var curThemeName;
        var a = document.getElementById('LoginView1_txtNewThemeName');
        if(a.style.display != 'block')
        {
            curThemeName  = "<%# currentThemeNameToDisplay %>";           
            if(curThemeName == selThemeName) 
            {               
                if(confirm("This is your published theme. Saving the setting will affect public end as well.\n                      Do you want to continue?"))
                {
                    ClickHandler.SetSaveCurrentTheme(true);    
                }
                else
                {
                    ClickHandler.SetSaveCurrentTheme(false);
                }
            }           
        }
    }
    // Main Function starts
function reflectSkinWithoutCSSFiles(fieldName,restore,initialColor)
{  
  if(document.getElementById('LoginView1_DivLoginView1_txtWidFooterFontColor') != null)
  {
    if(fieldName == null)
    {
        changeBodyBackgroundImage();
        changeSiteBGColor(restore,initialColor);
        changeContentBGColor(restore,initialColor);        
        applyWidgetFooterBGColor(restore,initialColor);
        applyWidgetFooterTextColor(restore,initialColor);
        applyActiveColor(restore,initialColor);
        changeSecondaryTextColor(restore,initialColor);
        changeAlternateBGColor(restore,initialColor);
        changeAlternateTextColor(restore,initialColor);
        applyTextColor(restore,initialColor);
    }
    else
    {
        switch(fieldName)
        {
         case 'LoginView1_txtSiteBGColor':
         changeSiteBGColor(restore,initialColor);
         break;
         case 'LoginView1_txtWidFooterFontColor':
         applyWidgetFooterTextColor(restore,initialColor);
         break;
         case 'LoginView1_txtWidFooterBGColor':
         applyWidgetFooterBGColor(restore,initialColor);
         break;
         case 'LoginView1_txtContentBGColor':
         changeContentBGColor(restore,initialColor);        
         break;
         case 'LoginView1_txtActiveColor':
         applyActiveColor(restore,initialColor);
         break;
         case 'LoginView1_txtSecondaryTextColor':
         changeSecondaryTextColor(restore,initialColor);
         break;
         case 'LoginView1_txtWidFooterAlternateBGColor':
         changeAlternateBGColor(restore,initialColor);
         break;
         case 'LoginView1_txtWidFooterAlternateFontColor':
         changeAlternateTextColor(restore,initialColor);
         break;
         case 'LoginView1_txtTextColor':
         applyTextColor(restore,initialColor);
         break;         
        }
     }
  }
}
// Main Function ends


// Second Level Function Starts
function applyTextColor(restore,initialColor)
{
 var textColorElements = document.getElementsByClassName('black');
 for(var i=0;i<textColorElements.length;i++)
 {
    if(restore == false)
        textColorElements[i].style.color = document.getElementById('LoginView1_DivLoginView1_txtTextColor').style.background;
    else
        textColorElements[i].style.color = initialColor;
 }
 var textColorElements1 = document.getElementsByClassName('comment');
 for(var i=0;i<textColorElements1.length;i++)
 {
    if(restore == false)
        textColorElements1[i].style.color = document.getElementById('LoginView1_DivLoginView1_txtTextColor').style.background;
    else
        textColorElements1[i].style.color = initialColor;
 }
 var textColorElements2 = document.getElementsByClassName('SubContentDes');
 for(var k=0;k<textColorElements2.length;k++)
 {
    if(restore==false)
        textColorElements2[k].style.color = document.getElementById('LoginView1_DivLoginView1_txtTextColor').style.background;
    else
        textColorElements2[k].style.colo = initialColor;
 }
}
function changeAlternateBGColor(restore,initialColor)
{
   var alternateBG = document.getElementsByClassName('details2');
   for(var i=0;i<alternateBG.length;i++)
   {
    if(restore == false)
        alternateBG[i].style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtWidFooterAlternateBGColor').style.background;
    else
        alternateBG[i].style.backgroundColor = initialColor;
   }   
}
function changeAlternateTextColor(restore,initialColor)
{
    var alternateText;
    alternateText = document.getElementsByClassName('details1');
    repeatApplyAlternateTextColor(alternateText,restore,initialColor,"1");
    alternateText = document.getElementsByClassName('details2');
    repeatApplyAlternateTextColor(alternateText,restore,initialColor,"2");   
    changeMenuAlternateTextcolor(restore,initialColor); 
      
}
function changeMenuAlternateTextcolor(restore,initialColor)
{
    var menuItemText = document.getElementsByClassName('nav');
        for(var i=0;i<menuItemText.length;i++)
        {
            var LIs = menuItemText[i].getElementsByTagName('LI');
            for(var j=0;j<LIs.length;j++)
            {
                var As = LIs[j].getElementsByTagName('A');
                for(var k=0;k<As.length;k++)
                {     
                  if(As[i].className != "current")
                  {
                    if(restore==false)
                    {        
                        As[k].onmouseover = function ()
                        {
                            this.style.backgroundColor =document.getElementById('LoginView1_DivLoginView1_txtActiveColor').style.background ;
                            this.style.color = document.getElementById('LoginView1_DivLoginView1_txtWidFooterAlternateFontColor').style.background ;
                        
                        }
                        As[k].onmouseout = function ()
                        {
                            this.style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtWidFooterBGColor').style.background ;
                            this.style.color = document.getElementById('LoginView1_DivLoginView1_txtWidFooterFontColor').style.background ;                        
                        }                  
                    }
                    else
                    {                   
                    // No need to do anything here.
                    }
                  }  
                }
                    
             }
        }     
}
function repeatApplyAlternateTextColor(alternateText,restore,initialColor,row)
{
    for(var i=0;i<alternateText.length;i++)
    {     
        if(restore==false)
        {                 
            alternateText[i].onmouseover = function ()
            {
                 this.style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtActiveColor').style.background;
                 this.style.color = document.getElementById('LoginView1_DivLoginView1_txtWidFooterAlternateFontColor').style.background;
            } 
            alternateText[i].onmouseout = function ()
            {
                this.style.color = document.getElementById('LoginView1_DivLoginView1_txtWidFooterFontColor').style.background;
                if(row == "1")
                    this.style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtWidFooterBGColor').style.background;
                else
                    this.style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtWidFooterAlternateBGColor').style.background;
            }  
        }
        else
        {
        // no need to do anything i think 
        }
    }
}
function changeBodyBackgroundImage()
{
var chkEnableBGImg = document.getElementById('LoginView1_chkEnableSiteBGImage');
var selectImages = document.getElementById('LoginView1_ddl_Images');
  if(chkEnableBGImg != null && selectImages != null)
  {
    var siteSubFolder = ClickHandler.getProjectSubFolder().value;
    if(chkEnableBGImg.checked == true)
    {   
        document.body.style.backgroundImage = "url('../Styles/FryshusetSubSite_stylesheet/Skins/" + siteSubFolder + "/SiteBackgroundImages/" + selectImages[selectImages.selectedIndex].value+ "')"    
    }
    else
    {
        document.body.style.backgroundImage = "url('../Styles/FryshusetSubSite_stylesheet/Skins/" + siteSubFolder + "/SiteBackgroundImages/" + selectImages[selectImages.selectedIndex].value+ "+_NotEnabledByUserNow')"    
    }    
  }
}

function changeSiteBGColor(restore,initialColor)
{
    if(restore==false)
        document.body.style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtSiteBGColor').style.background;
    else
        document.body.style.backgroundColor = initialColor;              
}

function changeContentBGColor(restore,initialColor)
{   
    var subContentDiv = document.getElementsByClassName('wrapperProject'); 
    for(var i=0;i<subContentDiv.length;i++)
    {
        if(restore==false)
            subContentDiv[i].style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtContentBGColor').style.background;
        else
            subContentDiv[i].style.backgroundColor = initialColor; 
     }
}

function applyWidgetFooterBGColor(restore,initialColor)
{
    changeWidgetFooterBackgroundColor(restore,initialColor);
    changeMenusBackgroundColor(restore,initialColor);
    changeLoginButtonBackground(restore,initialColor);
    changeCalendarBackground(restore,initialColor);
}

function applyWidgetFooterTextColor(restore,initialColor)
{
    changeWidgetFooterTextColor(restore,initialColor);    
    changeLoginTextColor(restore,initialColor);
    
    changeMenuTextColor(restore,initialColor);
    changeTextColorInCalendar(restore,initialColor);
}

function applyActiveColor(restore,initialColor)
{
    
    changeTopMenuBottomBorderColor(restore,initialColor);
    changeButtonBackgroundColor(restore,initialColor);
    changeSearchBoxBackgroundColor(restore,initialColor);
    changeWidgetHeaderBGColor(restore,initialColor);
    changeMenuHoverColor(restore,initialColor);
    changeCurrentMenuItemColor(restore,initialColor);
    changeHoverOnEventCalendar(restore,initialColor);
    changeTopLinkTextColor(restore,initialColor);
}

function changeSecondaryTextColor(restore,initialColor)
{
    changeSearchBoxTextColor(restore,initialColor);
    changeButtonTextColor(restore,initialColor);
    var secondaryTextEle = document.getElementsByClassName('dateRight'); 
    if(restore==false)
    {
        for(var i=0;i<secondaryTextEle.length;i++)           
        secondaryTextEle[i].style.color =  document.getElementById('LoginView1_DivLoginView1_txtSecondaryTextColor').style.background;  
    }
     else
     {
        for(var i=0;i<secondaryTextEle.length;i++)           
        secondaryTextEle[i].style.color =  initialColor; 
     }
     
     var eventDate = document.getElementsByClassName('gray');
     if(restore==false)
    {
        for(var i=0;i<eventDate.length;i++)           
        eventDate[i].style.color =  document.getElementById('LoginView1_DivLoginView1_txtSecondaryTextColor').style.background;  
    }
     else
     {
        for(var i=0;i<eventDate.length;i++)           
        eventDate[i].style.color =  initialColor; 
     } 
     var widgetHeaders = document.getElementsByClassName('widgetTitle');
     for(var k=0;k<widgetHeaders.length;k++)
     {
        if(restore==false)
            widgetHeaders[k].style.color = document.getElementById('LoginView1_DivLoginView1_txtSecondaryTextColor').style.background;  
        else
            widgetHeaders[k].style.color = initialColor;
     }
     
}

// Second Level Function ends

// Third Level Function Starts
function changeWidgetFooterBackgroundColor(restore,initialColor)
{
    var widFooterBG = document.getElementsByClassName('widgetColor'); 
    if(restore==false)
    {
    for(var i=0;i<widFooterBG.length;i++)    
        widFooterBG[i].style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtWidFooterBGColor').style.background;
    }
    else
    {
        for(var i=0;i<widFooterBG.length;i++)    
        widFooterBG[i].style.backgroundColor = initialColor; 
    }

    var widFooterBGTop = document.getElementsByClassName('widgetColor'); 
    if(restore==false)
    {
    for(var i=0;i<widFooterBGTop.length;i++)    
        widFooterBGTop[i].style.backgroundColor =document.getElementById('LoginView1_DivLoginView1_txtWidFooterBGColor').style.background;
     }
     else
     {
        for(var i=0;i<widFooterBGTop.length;i++)    
        widFooterBGTop[i].style.backgroundColor =initialColor; 
     }  
     
     var widFooterLeft = document.getElementsByClassName('banImg');
     for(var k =0; k<widFooterLeft.length;k++)
     {
        if(restore==false)
            widFooterLeft[k].style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtWidFooterBGColor').style.background;
        else  
            widFooterLeft[k].style.backgroundColor = initialColor;
        
     }     
}
function changeMenusBackgroundColor(restore,initialColor)
{  
    var menuBGColor = document.getElementsByClassName('nav');
    if(restore==false)
    {
        for(var i=0;i<menuBGColor.length;i++)
        menuBGColor[i].style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtWidFooterBGColor').style.background;
    }
    else
    {
        for(var i=0;i<menuBGColor.length;i++)
        menuBGColor[i].style.backgroundColor = initialColor; 
    }   
}
function changeCalendarBackground(restore,initialColor)
{
var eventBG;
    eventBG = document.getElementsByClassName('details1');
    repeatApplyCalendarBackgroundColor(eventBG,restore,initialColor,"1");    
}
function repeatApplyCalendarBackgroundColor(eventBG,restore,initialColor,row)
{
    for(var j=0;j<eventBG.length;j++)
    {
    if(restore==false)
    {
        eventBG[j].style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtWidFooterBGColor').style.background;
        eventBG[j].onmouseover= function ()
        {
           this.style.backgroundColor =  document.getElementById('LoginView1_DivLoginView1_txtActiveColor').style.background;
           this.style.color = document.getElementById('LoginView1_DivLoginView1_txtWidFooterAlternateFontColor').style.background;
           
        }
        eventBG[j].onmouseout = function()
        {
            this.style.color = document.getElementById('LoginView1_DivLoginView1_txtWidFooterFontColor').style.background;    
            
            if(row == "1")
                this.style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtWidFooterBGColor').style.background;
            else
                this.style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtWidFooterAlternateBGColor').style.background;                       
        }
     }   
     
    else
        eventBG[j].style.backgroundColor = initialColor;
    }

}

function changeLoginButtonBackground(restore,initialColor)
{
    var loginButtonBG = document.getElementsByClassName('submitBtn');
    if(restore==false)
    {
    for(var i=0;i<loginButtonBG.length;i++)    
        loginButtonBG[i].style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtWidFooterBGColor').style.background;
    }
    else
    {
    for(var i=0;i<loginButtonBG.length;i++)    
        loginButtonBG[i].style.backgroundColor =  initialColor; 
    }
}

function changeWidgetFooterTextColor(restore,initialColor)
{
    var widFooterTexts = document.getElementsByClassName('widgetColor'); 
    if(restore==false)
    {    
        for(var i=0;i<widFooterTexts.length;i++) 
        widFooterTexts[i].style.color = document.getElementById('LoginView1_DivLoginView1_txtWidFooterFontColor').style.background;
    }
    else
    {
        for(var i=0;i<widFooterTexts.length;i++) 
        widFooterTexts[i].style.color =  initialColor;  
    }
    var widFooterTextsTop = document.getElementsByClassName('widgetColor');    
    if(restore==false)
    {
    for(var i=0;i<widFooterTextsTop.length;i++)
        widFooterTextsTop[i].style.color =document.getElementById('LoginView1_DivLoginView1_txtWidFooterFontColor').style.background;
    }
    else
    {
        for(var i=0;i<widFooterTextsTop.length;i++)
        widFooterTextsTop[i].style.color = initialColor;  
    }
}

function changeButtonTextColor(restore,initialColor)
{
    var btnTexts = document.getElementsByClassName('banSubBtn'); 
    if(restore==false)
    {
    for(var i=0;i<btnTexts.length;i++)
        btnTexts[i].style.color = document.getElementById('LoginView1_DivLoginView1_txtSecondaryTextColor').style.background;  
    }
    else
    {
    for(var i=0;i<btnTexts.length;i++)
        btnTexts[i].style.color =  initialColor;  
    }
}

function changeLoginTextColor(restore,initialColor)
{
    var loginButton = document.getElementsByClassName('submitBtn');         
    if(restore == false)
    {
    for(var i=0;i<loginButton.length;i++)  
        loginButton[i].style.color = document.getElementById('LoginView1_DivLoginView1_txtWidFooterFontColor').style.background;  
    }
    else
    {
     for(var i=0;i<loginButton.length;i++)  
        loginButton[i].style.color = initialColor;  
    }
}

function changeSearchBoxTextColor(restore,initialColor)
{
    var searchText = document.getElementsByClassName('searchBox');
    if(restore == false)
    {
        for(var i=0;i<searchText.length;i++)
        searchText[i].style.color = document.getElementById('LoginView1_DivLoginView1_txtSecondaryTextColor').style.background;
    }
    else
    {
        for(var i=0;i<searchText.length;i++)
        searchText[i].style.color = initialColor;  
    }
}


function changeCurrentMenuItemColor(restore,initialColor)
{
var curMenuItem = document.getElementsByClassName('current');
    if(restore==false)
    {
        for(var i= 0;i<curMenuItem.length;i++)
        curMenuItem[i].style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtActiveColor').style.background;
    }
    else
    {
        for(var i= 0;i<curMenuItem.length;i++)
        curMenuItem[i].style.backgroundColor =  initialColor;  
    }
}
function changeTopLinkTextColor(restore,initialColor)
{
    var topLinks = document.getElementsByClassName('supMenu');
    for(var i=0;i<topLinks.length;i++)
    {
        var ULs = topLinks[i].getElementsByTagName('UL');
        for(var j=0;j<ULs.length;j++)
        {
            var LIs = ULs[j].getElementsByTagName('LI');
            for(var k=0;k<LIs.length;k++)
            {
                var As = LIs[k].getElementsByTagName('A');
                for(var l =0;l<As.length;l++)
                {                
                    if(restore==false) 
                        As[l].style.color = document.getElementById('LoginView1_DivLoginView1_txtActiveColor').style.background;                                           
                    else
                        As[l].style.color = initialColor;
                }                
            }
        }
    }
}
function changeHoverOnEventCalendar(restore,initialColor)
{
    var alternateText;
    alternateText = document.getElementsByClassName('details1');
    repeatApplyHoverInCalendar(restore,initialColor,alternateText,"1");
    alternateText = document.getElementsByClassName('details2');
    repeatApplyHoverInCalendar(restore,initialColor,alternateText,"2");    
}
function repeatApplyHoverInCalendar(restore,initialColor,alternateText,row)
{
    for(var i=0;i<alternateText.length;i++)
    {     
        if(restore==false)
        {  
            alternateText[i].onmouseover = function ()
            {
                this.style.color = document.getElementById('LoginView1_DivLoginView1_txtWidFooterAlternateFontColor').style.background;
                this.style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtActiveColor').style.background;
            } 
            alternateText[i].onmouseout = function ()
            {
                this.style.color = document.getElementById('LoginView1_DivLoginView1_txtWidFooterFontColor').style.background;
                if(row =="1")
                    this.style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtWidFooterBGColor').style.background;
                else
                   this.style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtWidFooterAlternateBGColor').style.background;
            }  
        }
        else
        {
        // no need to do anything i think 
        }
    }
}
function changeMenuHoverColor(restore,initialColor)
{
        var menuItemText = document.getElementsByClassName('nav');
        for(var i=0;i<menuItemText.length;i++)
        {
            var LIs = menuItemText[i].getElementsByTagName('LI');
            for(var j=0;j<LIs.length;j++)
            {
                var As = LIs[j].getElementsByTagName('A');
                for(var k=0;k<As.length;k++)
                {     
                  if(As[i].className != "current")
                  {
                    if(restore==false)
                    {        
                        As[k].onmouseover = function ()
                        {
                            this.style.backgroundColor =document.getElementById('LoginView1_DivLoginView1_txtActiveColor').style.background ;
                            this.style.color = document.getElementById('LoginView1_DivLoginView1_txtWidFooterAlternateFontColor').style.background ;
                        
                        }
                        As[k].onmouseout = function ()
                        {
                            this.style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtWidFooterBGColor').style.background ;
                            this.style.color = document.getElementById('LoginView1_DivLoginView1_txtWidFooterFontColor').style.background ;                        
                        }                  
                    }
                    else
                    {                   
                    // No need to do anything here.
                    }
                  }  
                }
                    
             }
        } 
}
function changeMenuTextColor(restore,initialColor)
{
    var menuItemText = document.getElementsByClassName('nav');
    for(var i=0;i<menuItemText.length;i++)
    {
        var LIs = menuItemText[i].getElementsByTagName('LI');
        for(var j=0;j<LIs.length;j++)
        {
            var As = LIs[j].getElementsByTagName('A');
            for(var k=0;k<As.length;k++)
            {
                if(restore==false)
                    As[k].style.color = document.getElementById('LoginView1_DivLoginView1_txtWidFooterFontColor').style.background;                                     
                else
                    As[k].style.color = initialColor; 
            }
                
         }
   }
}
function changeTextColorInCalendar(restore,initialColor)
{
    var dateInCalendar = document.getElementsByClassName('kalenderaa');
    for(var j=0;j<dateInCalendar.length;j++)
    {   
        var shortDate = dateInCalendar[j].getElementsByClassName('gray');
        for(var k=0;k<shortDate.length;k++)      
        {
            if(restore==false)
            {
                shortDate[k].style.color = document.getElementById('LoginView1_DivLoginView1_txtWidFooterFontColor').style.background;;
            }
            else
            {
                shortDate[k].style.color = initialColor;
            }
        }    
    }
    var eventText;
    eventText = document.getElementsByClassName('details1');
    repeatApplyCalendarTextColor(eventText,restore,initialColor,"1");
    eventText = document.getElementsByClassName('details2');
    repeatApplyCalendarTextColor(eventText,restore,initialColor,"2");
}
function repeatApplyCalendarTextColor(eventText,restore,initialColor,row)
{
    for(var j=0;j<eventText.length;j++)
    {
    if(restore==false)
    {
        eventText[j].style.color = document.getElementById('LoginView1_DivLoginView1_txtWidFooterFontColor').style.background;
        eventText[j].onmouseover= function ()
        {
           this.style.backgroundColor =  document.getElementById('LoginView1_DivLoginView1_txtActiveColor').style.background;
           this.style.color = document.getElementById('LoginView1_DivLoginView1_txtWidFooterAlternateFontColor').style.background;
           
        }
        eventText[j].onmouseout = function()
        {
            this.style.color = document.getElementById('LoginView1_DivLoginView1_txtWidFooterFontColor').style.background;    
            
            if(row == "1")
                this.style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtWidFooterBGColor').style.background;
            else
                this.style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtWidFooterAlternateBGColor').style.background;                       
        }
     }   
     
    else
        eventText[j].style.color = initialColor;
    }

}

function changeWidgetHeaderBGColor(restore,initialColor)
{
        var BigwidHeaderBG = document.getElementsByClassName('widgetBig');
        for(var i=0;i<BigwidHeaderBG.length;i++)
        {  
            var H2s = BigwidHeaderBG[i].getElementsByTagName('H2');
            for(var j=0;j<H2s.length;j++)
            {
            if(restore==false)            
                H2s[j].style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtActiveColor').style.background;
            else
                H2s[j].style.backgroundColor =  initialColor; 
            }
        }  
        
        var SmallwidHeaderBG = document.getElementsByClassName('widgetSmall');
        for(var i=0;i<SmallwidHeaderBG.length;i++)
        {  
            var H2s = SmallwidHeaderBG[i].getElementsByTagName('H2');
            for(var j=0;j<H2s.length;j++)
            {
            if(restore==false)            
                H2s[j].style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtActiveColor').style.background;
            else
                H2s[j].style.backgroundColor =   initialColor; 
            }
        }  
        
         var SidewidHeaderBG = document.getElementsByClassName('widgetSmallSide');
        for(var i=0;i<SidewidHeaderBG.length;i++)
        {  
            var H2s = SidewidHeaderBG[i].getElementsByTagName('H2');
            for(var j=0;j<H2s.length;j++)
            {
            if(restore==false)
                H2s[j].style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtActiveColor').style.background;
            else
                H2s[j].style.backgroundColor = initialColor; 
            }
        }  
}

function changeSearchBoxBackgroundColor(restore,initialColor)
{
    var searchBoxBG = document.getElementsByClassName('searchBox');
    if(restore==false)
    {
    for(var i=0;i<searchBoxBG.length;i++)    
        searchBoxBG[i].style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtActiveColor').style.background;
    }
    else
    {
    for(var i=0;i<searchBoxBG.length;i++)    
        searchBoxBG[i].style.backgroundColor = initialColor; 
    }       
}





function changeButtonBackgroundColor(restore,initialColor)
{
    var buttonBGColor = document.getElementsByClassName('banSubBtn');
    if(restore==false)
    {
        for(var i=0;i<buttonBGColor.length;i++)
        buttonBGColor[i].style.backgroundColor = document.getElementById('LoginView1_DivLoginView1_txtActiveColor').style.background;
    }
    else
    {
     for(var i=0;i<buttonBGColor.length;i++)
        buttonBGColor[i].style.backgroundColor = initialColor; 
    }
     
}

function changeTopMenuBottomBorderColor(restore,initialColor)
{
    var menuBGColor = document.getElementsByClassName('nav');
    if(restore==false)
    {
    for(var i=0;i<menuBGColor.length;i++)    
        menuBGColor[i].style.borderColor = document.getElementById('LoginView1_DivLoginView1_txtActiveColor').style.background;   
    }
    else
    {
     for(var i=0;i<menuBGColor.length;i++)    
        menuBGColor[i].style.borderColor =  initialColor; 

    }
}
// Third level function ends
