var com = {};
com.ldr = {};
com.ldr.content = {};
com.ldr.utils = {};

$(document).ready(function() {
   com.ldr.content.startPicsRotations();    
});
 
prerender = function()
{
    com.ldr.content.positionSubmenu();
    //com.ldr.utils.equalizeElementsHeight('mainNavigation', 'subNavigation', 'content');
}

com.ldr.content.positionSubmenu = function()
{
    var offset = $('#mainMenu a.selected').offset()
    if (offset)
    {
        $('#submenu').css( {'margin-top': offset.top - 50 + 'px'} );
    }
}

com.ldr.content.startPicsRotations = function()
{
    //$('#RotationsImage1').height( $('#RotationsImage1 img').attr('height') );
        
    $.fn.cycle.defaults.timeout = 5000;
    
    $('#RotationsImage1').cycle({
        fx:     'fade'
        //,
//		spped: 'fast',
//		before: beforeAnim
    });
    
    function beforeAnim()
    {
	    if ( $(this).attr('timeout') ) 
	    {   
	        $.fn.cycle.defaults.timeout = $(this).attr('timeout');
	    }
	}
}

/****************************************************************************
Equalize Columns Height
****************************************************************************/
com.ldr.utils.equalizeElementsHeight = function()
{
	var arrObj = [];
	var intMax = 0;
	for (i=0; i<arguments.length; i++)
	{
		obj = document.getElementById(arguments[i]);
		if (obj) arrObj.push(obj);
	}
	for (i=0; i<arrObj.length; i++)
	{
		if (document.all) 
		{
			intMax = Math.max(intMax, arrObj[i].offsetHeight);
		}
		else if (document.defaultView) 
		{
			intMax = Math.max(intMax, parseInt(document.defaultView.getComputedStyle(arrObj[i], "").getPropertyValue("height")));		
		}
		
	}
	for (i=0; i<arrObj.length; i++)
	{
		arrObj[i].style.height = intMax + 'px';
	}
	return intMax;
	
}
/****************************************************************************
Obfuscate Email
****************************************************************************/
function obfuscate(name, domain)
{
    document.write("<");document.write("a");document.write(" ");document.write("h");document.write("r");document.write("e");document.write("f");document.write("=");document.write("'");document.write("m");document.write("a");document.write("i");document.write("l");document.write("t");document.write("o");document.write(":");
    document.write(name);
    document.write(String.fromCharCode(64));
    document.write(domain);
    document.write("'");document.write(">");
    document.write(name);
    document.write(String.fromCharCode(64));
    document.write(domain);
    document.write("<");document.write("/");document.write("a");document.write(">");
}
