/*************************************************************************************
* JAVASCRIPT AND OTHER SCRIPTING
*************************************************************************************/

/**********************************
* jQuery
**********************************/
var autoSizeBGHeight = true;
var doResize = true;
$(document).ready(function() {
				
	//check if IE
	var isIE = (document.all) ? 1 : 0;
			   
	// Cufon
	var replaceElements = '.font, #header .west ul li.signout a, #nav-main ul li a, .box h3, .elementGridPopup .east .info dl dt, .elementGridPopup .east .info dl dd, .elementPagination .west dl dt, .elementPagination .west dl dd, .elementPagination .middle ul li a, #nav-grid li a, .elementWinners ul.winner li.info dl dt, .elementWinners ul.winner li.info dl dd';
	
	if(isIE ==1) //don't do rollover effects in IE
	{
	    Cufon.replace(replaceElements);	    
	}
	else
	{
	    Cufon.replace(replaceElements,{ hover: true });
	}	    
	
	if(autoSizeBGHeight)
	{
	    setBGHeight();
	}
	
});

$(window).resize(function(){
    //setBGHeight();
});

function setBGHeight()
{
    if( $('#container').height() < (getViewportHeight()-4) && doResize == true)
    {
        $('#container').css('height', getViewportHeight()-4 + 'px');
    }
}

function setStyle(objId, style, value) {
    document.getElementById(objId).style[style] = value;
}


function getViewportHeight()
{
     var viewportwidth;
     var viewportheight;
     
     // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
     
     if (typeof window.innerWidth != 'undefined')
     {
          viewportwidth = window.innerWidth,
          viewportheight = window.innerHeight
     }
     
    // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

     else if (typeof document.documentElement != 'undefined'
         && typeof document.documentElement.clientWidth !=
         'undefined' && document.documentElement.clientWidth != 0)
     {
           viewportwidth = document.documentElement.clientWidth,
           viewportheight = document.documentElement.clientHeight
     }
     
     // older versions of IE
     
     else
     {
           viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
           viewportheight = document.getElementsByTagName('body')[0].clientHeight
     }

    return viewportheight;
}

