

var defaultTheme = 'Default';
/*TODO use niftycube for more flexible solution*/

function roundCorners() {

    var theme = document.getElementById('ctl00_Theme');

    if (theme.value == defaultTheme) 
    {
        Rounded("div.section", "all", "#fff", "#f0f9d7", "border #17524F smooth");
        Rounded("div.bottomAdd", "all", "#fff", "#eee", "border #666 smooth");
        Rounded("div.btn", "all", "#ccc", "#d9ede2", "small border #000 smooth");
        Rounded("div.back", "all", "#fff", "#eee", "small border #999 smooth");
        Rounded("div.print", "all", "#fff", "#eee", "small border #999 smooth");
    }
    else 
    {
        Rounded("div.section", "all", "#fff", "#f0f9d7", "border #17524F smooth");
        Rounded("div.bottomAdd", "all", "#fff", "#eee", "border #666 smooth");
        Rounded("div.btn", "all", "#ccc", "#d9ede2", "small border #000 smooth");
        Rounded("div.back", "all", "#fff", "#eee", "small border #999 smooth");
        Rounded("div.print", "all", "#fff", "#eee", "small border #999 smooth");        
    }
}

function roundAsync() 
{
    var theme = document.getElementById('ctl00_Theme');
    Rounded("div.bottomAdd", "all", "#fff", "#eee", "border #666 smooth");
    Rounded("div.btn", "all", "#ccc", "#d9ede2", "small border #000 smooth");
    Rounded("div.back", "all", "#fff", "#eee", "small border #999 smooth");
    Rounded("div.print", "all", "#fff", "#eee", "small border #999 smooth");

    if (theme.value == defaultTheme) 
    {
        Rounded("div.section", "all", "#fff", "#f0f9d7", "border #17524F smooth");       
    }
    else
    {
        Rounded("div.section", "all", "#fff", "#f0f9d7", "border #17524F smooth");
    }      
}

function roundFullAppInsuranceAsync() 
{
    var theme = document.getElementById('ctl00_Theme');

    Rounded("div.btn","all","#ccc","#d9ede2","small border #000 smooth");
    Rounded("div.back","all","#fff","#eee","small border #999 smooth");

    if (theme.value == defaultTheme)
    {
        Rounded("div.section", "all", "#fff", "#f0f9d7", "border #17524F smooth");
    }
    else 
    {
        Rounded("div.section", "all", "#fff", "#f0f9d7", "border #17524F smooth");
    }
        
}

window.onload=function myFunctionForRounding(){
	changeInputs();
	if(NiftyCheck())
	{
	    roundCorners();   
	}
	
	function changeInputs()
	{
	    var inputEls = document.getElementsByTagName('input');
		var inputElsLen = inputEls.length;
		var i = 0;
		for ( i=0;i<inputElsLen;i++ )
		{
		    if ( inputEls[i].getAttribute('type') )
		    {
		        if ( inputEls[i].getAttribute('type') == "text" )
		        {
		            if ( inputEls[i].className == 'smText')
		                inputEls[i].className = 'smText';
		            else if ( inputEls[i].className == 'mdText')
		                inputEls[i].className = 'mdText';
		            else if ( inputEls[i].className == 'lgText')
		                inputEls[i].className = 'lgText';
		            else 
		                inputEls[i].className = 'text';
		        }
		
		        if ( inputEls[i].getAttribute('type') == "checkbox" ||  inputEls[i].getAttribute('type') == "radio")
		        {
		            inputEls[i].className = 'radiocheck';
		        }
		        
		    }
		}
	}
}