// JavaScript Document
function windowsize() {
	var myWidth = 0;
	if( typeof( window.innerWidth ) == 'number' ) { //Non-IE
    myWidth = window.innerWidth;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible
	myWidth = document.body.clientWidth;
	}
	return myWidth;
}

var visit = 0;
var factor1 = 0.1;
var factor2 = 0.38;

function init() {
	var myWidth = windowsize();
	var tot = findDOM('derContent',true);
	var menuC = findDOM('menuCol',true);
	findDOM('name',true).fontSize = (myWidth / 65) + 5 + "px";
	if(myWidth > 1255) {
		tot.width = (0.74 * myWidth) + "px";
		tot.height = (0.53 * myWidth) + "px";
		menuC.width = (0.31 * 0.74 * myWidth) + "px";
		if(visit == 1) {
			resetPhoto();
		}
	}
	if( (myWidth <= 1255) && (myWidth >= 810) ) {
		tot.width = (0.82 * myWidth) + "px";
		tot.height = (0.5 * myWidth) + "px";
		tot.marginTop = "1%";
		menuC.width = (0.31 * 0.82 * myWidth) + "px";
		findDOM('photo',true).width = ((factor1 * myWidth) + 58) + "px";
		findDOM('photo',true).height = (.87027 * ((factor1 * myWidth) + 58)) + "px";
	}
	if(myWidth < 810) {
		tot.width = (0.82 * myWidth) + "px";
		tot.height = (0.88 * myWidth) + "px";
		tot.marginTop = "0.5%";
		menuC.width = (0.31 * 0.82 * myWidth) + "px";
		findDOM('photo',true).width = ((factor2 * myWidth) - 133) + "px";
		findDOM('photo',true).height = (.87027 * ((factor2 * myWidth) - 133)) + "px";
	}

	if(myWidth <= 795) findDOM('serv-head',true).fontSize = 'small';
	if( (myWidth < 1050) && (myWidth > 795) ) findDOM('serv-head',true).fontSize = (myWidth / 60) - 1 + "px";
	if(myWidth >= 1050) findDOM('serv-head',true).fontSize = 'medium';

//	window.alert(myWidth);
}

window.onresize = sizer;
function sizer() {
	visit = 1;
	init();
}

function resetPhoto() {
	findDOM('photo',true).width = 185 + "px";
	findDOM('photo',true).height = 161 + "px";
}

// Display functions
var sections = new Array('scope', 'services', 'hypnosis', 'background', 'appoint');
function refresher() {
	for(var i in sections) {
		findDOM(sections[i],true).display = 'none';
	}
	findDOM('footB',true).display = 'none';	
}
function changer(noDe) {
	refresher();
	findDOM(noDe,true).display = 'block';
}
function footBer() {
	findDOM('footB',true).display = 'block';
}

var hypsections = new Array('parents', 'patients');
function hyprefresh() {
	for (var i in hypsections) {
		findDOM(hypsections[i],true).display = 'none';
	}
	findDOM('hypnosis',true).marginLeft = '10%';
	findDOM('hypnosis',true).marginTop = '10%';
}
function hypchanger(noDe) {
	hyprefresh();
	findDOM('hypnosis',true).marginLeft = '3%';
	findDOM('hypnosis',true).marginTop = '6%';
	findDOM(noDe,true).display = 'block';
}

var backsections = new Array('summary', 'books', 'links', 'cv');
function backrefresh() {
	findDOM('links',true).display = 'none';
	findDOM('books',true).display = 'none';
	findDOM('cv',true).display = 'none';
	findDOM('summary',true).display = 'block';
}
function backchanger(noDe) {
	findDOM('links',true).display = 'none';
	findDOM('books',true).display = 'none';
	findDOM('summary',true).display = 'none';
	findDOM('cv',true).display = 'none';
	findDOM(noDe,true).display = 'block';
}
