// JavaScript Document

function calcColumns(){
	var mc = document.getElementById('mainColumn');
	var w = document.getElementById('widgets');

	if(mc.offsetHeight>w.offsetHeight){
		w.style.height = parseInt(mc.offsetHeight - 25) + "px"; /* 25px = .mainColumn .wrapper{} top+bottom padding (9+16) */
		mc.style.height = parseInt(mc.offsetHeight -25) + "px";
	}else if(w.offsetHeight>mc.offsetHeight){
		mc.style.height = parseInt(w.offsetHeight - 23) + "px";	 /* 23px = .widgets .wrapper{} top+bottom padding (11+12) */	
		w.style.height = parseInt(w.offsetHeight - 23) + "px";		
	}else{
		mc.style.height = parseInt(w.offsetHeight - 23) + "px";
		w.style.height = parseInt(w.offsetHeight - 23) + "px";
	}

}

function makepassword() {   
	var temp = document.loginform.j_password.value;   
	var pass = '<input name="j_password" id="j_password" value=""  type="password" class="text toCenter font11 darkinput"  />';   
	document.getElementById("passworddiv").innerHTML = pass; 
}

function calcDonatePosition(donBoxId, donWrapperId){
	var d = document.getElementById(donBoxId);
	var dw = document.getElementById(donWrapperId);	
/*	alert(dw.offsetHeight); */
	d.style.top = parseInt(dw.offsetHeight - 270) + 'px';
}

function calcWeblogHeight(weblogId, centeredId, widgetHolderId){
	var blog = document.getElementById(weblogId);
	var cent = document.getElementById(centeredId);	
	var holder = document.getElementById(widgetHolderId);	
/*	alert(holder.offsetHeight + ' + ' + cent.offsetHeight); */
/*	blog.style.height = parseInt(holder.offsetHeight - cent.offsetHeight - 37) + 'px'; */
}
function whichBrs() {
var agt=navigator.userAgent.toLowerCase();
if (agt.indexOf("opera") != -1) return 'Opera';
if (agt.indexOf("firefox") != -1) return 'Firefox';
if (agt.indexOf("safari") != -1) return 'Safari';
if (agt.indexOf("msie") != -1) return 'Internet Explorer';
if (agt.indexOf("netscape") != -1) return 'Netscape';
if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
if (agt.indexOf('\/') != -1) {
if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
return navigator.userAgent.substr(0,agt.indexOf('\/'));}
else return 'Netscape';} else if (agt.indexOf(' ') != -1)
return navigator.userAgent.substr(0,agt.indexOf(' '));
else return navigator.userAgent;
}

var defaultState = true;            
var browserName = whichBrs();
function toggleTextSize(){        
    for(i=0;i<arguments.length;i++){
        if(document.getElementById(arguments[i])){				
		  		if(browserName == 'Internet Explorer'){
					var computedStyle = document.getElementById(arguments[i]).currentStyle;					
					var currentFontSize = parseInt(computedStyle.fontSize.substring(0, computedStyle.fontSize.length-2));
					var currentLineHeight = parseInt(computedStyle.lineHeight.substring(0, computedStyle.lineHeight.length-2));
					
				}else{
					var computedStyle = document.defaultView.getComputedStyle(document.getElementById(arguments[i]), null);
					var currentFontSize = parseInt(computedStyle.fontSize.substring(0, computedStyle.fontSize.length-2));
					var currentLineHeight = parseInt(computedStyle.lineHeight.substring(0, computedStyle.lineHeight.length-2));
				}						       				
            if(defaultState){					
					if(browserName == 'Internet Explorer'){
						document.getElementById(arguments[i]).style.fontSize = Math.round(currentFontSize*0.8)+'px';
					}else{
						document.getElementById(arguments[i]).style.fontSize = Math.round(currentFontSize*0.8)+'px';
					}										
					if(currentLineHeight)document.getElementById(arguments[i]).style.lineHeight = Math.round(currentLineHeight*0.8)+'px';               
            }else{
					if(browserName == 'Safari'){						
						document.getElementById(arguments[i]).style.fontSize = Math.round(currentFontSize*1.21)+'px';               
					}else if(browserName == 'Internet Explorer'){
						document.getElementById(arguments[i]).style.fontSize = Math.round(currentFontSize*1.2)+'px';               
					}else{
						document.getElementById(arguments[i]).style.fontSize = Math.round(currentFontSize*1.2)+'px';               
					}		
					if(browserName == 'Internet Explorer'){
						if(currentLineHeight)document.getElementById(arguments[i]).style.lineHeight = Math.round(currentLineHeight*1.7)+'px';               
					}else{
						if(currentLineHeight)document.getElementById(arguments[i]).style.lineHeight = Math.round(currentLineHeight*1.281)+'px';               
					}
					
            }
        }
    }
	 (defaultState)?defaultState = false:defaultState = true;            
}
