<!--
function emailThisPage(targetUrl) {
	currentPageTitle = document.title;
	currentUrl = location.href;
	targetUrl = targetUrl + "?title=" + currentPageTitle + "&emailedUrl=" + currentUrl;
	winStats = 'toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,status=yes,width=450,height=570'
	
	var floater = "";
	if (navigator.appName.indexOf("Microsoft")>=0) {
   		winStats+=',left=10,top=25'
	}else{
    		winStats+=',screenX=10,screenY=25'
	}
	floater=window.open(targetUrl,"",winStats)
	
}
//#################################################################
function Get_Cookie(name) {
    var start = document.cookie.indexOf(name + "=");
    var len = start + name.length + 1;
    if (!start && name != document.cookie.substring(0, name.length)) {
        return null;
    }
    if (start == -1) {
        return null;
    }
    var end = document.cookie.indexOf(";", len);
    if (end == -1) {
        end = document.cookie.length;
    }
    return unescape(document.cookie.substring(len, end));
}

function Delete_Cookie(name, path, domain) {
    if (Get_Cookie(name)) {
        document.cookie = name + "=" + (path ? ";path=" + path : "") + (domain ? ";domain=" + domain : "") + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
    }
}

function Set_Cookie(name, value, expires, path, domain, secure) {
    var today = new Date;
    today.setTime(today.getTime());
    if (expires) {
        expires = expires * 1000 * 60 * 60 * 24;
    }
    var expires_date = new Date(today.getTime() + expires);
    if (path == null) {
        path = "/";
    }
    document.cookie = name + "=" + escape(value) + (expires ? ";expires=" + expires_date.toGMTString() : "") + (path ? ";path=" + path : "") + (domain ? ";domain=" + domain : "") + (secure ? ";secure" : "");
}

	/*
	*	CREDITS
	*	Original code for altering CSS stylesheets on the fly taken
	*	partially from http://www.shawnolson.net/a/503/
	*	Thanks to Shawn Olson
	*/

	var fontCookie = "alzTextSize";
	var cssRules;
	if (document.all) {
		cssRules = 'rules';
	}
	else if (document.getElementById) {
		cssRules = 'cssRules';
	}

	function getCss(theClass, element)
	{
		for (var S = 0; S < document.styleSheets.length; S++){
			for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
				if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
					return document.styleSheets[S][cssRules][R].style[element];
				}
			}
		}
		return null;
	}

	function changeCss(theClass, element, value) {
		for (var S = 0; S < document.styleSheets.length; S++){
			for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
				if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
					document.styleSheets[S][cssRules][R].style[element] = value;
				}
			}
		}
	}

	// Only these classes...
	var updateClasses=new Array();
	updateClasses[0]	= ".text";
	updateClasses[1]	= ".secnav";
	updateClasses[2]	= ".subhead2";
	//updateClasses[3]	= ".tools";
	updateClasses[3]	= ".title";
	updateClasses[4]	= ".tabletext";
	updateClasses[5]	= ".tablehead";
	updateClasses[6]	= ".mod-text";
	//updateClasses[7]	= ".subhead";
	//updateClasses[7]	= ".smalltext2";
	//updateClasses[8]	= ".important";

	function changeTextSize(dir)
	{

		/*
		// All classes on the page...
		for (var S = 0; S < document.styleSheets.length; S++){
			for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
				//if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
				//	document.styleSheets[S][cssRules][R].style[element] = value;
				//}
				var rule = document.styleSheets[S][cssRules][R].style;
				if(rule['fontSize'] != "")
				{
					var currSize = parseFloat(rule['fontSize']);
					if(dir == 'up')
						currSize *= 1.2;
					else
						currSize /= 1.2;

					if(rule['fontSize'].indexOf('em') > 0)
						currSize += 'em';
					else if(rule['fontSize'].indexOf('px') > 0)
						currSize += 'px';
					else if(rule['fontSize'].indexOf('pt') > 0)
						currSize += 'pt';

					rule['fontSize'] = currSize;
				}
			}
		}
		*/

		var iClsCounter;
		for(iClsCounter=0; iClsCounter<updateClasses.length; iClsCounter++)
		{
			var currFontSize = getCss(updateClasses[iClsCounter], 'fontSize');
			if(currFontSize == null) return;

			if(currFontSize.indexOf('em') > 0)
			{
				currFontSize = parseFloat(currFontSize);
				if(!isNaN(currFontSize))
				{
					if(dir == 'up')
					{
						if(currFontSize > 2.0)
							return;
						currFontSize += 0.2;
					}
					if(dir == 'down')
					{
						if(currFontSize < 0.4)
							return;
						currFontSize -= 0.2;
					}
					currFontSize = Math.round(currFontSize * 1000) / 1000; //3 decimal places
					currFontSize += 'em';
				}
			}
			else
			{
				//do nothing for px, pt et al for now...
			}
			changeCss(updateClasses[iClsCounter], 'fontSize', currFontSize);

			Set_Cookie(fontCookie + updateClasses[iClsCounter], currFontSize, 365);
		}
		return;
	}

	
	var iClsCounter;
	for(iClsCounter=0; iClsCounter<updateClasses.length; iClsCounter++)
	{
		if(Get_Cookie(fontCookie + updateClasses[iClsCounter]) != null)
		{
			changeCss(updateClasses[iClsCounter], 'fontSize', Get_Cookie(fontCookie + updateClasses[iClsCounter]));
		}
	}
	
function deleteAllFontCookies() 
{
	  
	  
	var iClsCounter;
	var path = "/";
	var domain = document.domain;
	for(iClsCounter=0; iClsCounter<updateClasses.length; iClsCounter++)
	{
		if(Get_Cookie(fontCookie + updateClasses[iClsCounter]) != null)
		{
			var cookieName = fontCookie + updateClasses[iClsCounter];
			//var cookieString = cookieName + "=" + (path ? ";path=" + path : "") + (domain ? ";domain=" + domain : "") + ";expires=Thu, 01-Jan-1970 00:00:01 GMT"
			//var cookieString = cookieName + "=test; path=/; domain=staging.schizophreniaforum.org; expires=Thu, 2 Aug 2001 20:47:11 UTC";
			//document.cookie = cookieString; 
			setCookie(cookieName,"",-1)
		}
	}
	
	window.location.reload( false );
}

function setCookie(c_name,value,expiredays)
{var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

//#################################################################
//generic window opener passing in two arguements url and name
var agt = navigator.userAgent.toLowerCase(); 
var is_aol = (agt.indexOf("aol") != -1); 
var windowOpener = null;
var propStr;

function textResize() {
	var screenText = $$(".textResize")
	for(var i=0; i<screenText.length;i++) {
	 	//screenText[i].style.fontSize = "11px";
		if(screenText[i].style.fontSize) {
			var size = parseInt(screenText[i].style.fontSize.replace("px", ""));
			size++;
			screenText[i].style.fontSize = size+inc + 'px';
		} else {
			screenText[i].style.fontSize = '16px';
		}//end if
	}//end for loop
	
}

function popUp(url, title, w, h, isScrollable, notResizable) {
	if(w == null) { w = 457; }
	if(h == null) { h = 450; }
	if(is_aol) { h = 800; }
	
	var isScroll;
	// if isScrollable is omitted (default function call), scrollbars are displayed
	if (isScrollable == null)
		isScroll="yes";
	else if (isScrollable == true)
		isScroll="yes";
	else
		isScroll="no";
		
	var isResize;
	// if isResizable is omitted (default function call), scroll bars are displayed
	if (notResizable == null) {
		isResize="yes";
	} else if (notResizable == true) {
		isResize="no";
	} else {
		isResize="yes";
	}
	
	if(is_aol) {
		propStr = 'scrollbars=' + isScroll + ',menubar=no,resizable=' + isResize + ',status=no,width=' + w + ',height=' + h;
	} else {
		propStr = 'scrollbars=' + isScroll + ',menubar=no,resizable=' + isResize + ',status=no,width=' + w + ',height=' + h + ',top=30,left=40';
	}
	
	openWindow(url,title,propStr);
}


//generic window open function called by specific opener functions above
function openWindow(url, title, propStr){
	if(windowOpener == null) {
		windowOpener = window.open(url, title, propStr);
		self.name = "mainWin";
	} else if(windowOpener.closed){
		windowOpener = window.open(url, title, propStr);
		self.name = "mainWin";
	} else {
		windowOpener.close();
		windowOpener = window.open(url, title, propStr);
		windowOpener.focus();
	}	
}



var formReturn = window.name; 

// Passes link text from popup window to appropriate text field
function setFormField(Value){ 
	var preField = eval('window.opener.document.'+formReturn+'.currentCodeForm.value'); 		
	eval('window.opener.document.'+formReturn+'.'+preField+'.value = Value'); 
	window.close(); 
}

// Passes link text from popup window to appropriate text field
function passFormField(value, formName, formField){
	var valuePath = eval("window.opener.document." + formName + "." + formField);
	valuePath.value = value; 
	window.close();
}

function launchListPopup(url,formName){ 
	w = 457;
	h = 450;
	
	var codeWin = eval(window.open(url,formName,'width='+w+',height='+h+',scrollbars=yes,menu=no,resizable=yes'));
	codeWin.focus(); 
} 

function launchPopup(url, fieldName, formName){ 
	w = 457;
	h = 450;
	
	eval('document.'+formName+'.currentCodeForm.value = fieldName'); 
	eval('document.'+formName+'.currentCalForm.value = formName'); 
	var codeWin = eval(window.open(url,formName,'width='+w+',height='+h+',scrollbars=yes,menu=no,resizable=yes'));
	codeWin.focus(); 
} 

function launchPopup2(url, fieldName, formName, w, h){	
	var codeWin = eval(window.open(url,formName,'width='+w+',height='+h+',scrollbars=yes,menu=no,resizable=yes'));
	codeWin.focus(); 
} 

function resetForm() {
	document.powsearch.phrase1.value = '';
	document.powsearch.andOr.selectedIndex = 0;
	document.powsearch.phrase2.value = '';
	document.powsearch.author.value = '';
	document.powsearch.commentator.value = '';		
	document.powsearch.journal.value = '';		
	document.powsearch.PostedToArf.selectedIndex = 0;	
	document.powsearch.PubDateLowMonth.selectedIndex = 0;
	document.powsearch.PubDateLowYear.selectedIndex = 0;
	document.powsearch.PubDateHighMonth.selectedIndex = 0;	
	document.powsearch.PubDateHighYear.selectedIndex = 0;
	document.powsearch.commented.checked = false;	
	document.powsearch.ARFRec.checked = false;
	document.powsearch.milestone.checked = false;
	document.powsearch.sort.selectedIndex = 0;
}

function resetForm2() {
	document.searchcomment.phrase1.value = '';
	document.searchcomment.andOr.selectedIndex = 0;
	document.searchcomment.phrase2.value = '';
	document.searchcomment.commentator.value = '';		
	document.searchcomment.PubDateLowMonth.selectedIndex = 0;
	document.searchcomment.PubDateLowYear.selectedIndex = 0;
	document.searchcomment.PubDateHighMonth.selectedIndex = 0;	
	document.searchcomment.PubDateHighYear.selectedIndex = 0;
	document.searchcomment.approved.checked = true;	
	document.searchcomment.hold.checked = true;
	document.searchcomment.rejected.checked = false;
	document.searchcomment.sort.selectedIndex = 0;
}

function resetForm3() {
	document.comsearch.phrase1.value = '';
	document.comsearch.andOr.selectedIndex = 0;
	document.comsearch.phrase2.value = '';
	document.comsearch.commentator.value = '';		
	document.comsearch.PubDateLowMonth.selectedIndex = 0;
	document.comsearch.PubDateLowYear.selectedIndex = 0;
	document.comsearch.PubDateHighMonth.selectedIndex = 0;	
	document.comsearch.PubDateHighYear.selectedIndex = 0;
	document.comsearch.sort.selectedIndex = 0;
}

function goOpener(myLink,closeme,closeonly)
{
	if (! (window.focus && window.opener))
		return true;
	window.opener.focus();
	if (! closeonly) 
		window.opener.location.href=myLink.href;
	if (closeme) 
		window.close();
	return false;
}

function checkEmailAddresses() {

	var email = document.frmAddMember.email;
	var confirm = document.frmAddMember.confirmEmail;

	if (email.value == confirm.value) {
		return true;
	}
	else {
		alert("In the ACCOUNT INFORMATION section:\n\nPlease ensure the Email Address and Confirm Email field values match");
		email.value = "";
		confirm.value = "";
		return false;
	}
}


function checkEmailAddressesCommentRegister() {

	var email = document.cform.email;
	var confirm = document.cform.confirmEmail;

	if (email.value == confirm.value) {
		return true;
	}
	else {
		alert("\n\nPlease ensure the Email Address and Confirm Email field values match\n\n");
		email.value = "";
		confirm.value = "";
		return false;
	}
}
	
//-->
