/* All javascript functions needed to run pages */



function credit_win(where) {
var location = where;
var winspec; 
var version = parseInt(navigator.appVersion);
var name = navigator.appName;
var percent;

if(name == "Microsoft Internet Explorer"){ percent = 0.54;} 
else {percent = 0.64;} 

if(version >= 4) {
  if(screen.width > 800) {
    winspec="width=480,height=450,resizable=yes,scrollbars=no,status=no,toolbar=no";
    win = window.open(location,"", winspec);
    win.moveTo(Math.round((screen.width * percent)),0);
 }else {
    winspec="width=500,height=400,resizable=yes,scrollbars=no,status=no,toolbar=no";
    win = window.open(location,"",winspec);
    win.moveTo(Math.round((screen.width * percent)),0);
  }
}else {
     winspec="width=500,height=400,resizable=yes,scrollbars=no,status=no,toolbar=no";
     win = window.open(location,"",winspec);
 }
}





function small_win(where) {

var location = where;
var winspec;
var win;
var percent;

if(navigator.appName == "Microsoft Internet Explorer")  {
percent = 0.57;
winspec="width=325,height=200,resizable=yes,scrollbars=no,status=no,toolbar=no";
win  = window.open(location, "", winspec);
} else {
percent = 0.64;
winspec = "width=325,height=200,resizable=yes,scrollbars=no,status=no,toolbar=no"; 
win  = window.open(location, "", winspec);
}

if(parseInt(navigator.appVersion) >= 4)
win.moveTo(Math.round((screen.width * percent)),0);
else return;

}



function wynk_win(where) {
//alert(document.location.pathname);

if (document.location.pathname == '/health/wynks/') 
	return;


var location = where;
var winspec ="width=280,height=380,scrollbars=yes";
var win = window.open(location,"",winspec);
var percent;


 if(navigator.appName == "Microsoft Internet Explorer")
      percent = 0.53;
 else percent = 0.64;

 if(parseInt(navigator.appVersion) >= 4) {
   win.moveTo(Math.round(screen.width * percent),0);
 }else return;

}



function pdf_win(where) {

var location = where;
var winspec ="width=380,height=300";
var win = window.open(location,"",winspec);
var percent;

 if(navigator.appName == "Microsoft Internet Explorer")
      percent = 0.53;
 else percent = 0.64;

 if(parseInt(navigator.appVersion) >= 4) {
   win.moveTo(Math.round(screen.width * percent),0);
 }else return;

}

function subWrite(fileName) {

var swfFile = fileName;
var newWindow;
var percent;
var swfContent = "<html><head><title>health.com :: bodywork</title></head>";
swfContent += "<body BGCOLOR='#000000' TOPMARGIN='0' RIGHTMARGIN='0' LEFTMARGIN='0' BOTTOMMARGIN='0' MARGINHEIGHT='0' MARGINWIDTH='0'><TABLE ALIGN='center' CELLSPACING='0' CELLPADDING='0' BORDER='0' WIDTH='350'>";
swfContent += "<TR><TD ALIGN='LEFT' valign='top' WIDTH='350'><OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://active.macromedia.com/flash4/cabs/swflash.cab#version=4,0,0,0' WIDTH='350' HEIGHT='350'><PARAM NAME='movie' VALUE='";
swfContent += swfFile;
swfContent += "'><PARAM NAME='quality' VALUE='best'><PARAM NAME='scale' VALUE='noborder'><PARAM NAME='bgcolor' VALUE='#FFFFFF'><EMBED src='";
swfContent += swfFile;
swfContent += "' quality='best' scale='noborder' bgcolor='#FFFFFF' WIDTH='350' HEIGHT='350' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'></EMBED></OBJECT></TD></TR></TABLE></body></html>";


newWindow = window.open("","","width=350,height=350,resizable");

if(navigator.appName == "Microsoft Internet Explorer")
      percent = 0.53;
 else percent = 0.64;

 if(parseInt(navigator.appVersion) >= 4) {
   newWindow.moveTo(Math.round(screen.width * percent),0);
 }else return;

newWindow.document.write(swfContent);
newWindow.document.close();
}


function fax_win(where) {

var location = where;
var winspec;
var win;
var percent;

if(navigator.appName == "Microsoft Internet Explorer")  {
percent = 0.55;
winspec="width=470,height=580,resizable=yes,scrollbars=no,status=no,toolbar=no";
win  = window.open(location, "", winspec);
} else {
percent = 0.64;
winspec = "width=470,height=580,resizable=yes,scrollbars=no,status=no,toolbar=no";
win  = window.open(location, "", winspec);
}

if(parseInt(navigator.appVersion) >= 4)
win.moveTo(Math.round((screen.width * percent)),0);
else return;

}

function email_win(where) {

var location = where;
var winspec ="width=370,height=380,resizable=yes,scrollbars=yes,status=no,toolbar=no";
var win = window.open(location,"",winspec);
var percent;

 if(navigator.appName == "Microsoft Internet Explorer")
      percent = 0.53;
 else percent = 0.64;

 if(parseInt(navigator.appVersion) >= 4) {
   win.moveTo(Math.round(screen.width * percent),0);
 }else return;

}

function print_win(where) {

var location = where; 
var winspec = "width=440,height=350,resizable=yes,scrollbars=yes,status=no,toolbar=yes";
var win = window.open(location,"",winspec);
var percent;

 if(navigator.appName == "Microsoft Internet Explorer")
      percent = 0.53;
 else percent = 0.64;

 if(parseInt(navigator.appVersion) >= 4) {
   win.moveTo(Math.round(screen.width * percent),0);
 }else return;

}

function gosite1(where) {

	document.location = document.re.se[where].value;
}

function gosite(where) {
	if (where != "a0") {
		if(typeof P_popupoff != "undefined")P_popupoff();
		document.location = where;
	}
	else { return; }
}	

function clear_form(which) {
	
	var index = which;	
	document.forms[index].reset();
}

function Cookie(document, name, hours, path, domain, secure) {
        this.$document = document;
        this.$name = name;
        if(hours)
          this.$expiration = new Date((new Date()).getTime() + hours * 3600000);
        else this.$expiration = null;
        if (path) this.$path = path; else this.$path = null;
        if (domain) this.$domain = domain; else this.$domain = null;
	if (secure) this.$secure = true; else this.$secure = false;
}
function _Cookie_store() {
        
        var cookieval = "";
        for(var prop in this) {
        if((prop.charAt(0) =='$') || ((typeof this[prop]) == 'function'))
                continue;
        if (cookieval != '') cookieval += '&';
        cookieval += prop + ':' + escape(this[prop]);
        }
        var cookie = this.$name + '=' + cookieval;
        if (this.$expiration)
           cookie += '; expires=' + this.$expiration.toGMTString();
        if (this.$path) cookie += '; path=' + this.$path;
        if (this.$domain) cookie += '; domain=' + this.$domain;
	if (this.$secure) cookie += '; secure'

        this.$document.cookie = cookie;
}
function _Cookie_load() {
        
        var allcookies = this.$document.cookie;
        if(allcookies == "") return false;

        var start = allcookies.indexOf(this.$name + '=');
        if (start == -1) return false;
        start += this.$name.length +1;
        var end = allcookies.indexOf(';', start);
        if(end == -1) end = allcookies.length;
        var cookieval = allcookies.substring(start,end);

        var a = cookieval.split('&');
        for(var i = 0; i < a.length; i++) {
                a[i] = a[i].split(':');
        }
        for(var i = 0; i < a.length; i++) {
                this[a[i][0]] = unescape(a[i][1]);
        }
        return true;
}
function _Cookie_remove() {

        var cookie;
        cookie = this.$name + '=';
        if (this.$path) cookie += '; path=' + this.$path;
        if (this.$domain) cookie += '; domain=' + this.$domain;
	cookie += '; expires=Fri, 02-Jan-1970 00:00:00 GMT';

        this.$document.cookie = cookie;
}

//script for fax stuff

function LTrim(str)
{
        var whitespace = new String(" \t\n\r");
        var s = new String(str);
        if (whitespace.indexOf(s.charAt(0)) != -1) {
            var j=0, i = s.length;
            while (j <i && whitespace.indexOf(s.charAt(j)) != -1)
                j++;
            s = s.substring(j, i);
        }
        return s;
}

function RTrim(str) {
        var whitespace = new String(" \t\n\r");
        var s = new String(str);
        if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
            var i = s.length - 1;       
            while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
                i--;
            s = s.substring(0, i+1);
        }
        return s;
}

function Trim(str) {
        return RTrim(LTrim(str));
}

function isblank(object) { 
   var areacodestr = Trim(object.area_code.value)
   var numberstr   = Trim(object.number.value)
   var emailstr    = Trim(object.email.value)


   if ((areacodestr.length == 0) || (numberstr.length == 0) || (emailstr.length == 0)) {
      alert('Please be sure to fill out the fax number and email address fields');
      return false;
   } else {
      return true;


   }

}


function togglecold(boxid) {

if(boxid == '1_1' || boxid == '1_2'){
	if(document.coldflu.elements['1_1'].checked == true) {
	document.coldflu.elements['1_2'].checked = false;
	}
	if(document.coldflu.elements['1_2'].checked == true) {
        document.coldflu.elements['1_1'].checked = false;
        }

} else if(boxid == '2_1' || boxid == '2_2') {
	if(document.coldflu.elements['2_1'].checked == true) {
        document.coldflu.elements['2_2'].checked = false;
        }
        if(document.coldflu.elements['2_2'].checked == true) {
        document.coldflu.elements['2_1'].checked = false;
        }

} else if(boxid == '3_1' || boxid == '3_2') {
        if(document.coldflu.elements['3_1'].checked == true) {
        document.coldflu.elements['3_2'].checked = false;
        }
        if(document.coldflu.elements['3_2'].checked == true) {
        document.coldflu.elements['3_1'].checked = false;
        }

}else if(boxid == '4_1' || boxid == '4_2' || boxid == '4_3' || boxid == '4_4') {

        if(document.coldflu.elements['4_1'].checked == true) {
        document.coldflu.elements['4_2'].checked = false;
        document.coldflu.elements['4_3'].checked = false;
	document.coldflu.elements['4_4'].checked = false;
	}
        if(document.coldflu.elements['4_2'].checked == true) {
        document.coldflu.elements['4_1'].checked = false;
        document.coldflu.elements['4_3'].checked = false;
	document.coldflu.elements['4_4'].checked = false;
	}
	if(document.coldflu.elements['4_3'].checked == true) {
	document.coldflu.elements['4_1'].checked = false;
        document.coldflu.elements['4_2'].checked = false;
        document.coldflu.elements['4_4'].checked = false;
        }
        if(document.coldflu.elements['4_4'].checked == true) {
        document.coldflu.elements['4_1'].checked = false;
        document.coldflu.elements['4_2'].checked = false;
        document.coldflu.elements['4_3'].checked = false;
        }
} else if(boxid == '5_1' || boxid == '5_2') {
        if(document.coldflu.elements['5_1'].checked == true) {
        document.coldflu.elements['5_2'].checked = false;
        }
        if(document.coldflu.elements['5_2'].checked == true) {
        document.coldflu.elements['5_1'].checked = false;
        }
}else { return;}

}

function popMailWin() {
        var pageURL   = escape(self.document.URL);
        var pageTitle = escape(self.document.title);
        var formURL   = "/cgi-bin/mail/mailurl2friend.cgi?path=/health/mail/templates&url=" + pageURL + "&group=health&title=" + pageTitle ;window.open(formURL,"emailpop","height=400,width=375,resizable,scrollbars");
        return false;
}
