function js_email($name,$domain){
   if(!$domain){ $domain='cmg.org';}
   $email = $name + "@" + $domain;
   $link=$email;
   document.write("<a href=\"mailto:" + $email + "\">" + $link + "</a>");
}
function js_email_link($name,$domain,$link){
   if(!$domain){ $domain='cmg.org';}
   $email = $name + "@" + $domain;
   if(!$link){$link=$email;}
   document.write("<a href=\"mailto:" + $email + "\">" + $link + "</a>");
}
function js_email_link_subject($name,$domain,$link,$subject){
   if(!$domain){ $domain='cmg.org';}
   $email = $name + "@" + $domain;
   if(!$link){$link=$email;}
   $subject=escape($subject);
   document.write("<a href=\"mailto:" + $email + "?subject=" + $subject + "\">" + $link + "</a>");
}
function js_email_subject($name,$domain,$subject){
   if(!$domain){ $domain='cmg.org';}
   $email = $name + "@" + $domain;
   $link=$email;
   $subject=escape($subject);
   document.write("<a href=\"mailto:" + $email + "?subject=" + $subject + "\">" + $link + "</a>");
}
function js_email_link_subject_body($name,$domain,$link,$subject,$body){
   if(!$domain){ $domain='cmg.org';}
   $email = $name + "@" + $domain;
   if(!$link){$link=$email;}
   $subject=escape($subject);
   $body=escape($body);
   document.write("<a href=\"mailto:" + $email + "?subject=" + $subject + "&body=" + $body + "\">" + $link + "</a>");
}
function toggleMenu(currMenu) {
	if (document.getElementById) {
		thisMenu = document.getElementById(currMenu).style
		if (thisMenu.display == "block") {
			thisMenu.display = "none"
		}
		else {
			thisMenu.display = "block"
		}
		return false
	}
	else {
		return true
	}
}
function cookieVal(cookieName) {
	thisCookie = document.cookie.split("; ")
	for (i=0; i<thisCookie.length; i++) {
		if (cookieName == thisCookie[i].split("=")[0]) {
			return thisCookie[i].split("=")[1]
		}
	}
	return ""
}
function cookieTest(){
	/* Set a cookie to be sure that one exists.*/
	document.cookie = "test="+1;
	if(document.cookie == ""){
		return false;
	}else{
		return true;
	}
}
function localize(str){
	var d = new Date(str)
	document.write(d.toString())
}
function popup(path,width,height){
	dimens='width=' + width + ',height=' + height; 
	XW = window.open(path,'Xwin',dimens);
	XW.focus();
}
function getWindowHeight() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return ( myHeight );
}
function getWindowWidth() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return ( myWidth );
}
function sizeCol(){
	var win_ht     = getWindowHeight();
	var content_ht = document.getElementById('context').offsetHeight;
	var fudge      = 250 /* other elements plus padding and fudge factor */
	var col_ht     = win_ht - content_ht - fudge
	if(col_ht < 0){
		col_ht = 1
	}
	document.getElementById('column').style.height = col_ht + "px";
}


