// JavaScript Document
// Mental Health Connections, Inc. 2004-8
// Written by Robert Patterson
/* 

		Script loaded after log in
http://localhost/cgi-bin/ddiD44.exe?server=local&task=getDrugList&mshv=yes&ptDrugList=0-59^omeprazole
http://localhost/cgi-bin/ddiD44.exe?server=local&task=getDrugList&mshv=yes&ptDrugList=%220-59^omeprazole%22,%220-59^omeprazole%22
http://localhost/cgi-bin/ddiD44.exe?server=local&task=getDrugList&mshv=yes&ptDrugList=%220-59^omeprazole%22,%220-20^fluoxetine%22
http://localhost/cgi-bin/ddiD44.exe?server=local&task=getDrugList&mshv=yes&ptDrugList=%220-59^omeprazole%22,%220-20^fluoxetine%22		
*/

function testpost()
{
	alert('post est ok');

}

function findExactItem(name,select)
{
	var cdH = document.getElementById(select);
	var dr = name.toLowerCase();
	for(d=0;d<cdH.length;d++)
	{
		if( dr == cdH.options[d].text.toLowerCase()){
			cdH.selectedIndex = d;
			return d;
		}
	}
	return -1;
}

function stopBlinking(id)
{
	document.getElementById(id).className = 'blinkOFF';
}

function curiousDisplay(checked)
{
//alert(' in curiousDisplay');
	if(checked == 1)
	{
		var iframeDoc = getIFrameDoc('updatingFrame'); 
		var rep = serverAddress + "curious.php";
		iframeDoc.location.replace(rep);
		document.getElementById('updatingFrame').className='showIt';
		setCookie('curiousBox','1',1500);
	}
	else
	{
		document.getElementById('updatingFrame').className='hideIt';
		setCookie('curiousBox','0',1500);
	}
	
}


function sendEmail()
{
	if(checkGuestUser()){
		return;
	}
	var drugList = makeDrugList('email');
  		if(drugList == 0){
       			return;
			}
			var name = '';
			try{
				name = document.getElementById('logInName').innerHTML;
			}
			catch(e){;}
	drugList = drugList.replace(/\s/g,"++");
	
	var id = Math.round(100000*Math.random())
	var email = document.getElementById('email').value;	
		window.location.href ="mailto:?subject=GeneMedRx drug interaction program&body=%0A%0A%0A%0AHere is a link to the GeneMedRx drug-drug and drug-gene interaction program.%0A%0A The program will start up with a list of medications which I have already entered. %0A%0APLEASE PICK UP THE ENTIRE LINK BELOW AND PLACE IT IN THE BROWSER'S ADDRESS BOX%0A%0A		http://mhc.daytondcs.com:8080/" + serverAddress + "sendEmail.php?task=show%26drugList=" + drugList + "%26id=" + id + "%26email=" + email + "%0A%0A If what you see makes you want a trial subscription you can get it from within the program. The link above will only permit looking at that specific search result but a trial subscription accesses all features.%0A%0A" + name;
	var name = document.getElementById('logInName').innerHTML;	
	var url = serverAddress + 'sendEmail.php?task=store&id=' + id + '&sender=' + name + '&email=' + email;
	sendAjax(url);
}

function clickNote()
{
	document.getElementById("recNotesIFr").className="showIt";
	frames['recNotesIFr'].grabClinNote();
}

