﻿


/*
function dropDownHeight(){
	var uls=divs=new Array();

	var rightNav=document.getElementById('right_nav');
	var divs=rightNav.getElementsByTagName('div');
    for (j=0; j<divs.length; j++){
        if (divs[j].className == 'bottom'){
            var bottomDiv=divs[j];
            break;
        }
    }
	var uls=bottomDiv.getElementsByTagName('ul');
	
	if(rightPos=getPos(rightNav)){
	if(rightHeight=rightNav.offsetHeight){
		var rightBottomPos=rightPos+rightHeight;
		if(window.getComputedStyle){
			var ulBottomPad=parseInt(getComputedStyle(bottomDiv,null).paddingBottom);
		}else if(bottomDiv.currentStyle){
			var ulBottomPad=parseInt(bottomDiv.currentStyle.paddingBottom);
		}else{
			return false;
		}
	
		for(j=1;j<=uls.length;j++){
			var ul=uls[uls.length-j];
			if(window.getComputedStyle){
				var topStyle=parseInt(window.getComputedStyle(ul,null).top);
			}else if(bottomDiv.currentStyle){
				var topStyle=parseInt(ul.currentStyle.top)+2;
			}
			var ulHeight=ul.offsetHeight;
			var ulPos=getPos(ul);
			var ulBottom=ulHeight+ulPos;
			var posDiff=ulBottom-rightBottomPos;
			if(posDiff>0){
				ul.style.top=topStyle-posDiff-ulBottomPad+17+"px";
			}
		}
	}else return false;
	}else return false;
	return true;
}

function getPos(obj){
	var curTop=0;
	
	if(obj.offsetParent){
		do{
			curTop+=obj.offsetTop;
		}while(obj=obj.offsetParent);
		return(curTop);
	}else{
	return(false);
	}
}*/

function top_nav_style(){
	var top_nav=document.getElementById("top_nav");
	var lists=top_nav.getElementsByTagName('ul');
	var list=lists[lists.length-1];
	var list_items=lists[0].getElementsByTagName('li');
	if(faq=list_items[list_items.length-5]){
		list.style.width=faq.offsetWidth+11+"px";
	}
}

function lineWidth(){
	var line=document.getElementById('extra_div_5');
	var main_div=document.getElementById('main_div');
	var main_width=main_div.offsetWidth;

	line_width=main_width-204;
	line.style.width=line_width+"px";
}
/*
function bg_position(){
	var background=document.getElementById('extra_div_1');
	var bg_width=document.getElementById('main_div').offsetWidth-1;
	background.style.width=bg_width+"px";
}
*/
function columnHeight(){
    var divs = new Array();
    divs=document.getElementsByTagName('div');
    
    for (j=0; j<divs.length; j++){
        var temp = divs[j];
        var mainAncestor = false;
        while (temp = temp.parentNode) {
            if (temp.id == 'main_content') {
                mainAncestor = true;
            }
        }
        if (divs[j].offsetHeight % 2 != 0
        && divs[j].className != 'div_1'
        && divs[j].className != 'div_2'
        && divs[j].className != 'div_3'
        && divs[j].className != 'div_4' 
        && divs[j].className != 'nofix'
        && divs[j].firstChild
        && !mainAncestor){
            if (window.getComputedStyle) {
                divs[j].style.height=parseInt(window.getComputedStyle(divs[j], null).height)+1+"px";
            } else if (divs[j].currentStyle) {
                var topPad = (parseInt(divs[j].currentStyle.paddingTop)) ? (parseInt(divs[j].currentStyle.paddingTop)) : 0;
                var bottomPad = (parseInt(divs[j].currentStyle.paddingBottom)) ? (parseInt(divs[j].currentStyle.paddingBottom)) : 0;
                
                divs[j].style.height=divs[j].offsetHeight - topPad - bottomPad+1+"px";
            } else {
                return false;
            }
        }
    }
}

    
    /*for (j=0; j<lists.length; j++){
        if (lists[j].clientHeight%2!==0){
            if (window.getComputedStyle) {
                    lists[j].style.height=parseInt(window.getComputedStyle(lists[j], null).height)+1+"px";
            } else if (lists[j].clientHeight) {
                var total = lists[j].clientHeight+1;
                lists[j].style.height=total+"px";
            } else {
                return false;
            }
        }
    }*/

	/*var main=document.getElementById('main_content');
	var right=document.getElementById('right_nav').getElementsByTagName('div');
	var rightTop=right[0];
	var rightBottom=right[5];

	if(document.getElementById('roll_nav')){
		var left=document.getElementById('roll_nav');
		if(left.offsetHeight%2!==0){
			left.style.height=left.offsetHeight+1+"px";
		}
	}
	if(main.offsetHeight%2!==0){
		main.style.height=main.offsetHeight+1+"px";
	}
	if(rightTop.offsetHeight%2!==0){
		var bottomPad=parseInt(window.getComputedStyle(rightTop,null).paddingBottom);
		rightTop.style.height=rightTop.clientHeight-bottomPad+1+"px";
	}
	if(rightBottom.offsetHeight%2!==0){
		rightBottom.style.height=rightBottom.offsetHeight+1+"px";
	}
	if(main.offsetWidth%2!==0){
		main.style.width=main.offsetWidth+1-40+"px";
	}
}

function ieColumnHeight(){

	var main=document.getElementById('main_content');
    var roll_nav=document.getElementById('roll_nav');
	var right=document.getElementById('right_nav').getElementsByTagName('div');
	var rightTop=right[0];
	var rightBottom=right[5];

	if(document.getElementById('roll_nav')){
		var left=document.getElementById('roll_nav');
		if(left.offsetHeight%2!==0){
			left.style.height=left.offsetHeight+1+"px";
		}
	}
	if(main.offsetHeight%2!==0){
		main.style.height=main.offsetHeight+1+"px";
	}
	if(rightTop.offsetHeight%2!==0){
		rightTop.style.height=rightTop.offsetHeight+1-30+"px";
	}
	if(rightBottom.offsetHeight%2!==0){
		rightBottom.style.height=rightBottom.offsetHeight+1-30+"px";
	}
	if(main.offsetWidth%2!==0){
		main.style.width=main.offsetWidth+1-40+"px";
	}
    if(roll_nav.offsetHeight%2!==0){
        roll_nav.style.height=roll_nav.offsetHeight+1-39+"px";
    }
}*/

function ieBgAdjust(){

	var ieDivs = document.getElementsByTagName('div');
    
    for (j = 0; j < ieDivs.length; j++) {
        if (ieDivs[j].className == "div_1" || ieDivs[j].className == "div_2" || ieDivs[j].className == "div_3" || ieDivs[j].className == "div_4") {
            var divStyle = ieDivs[j].style;
            var divParent = ieDivs[j].parentElement;
            
            var height = (divParent.clientHeight > 0) ? divParent.clientHeight : divParent.offsetHeight;
            var width = (divParent.clientWidth > 0) ? divParent.clientWidth : divParent.offsetWidth;
            divStyle.height = height / 2 + "px";
            divStyle.width = width / 2 + "px";
        }
    }

}

function commonFunctions(){

	var browser=navigator.userAgent;

	top_nav_style();
	lineWidth();
    columnHeight();

	if(browser.indexOf('MSIE')!=-1){
		ieBgAdjust();
		//ieColumnHeight();
	}
    
	//dropDownHeight();
}


