﻿var imgBlue = "#transparent url('images/tblue.gif')";
var imgRed = "#transparent url('images/tred.gif')";
var imgGreen = "#transparent url('images/tgreen.gif')";
var imgBlueRoll = "#transparent url('images/tblue_roll.gif')";
var imgRedRoll = "#transparent url('images/tred_roll.gif')";
var imgGreenRoll = "#transparent url('images/tgreen_roll.gif')";
//-----------------------------------------------------------------------------

function ChangeDivColor(color)
{
    //document.getElementById('divCP').style.backgroundColor = color;
    var header = document.getElementById("bg_clr");
    if(header != null)
        header.style.backgroundColor = color;
        
    var footer = document.getElementById("MainFooter");
    if(footer != null)
        footer.style.backgroundColor = color;
}

function GetCookieColor()
{
   if(GetCookie('HomeTheme') != null)
      ChangeDivColor(GetCookie('HomeTheme'));
}

function showtab(tabid,iconid,image, catName)
{
    document.getElementById(catName + '_tblue').style.display = "none";
    document.getElementById(catName + '_tred').style.display = "none";
    document.getElementById(catName + '_tgreen').style.display = "none";
    
    document.getElementById(catName + 'RedTab').style.background = imgRed;
    document.getElementById(catName + 'GreenTab').style.background =  imgGreen;
    document.getElementById(catName + 'BlueTab').style.background =  imgBlue;
    document.getElementById(tabid).style.display = "block";
    document.getElementById(iconid).style.background = image;
}
//--------------------------------------------------------------------------------------
//Function used to Resize the body, to be mih height as Browsers full height.
function ResizeBody(OffsetValue, IEOffsetValue)
{
    //Unactivating the function in certain pages (Articles, Books, Tools, MyProfile) for reason of dynamic height
    if(document.location.href.toLowerCase().indexOf("myprofile.aspx") == -1
        && document.location.href.toLowerCase().indexOf("articles.aspx") == -1 
        && document.location.href.toLowerCase().indexOf("books.aspx") == -1
        && document.location.href.toLowerCase().indexOf("tools.aspx") == -1)
    {    
	    var pageHeight;												//get current document height
	    var windowheight = window.screen.height;					//get resolution height
	    var innerHeight = document.documentElement.clientHeight;	//get browser's inner height
    			
	    if( window.innerHeight && window.scrollMaxY ) // Firefox 
	    { pageHeight = window.innerHeight + window.scrollMaxY; }
	    else if( document.body.scrollHeight > document.body.offsetHeight ) // all but Explorer Mac
	    { pageHeight = document.body.scrollHeight; }
	    else // works in Explorer 6 Strict, Mozilla (not FF) and Safari
	    { pageHeight = document.body.offsetHeight + document.body.offsetTop; }
    			
	    if(pageHeight < innerHeight)
	    {
		    if(document.getElementById('InnerBody') != null)
		    {
			    if(document.all) //IE
			    {   document.getElementById('InnerBody').style.height = (innerHeight - IEOffsetValue) + "px"; } 
			    else  			//Firefox
			    {   document.getElementById('InnerBody').style.minHeight = (innerHeight - OffsetValue) + "px"; }
		    }
	    }
	    else
	    {
		    if(document.getElementById('InnerBody') != null)
		    {
			    if(document.all) //IE
			    {   document.getElementById('InnerBody').style.height = (pageHeight - IEOffsetValue) + "px"; } 
			    else  			//Firefox
			    {   document.getElementById('InnerBody').style.minHeight = (pageHeight - OffsetValue) + "px"; }
		    }
	    }
	}
}

function ResizeHomeBody(OffsetValue, IEOffsetValue)
{
    //Unactivating the function in certain pages (Articles, Books, Tools, MyProfile) for reason of dynamic height
    if(document.location.href.toLowerCase().indexOf("myprofile.aspx") == -1
        && document.location.href.toLowerCase().indexOf("articles.aspx") == -1 
        && document.location.href.toLowerCase().indexOf("books.aspx") == -1
        && document.location.href.toLowerCase().indexOf("tools.aspx") == -1)
    {    
	    var pageHeight;												//get current document height
	    var windowheight = window.screen.height;					//get resolution height
	    var innerHeight = document.documentElement.clientHeight;	//get browser's inner height
    			
	    if( window.innerHeight && window.scrollMaxY ) // Firefox 
	    { pageHeight = window.innerHeight + window.scrollMaxY; }
	    else if( document.body.scrollHeight > document.body.offsetHeight ) // all but Explorer Mac
	    { pageHeight = document.body.scrollHeight; }
	    else // works in Explorer 6 Strict, Mozilla (not FF) and Safari
	    { pageHeight = document.body.offsetHeight + document.body.offsetTop; }
    			
	    if(pageHeight < innerHeight)
	    {
		    if(document.getElementById('body') != null)
		    {
			    if(document.all) //IE
			    {   document.getElementById('body').style.height = (innerHeight - IEOffsetValue) + "px"; } 
			    else  			//Firefox
			    {   document.getElementById('body').style.minHeight = (innerHeight - OffsetValue) + "px"; }
		    }
	    }
	    else
	    {
		    if(document.getElementById('body') != null)
		    {
			    if(document.all) //IE
			    {   document.getElementById('body').style.height = (pageHeight - IEOffsetValue) + "px"; } 
			    else  			//Firefox
			    {   document.getElementById('body').style.minHeight = (pageHeight - OffsetValue) + "px"; }
		    }
	    }
	}
}
//--------------------------------------------------------------------------------------