/* global.js copied from original medem.com.  Minor changes made for Drupal conversion. */

Drupal.medemGlobalInit = function () {
  b_01_o = new Image();
  b_01_o.src = Drupal.settings.medem.imagePath + "b_go.gif";
  
  b_01_x = new Image();
  b_01_x.src = Drupal.settings.medem.imagePath + "b_go_x.gif";
  
  b_02_o = new Image();
  b_02_o.src = Drupal.settings.medem.imagePath + "b_go_round.gif";
  
  b_02_x = new Image();
  b_02_x.src = Drupal.settings.medem.imagePath + "b_go_round_x.gif";
  
  i_info_o = new Image();
  i_info_o.src = Drupal.settings.medem.imagePath + "i_info.gif";
  
  i_info_x = new Image();
  i_info_x.src = Drupal.settings.medem.imagePath + "i_info_x.gif";


  /* Buttons are sometimes rendered with their image equivalent, but the image
   is hidden.  If javascript is enabled we can show the image and hide the
   button, then do some work when the click is done to make it work on IE. */
  $('span.buttonreplace input[@type=image]').show().
  click(function (e) {
      // Pass the click on to our button sibing.
      $(this).siblings().click();
      return false;
    });
  $('span.buttonreplace input[@type=submit]').hide().
  click(function (e) {
      // Pass the click on to the browser.
      this.click();
      return true;
    });
}

if (Drupal.jsEnabled) {
  $(document).ready(Drupal.medemGlobalInit);
 }

function searchResults(caller){
var s = document.Searchform.srch.value;
if (s.length == 0){
	document.Searchform.srch.focus();
	alert("Search cannot be blank.");
	if (caller == 'GoButton') {
		return;
	}
	else {
	 	return (false);
	}
}

else if (s.length > 50){
	document.Searchform.srch.focus();
	alert("Search criteria cannot exceed 50 characters including spaces. Please refine your criteria.");
	if (caller == 'GoButton') {
		return;
	}
	else {
	 	return (false);
	}
}


document.Searchform.act.value=document.Searchform.srch.value;
	if (caller == 'GoButton') {
	document.Searchform.submit();
	}
	else {
	return (true);
	}
}


function phyLogin(sendForm)
{
if ((document.YPOL_LoginX.name.value)=="")
{
	document.YPOL_LoginX.name.focus();
	alert("A User ID is required. Please enter one and try again.");
	return false;
}
if ((document.YPOL_Login.pswd.value)=="")
{
	document.YPOL_Login.pswd.focus();
	alert("A password is required. Please enter one and try again.");
	return false;
}

document.YPOL_Login.loginName.value=document.YPOL_LoginX.name.value;
document.YPOL_Login.password.value=document.YPOL_Login.pswd.value;
//document.YPOL_Login.WHATTODO.value=document.YPOL_Login.act.value;
if (sendForm == true)
{
setTimeout("document.YPOL_Login.submit();", 10);
}

return true;
}


function OpenWindowMedem(ThisInfo) {

	bVer = parseInt(navigator.appVersion);
	if (bVer <= 3) {
	var LeftPos = 0
	}
	else {
	LeftPos = screen.width-300
	}
	InfoWindow = 	window.open("","Infopopup","toolbar=no,scrollbars=yes,resize=no,menubar=no,WIDTH=300,HEIGHT=350,left="+LeftPos+",top=0");

	var info = new Array

		info[0] = "<html><head><title>SEARCH TIPS</title></head><body bgcolor='#666699' leftmargin='0' rightmargin='0' topmargin='0' bottommargin='2' marginwidth='0' marginheight='2'><table border='0' cellpadding='3' cellspacing='0' width='100%' height='100%' align='center'><tr><td bgcolor='#666699'><img src='../i/0.gif' width='1' height='1' border='0'></td></tr><tr><td valign='top' width='100%' height='100%' bgcolor='#ffffff'><font size='2' face='Verdana, Tahoma, Helvetica, Arial, MS Sans Serif' color='#cc0066'><b>SEARCH TIPS</b></font><font size='1' face='Verdana, Tahoma, Helvetica, Arial, MS Sans Serif'><br><br>The search box does not accept Boolean expressions (AND, OR, NOT), but you can narrow the information you receive using the following methods:<br><br><ul><li>Enter two or more words with <b>only spaces</b> between the words. This will list <b>only</b> articles containing the exact phrase provided. For example: Enter <b><i>skin cancer</i></b> to receive only articles containing this phrase. You will not receive articles that refer to skin cancer as 'cancer of the skin.'<br><br><li>Enter two or more words with <b>commas</b> between the words. This will list all articles containing these words within the article. For example: Enter <b><i>skin, cancer</i></b> to receive articles referring to 'skin cancer' and 'cancer of the skin.'<br><br><li>Append an asterisk (*) to a word stem. For example: type <b><i>cardio*</i></b> to receive all articles that contain words beginning with cardio, such as <b><i>cardiovascular</i></b>, <b><i>cardiology</i></b>, etc.<br><br><li>Use general terminology. The search function will <b>not</b> currently find comparable terms. If you only search on <b><i>squamous cell carcinoma</i></b>, you may miss the article the refers to it only as <b><i>skin cancer</i></b>.</ul></font></td></tr><tr><td align='right' valign='bottom' background='../i/bg_popup.gif' height='40'><a href='javascript:void(null);' onClick='window.close();'><img src='../i/b_close_pop.gif' alt='CLOSE' border='0'></a></td></tr></table></body></html>";

		info[1] = "<html><head><title>Contact Us</title><script language='javascript'>function patwin(){window.open('http://www.medem.com/am/am_contact_medem_pat.cfm');self.close();} function phywin(){window.open('http://www.medem.com/am/am_contact_medem_phy.cfm');self.close();}</script></head><body bgcolor='#666699' leftmargin='0' rightmargin='0' topmargin='0' bottommargin='2' marginwidth='0' marginheight='2'><table border='0' cellpadding='3' cellspacing='0' width='100%' height='100%' align='center'><tr><td bgcolor='#666699'><img src='../i/0.gif' width='1' height='1' border='0'></td></tr><tr><td valign='top' width='100%' height='100%' bgcolor='#ffffff'><font size='2' face='Verdana, Tahoma, Helvetica, Arial, MS Sans Serif' color='#cc0066'><b>Contact Us</b></font><font size='1' face='Verdana, Tahoma, Helvetica, Arial, MS Sans Serif'><br><br><ul><li>Have some questions concerning <b>patient</b> matters?<br><br><a href='javascript:patwin()'>Click here</a><p><li>Have some questions concerning <b>physician</b> matters?<br><br><a href='javascript:phywin()'>Click here</a></ul></font></td></tr><tr><td align='right' valign='bottom' background='../i/bg_popup.gif' height='40'><a href='javascript:void(null);' onClick='window.close();'><img src='../i/b_close_pop.gif' alt='CLOSE' border='0'></a></td></tr></table></body></html>";

		//info[xxx] = "<html><head><title>XXXXXXTitle</title></head><body bgcolor='#666699' leftmargin='0' rightmargin='0' topmargin='0' bottommargin='2' marginwidth='0' marginheight='2'><table border='0' cellpadding='3' cellspacing='0' width='100%' height='100%' align='center'><tr><td bgcolor='#666699'><img src='../i/0.gif' width='1' height='1' border='0'></td></tr><tr><td valign='top' width='100%' height='100%' bgcolor='#ffffff'><font size='2' face='Verdana, Tahoma, Helvetica, Arial, MS Sans Serif' color='#cc0066'><b>XXXXXXTitle</b></font><font size='1' face='Verdana, Tahoma, Helvetica, Arial, MS Sans Serif'><br><br>XXXXXXContent</font></td></tr><tr><td align='right' valign='bottom' background='../i/bg_popup.gif' height='40'><a href='javascript:void(null);' onClick='window.close();'><img src='../i/b_close_pop.gif' alt='CLOSE' border='0'></a></td></tr></table></body></html>";

	InfoWindow.focus();
	InfoWindow.document.write(info[ThisInfo]);
	InfoWindow.document.close();
}



function OpenFlashInterview(ThisInfo) {

	bVer = parseInt(navigator.appVersion);
	if (bVer <= 3) {
	var LeftPos = 0
	}
	else {
	LeftPos = screen.width-450
	}
	InfoWindow = 	window.open("","Infopopup","toolbar=no,scrollbars=yes,resize=no,menubar=no,WIDTH=410,HEIGHT=390,left="+LeftPos+",top=0");

	var info = new Array

		info[0] = "<html><head><title>iHR Downloads</title></head><body bgcolor='#666699' leftmargin='0' rightmargin='0' topmargin='0' bottommargin='2' marginwidth='0' marginheight='2'><table border='0' cellpadding='3' cellspacing='0' width='100%' height='100%' align='center'><tr><td bgcolor='#666699'><img src='../i/0.gif' width='1' height='1' border='0'></td></tr><tr><td valign='top' width='100%' height='100%' bgcolor='#ffffff'><font size='2' face='Verdana, Tahoma, Helvetica, Arial, MS Sans Serif' color='#cc0066'><center>&#160;<br><br><object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='384' height='240' id='FLVPlayer' /><param name=movie value='http://anonfcs.buystreaming.speedera.net/anonfcs.buystreaming/tools/FLVPlayer.swf?serverName=fcs.buystreaming.speedera.net&fallbackServerName=fcs.buystreaming.speedera.net.staging.speedera.net&skinName=http://anonfcs.buystreaming.speedera.net/anonfcs.buystreaming/tools/haloSkin_3&appName=vod/fcs.buystreaming/medem/&streamName=ihealth-talkingheads256K_Stream_001&isLive=false&bufferTime=2&autoPlay=true&autoRewind=true&bgColor=0xFFFFFF' /><param name=salign value=lt /><param name=quality value=high /><param name=scale value=noscale /> <param name=bgcolor value=#ffffff /><embed src='http://anonfcs.buystreaming.speedera.net/anonfcs.buystreaming/tools/FLVPlayer.swf?serverName=fcs.buystreaming.speedera.net&fallbackServerName=fcs.buystreaming.speedera.net.staging.speedera.net&skinName=http://anonfcs.buystreaming.speedera.net/anonfcs.buystreaming/tools/haloSkin_3&appName=vod/fcs.buystreaming/medem/&streamName=ihealth-talkingheads256K_Stream_001&isLive=false&bufferTime=2&autoPlay=true&autoRewind=true&bgColor=0xFFFFFF' quality='high' scale='noscale' bgcolor='#ffffff' width='384' height='240' name='FLVPlayer' salign='LT' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></embed></object><br><br>What are patients and doctors saying about the iHealthRecord......</font><br><br><a href='javascript:void(null);' onClick='window.close();'><img src='i/b_close.gif' alt='CLOSE' border='0'></a></center></td></tr></table></body></html>";

	InfoWindow.focus();
	InfoWindow.document.write(info[ThisInfo]);
	InfoWindow.document.close();
}


function newsroomList(){
	var insertNewsroomList = '<table border=0 align=center><tr><td><DIV class=menuSublink><a href="' + Drupal.settings.medem.basePath + 'newsroom#medem" class="nulNav">Medem News Releases</a></DIV><DIV class=menuSublink><a href="' + Drupal.settings.medem.basePath + 'newsroom#partner" class="nulNav">Partner News Releases</a></DIV><DIV class=menuSublink><a href="' + Drupal.settings.medem.basePath + 'newsroom#articles" class="nulNav">News Articles</a></DIV><DIV class=menuSublink><a href="' + Drupal.settings.medem.basePath + 'webinar" class="nulNav">Webinar Events</a></DIV><DIV class=menuSublink><a href="'+ Drupal.settings.medem.basePath + 'newsroom#relations" class="nulNav">Media Relations</a></DIV><!--<DIV class=menuSublink><a href="' + Drupal.settings.medem.basePath + 'newsroom/feed" class="nulNav">RSS Feeds</a></DIV>--></td></tr></table>';
	document.getElementById('newsroom').innerHTML = insertNewsroomList;
}


