window.onresize = reset_positions;
window.onload = get_style;
function get_style(){
	//alert('getStyle');
	styleFile = get_cookie('WWANStyle');
	//alert(styleFile);
	if (styleFile != ''){
		sel_fontSize(styleFile);
	}else{
		sel_fontSize('normal.css');
	}
}
function reset_positions(){
	document.getElementById('main').style.height = document.body.offsetHeight - 309; 
	document.getElementById('footer').style.top = document.body.offsetHeight - 71;
}

function get_cookie(cookieName){
    strValue = false;
    if(strCookie = document.cookie){
       if( arrCookie = strCookie.match( new RegExp( cookieName + '=([^;]*)', 'g'))){
          strValue=RegExp.$1;
       }
    }
    return(strValue);
	}
        
	function set_cookie(cookieName,cookieValue,intDays){
    objNow = new Date();
    strExp = new Date( objNow.getTime() + ( intDays * 86400000) );
    document.cookie = cookieName + '=' + 
                      cookieValue + ';expires=' + 
                      strExp.toGMTString() + ';';
    //alert(cookieValue);
    return true;
	}
	function sel_fontSize(styleFile) {
		newStyle = document.createElement('link');
		newAt = document.createAttribute('rel');
		newAt.nodeValue = 'stylesheet';
		newStyle.setAttributeNode(newAt);
	  newAt = document.createAttribute('type');
		newAt.nodeValue = 'text/css';
		newStyle.setAttributeNode(newAt);
		newAt = document.createAttribute('href');
		newAt.nodeValue = 'fileadmin/templates/frames/' + styleFile;
		newStyle.setAttributeNode(newAt);
		document.getElementsByTagName('head')[0].appendChild(newStyle);
		//alert(styleFile);
		set_cookie('WWANStyle', styleFile, 1);
		//alert(styleFile + get_cookie('WWANStyle'));
	}