//common.js
//Version 2.0
//Declare global variables

$sPrefix 			= '../library/';
$aURL 			= new Array();

$aURL.Psych 		= $sPrefix + 'psych_summary_ajax.php';
$aURL.Raw			= $sPrefix + 'raw_data_ajax.php';
$aURL.TS 			= $sPrefix + 'treatment_schedule_ajax.php';
$aURL.TSOPT		= $sPrefix + 'treatment_schedule_opt_ajax.php';
$aURL.Forms		= $sPrefix + 'form_ajax.php';
$aURL.FormMenu		= $sPrefix + 'form_menu_ajax.php';
$aURL.FormMaint 	= $sPrefix + 'form_maint_ajax.php';
$aURL.OPT 		= $sPrefix + 'outpatient_ajax.php';
$aURL.PD			= $sPrefix + 'patient_dashboard_ajax.php';
$aURL.PettyCash	= $sPrefix + 'petty_cash_ajax.php';
$aURL.Reporting	= $sPrefix + 'reporting_ajax.php';
$aURL.Common		= $sPrefix + 'common_ajax.php';
$aURL.RC			= $sPrefix + 'rc_data_ajax.php';

//************************************************************************************************************
function Set_Cookie(name, value, expires, path, domain, secure){

	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );

	/*
	if the expires variable is set, make the correct
	expires time, the current script below will set
	it for x number of days, to make it for hours,
	delete * 24, for minutes, delete * 60 * 24
	*/
	if(expires) expires = expires * 1000 * 60 * 60 * 24;

	var expires_date = new Date( today.getTime() + (expires) );

	document.cookie = name + "=" + escape(value) +
					( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
					( ( path ) ? ";path=" + path : "" ) +
					( ( domain ) ? ";domain=" + domain : "" ) +
					( ( secure ) ? ";secure" : "" );

}

//************************************************************************************************************
function Get_Cookie($sCheckName){

	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var $aAllCookies 	= document.cookie.split( ';' );
	var $aTempCookie 	= '';
	var $sCookieName 	= '';
	var $sCookieValue 	= '';
	var $bCookieFound 	= false; // set boolean t/f default f
	var $iCount;

	for($iCount = 0; $iCount < $aAllCookies.length; $iCount++){

		// now we'll split apart each name=value pair
		$aTempCookie = $aAllCookies[$iCount].split( '=' );


		// and trim left/right whitespace while we're at it
		$sCookieName = $aTempCookie[0].replace(/^\s+|\s+$/g, '');

		// if the extracted name matches passed check_name
		if($sCookieName == $sCheckName){

			$bCookieFound = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if($aTempCookie.length > 1)
				$sCookieValue = unescape( $aTempCookie[1].replace(/^\s+|\s+$/g, '') );

			// note that in cases where cookie is initialized but no value, null is returned
			return $sCookieValue;
			break;

		}

		$aTempCookie = null;
		$sCookieName = '';

	}

	if(!$bCookieFound) return null;

	return true;

}

//Open referral form
function OpenForm($s){

	window.open($s,'login', 'fullscreen=no, toolbar=no, location=no, menubar=no, scrollbars=yes, resizable=no, height=550, width=750');

}

function ActAsLinkOver($id){ $($id).style.cursor = 'pointer'; }

function ActAsLinkOut($id){ $($id).style.cursor = 'default'; }

function Login(){


	var $pars = 'sCommand=Login&txtUserName=' + $F('txtUserName') + '&txtPassword=' + $F('txtPassword') +
				'&hdnRefer=' + $F('hdnRefer');

	var myAjax 	= new Ajax.Updater('login_result', '../library/common_ajax.php', { method: 'post',
					parameters: $pars, evalScripts: 'true', asynchronous: 'false' });

}

function DeleteFile($i){

	$sConfirm = confirm('Are you sure you want to delete the file "' + $F('hdnName' + $i) + '"?');

	if(!$sConfirm) return;

	var $pars = 'sCommand=DeleteFile&hdnName=' + $F('hdnName' + $i) + '&hdnRefer=' + $F('hdnRefer');

	var myAjax 	= new Ajax.Updater('delete_result', '../library/common_ajax.php', { method: 'post',
					parameters: $pars, evalScripts: 'true', asynchronous: 'false' });

}

//************************************************************************************************************
function MinMaxDiv($sEle){

	var $o = $($sEle);

	$o.toggle();

	if($o.style.display == 'none') Set_Cookie('TicketsAdmin_TicketOptions', '1', 30, '/', '','');
	else Set_Cookie('TicketsAdmin_TicketOptions', '0', 30, '/', '','');

}

//************************************************************************************************************
//By Default binds only to TEXTAREA inputs, but set $sText to true to bind all TEXT inputs
function SpellCheckBind($sForm, $bText){

	var $oSpan;
	var $oDiv;
	var $oText;
	var $sMarkerText;
	var $aInputs = $($sForm).getElements();

	$bText = DefaultArg($bText, false);

	$aInputs.each(function($sEle){

		if($sEle.type == 'textarea' || ($sEle.type == 'text' && $bText))
			Event.observe($sEle, 'keypress', ActivateSpellCheck);

	});

	if(!$('SpellCheckAjaxReturn')) {

	 	$oSpan 		= document.createElement('span');
	 	$oSpan.id 	= 'SpellCheckAjaxReturn';
	 	document.body.appendChild($oSpan);

	 }

	$sMarkerText = ($bText) ? 'SPELLCHECK ALL' : 'SPELLCHECK TEXTAREA';

	$oDiv					= document.createElement('div');
	$oDiv.id				= 'SpellCheckMarker';
	$oText					= document.createTextNode($sMarkerText);
	$oDiv.className			= 'spellcheckmarker';
	$oDiv.appendChild($oText);
	document.body.appendChild($oDiv);

}

//************************************************************************************************************
function ActivateSpellCheck(){

	if(event.keyCode == 19) SpellCheck(this);

}

//************************************************************************************************************
function SpellCheck($sEle){

	var $sText = $F($sEle);

	if($sText.strip()) AjaxUpdater('ajaxCommand=SpellCheckAjax&sEle=' + $($sEle).name + '&sText=' +
		encodeURIComponent($sText), 'SpellCheckAjaxReturn', $aURL.Common);

}

//************************************************************************************************************
function DefaultArg($sArg, $sValue){

	return typeof($sArg) != 'undefined' ? $sArg : $sValue;

}

/**
 * Comma creates a comma-delimited list of an array
 */
//************************************************************************************************************
function Comma($aArray, $sReturn, $sPrefix, $sSuffix){

	$sReturn = DefaultArg($sReturn, '');
	$sPrefix = DefaultArg($sPrefix, '');
	$sSuffix = DefaultArg($sSuffix, '');

	var $sTemp = '';

	if(IsArray($aArray)){

		$aArray.each(function($s, $index){

			if($s.strip() == '') throw $continue;

			$sTemp = $sTemp + $sPrefix + $s + $sSuffix;

			if(typeof($aArray[$index + 1]) != 'undefined') $sTemp = $sTemp + ',';

		}
		);

	}
	else if($sReturn != '') $sTemp = $sPrefix + $sReturn + $sSuffix;

	return $sTemp;

}

//************************************************************************************************************
function DebugPage($sError){

	if(_PRODUCTION) return;

	var $oWin = window.open('', 'Error', 'location=0, toolbar=0, status=1, resizable=1, '
				+ 'width=500, height=500, scrollbars=1, top=50, left=50');
	$oWin.document.write($sError + '<br />');

}


//************************************************************************************************************
function Pointer($sEle){

	$sEle.style.cursor='pointer';

}

//************************************************************************************************************
function StoreValueInSession($sValue, $sVariable, $sFilter){

	var $bReturn;

	$sFilter = DefaultArg($sFilter, false);

	if($sFilter){

	 	if(!InArray([32, 13, 190, 10, 188, 8], window.event.keyCode)) return false;

	}

	$bReturn = AjaxUpdater('ajaxCommand=StoreValueInSession&sTempVariable=' + encodeURIComponent($sVariable) +
				'&sTempValue=' + encodeURIComponent($sValue), 'Dirty', $aURL.Common);

	return $bReturn;

}

//************************************************************************************************************
function HideAll(){

	['day1', 'day2', 'day3', 'day4', 'day5'].each(function($i){

		$($i).hide();

	});

	Form_KeepAlive();

}

//************************************************************************************************************
function CloseRecord($sTable, $iID){

	AjaxUpdater('ajaxCommand=CloseRecord&iID=' + $iID + '&sTable=' + $sTable, 'Dirty', $aURL.Common,
		'false', 'get', 'false');

}

//************************************************************************************************************
function MonitorFormChange($sForm){

	Form.getElements($sForm).each(function($sEle){

		$sEle.observe('change', function(){ $('hdnChanged').value = 1; });

	});

}

//************************************************************************************************************
function DisableFieldsByPrefix($sForm, $sPrefix){

	$aFields = GetFormElementNamesbyPrefix($sForm, $sPrefix);

	$aFields.each(function($s){

		$($s).disable();

	});

}

//************************************************************************************************************
function SignDay($iID, $iDay, $iUserID, $sForm){

	AjaxUpdater('ajaxCommand=SignDayAjax&iID=' + $iID + '&iDay=' + $iDay + '&iUserID=' + $iUserID +
				'&sForm=' + $sForm, 'sig' + $iDay, $aURL.Forms, 'true', 'get');

	opener.location.reload();

}

//************************************************************************************************************
function SignDayDelete($iID, $iDay, $iUserID, $sForm){

	AjaxUpdater('ajaxCommand=SignDayAjaxDelete&iID=' + $iID + '&iDay=' + $iDay + '&iUserID=' + $iUserID +
				'&sForm=' + $sForm, 'sig' + $iDay, $aURL.Forms, 'true', 'get');

	opener.location.reload();

}

//************************************************************************************************************
function Load_AutoCompleteUser($sFunc){

	$myAjax = new Ajax.Autocompleter("autocomplete_name", "autocomplete_name_choices",
				"/library/common.php?ajaxCommand=UserLookup",
				{afterUpdateElement: $sFunc, minChars: 2});

}

//************************************************************************************************************
function Load_AutoCompletePatientDocuments($sFunc){

	$myAjax = new Ajax.Autocompleter('autocomplete_name', 'autocomplete_name_choices',
				'/library/common.php?ajaxCommand=PatientLookupDocuments',
				{afterUpdateElement: $sFunc});

}

//************************************************************************************************************
function Load_AutoComplete($sFunction, $sLookupFunction, $sCompleteType){

	$sCompleteType = typeof($sCompleteType) != 'undefined' ? '_' + $sCompleteType : '';

	$myAjax = new Ajax.Autocompleter('autocomplete' + $sCompleteType + '_name',
				'autocomplete' + $sCompleteType + '_name_choices',
				'/library/common.php?ajaxCommand=' + $sLookupFunction + '&sCompleteType=' +
				$sCompleteType,
				{afterUpdateElement: $sFunction,
				paramName: 'autocomplete' + $sCompleteType + '_parameter_name'});

}

//************************************************************************************************************
function Load_AutoCompleteProvider($sFunc){

	$myAjax = new Ajax.Autocompleter("autocomplete_provider_name", "autocomplete_provider_name_choices",
				"/library/common.php?ajaxCommand=ProviderLookup",
				{afterUpdateElement: $sFunc, minChars: 2});

}

//************************************************************************************************************
function Load_AutoCompletePatient($sFunc){


	var $myAjax = new Ajax.Autocompleter("autocomplete_name", "autocomplete_name_choices",
					"/library/common.php?ajaxCommand=PatientLookup",
					{afterUpdateElement: $sFunc, minChars: 2});

	return $myAjax;

}

//************************************************************************************************************
function Load_AutoCompleteTicket($sFunc){

	var $myAjax = new Ajax.Autocompleter("autocomplete_ticket_name", "autocomplete_ticket_name_choices",
				"/library/common.php?ajaxCommand=TicketLookup",
				{callback: function($x, $s){ return $s + '&chkDescription=' +
					$('chkDescription').checked; }, afterUpdateElement: $sFunc, minChars: 2,
					indicator: 'indicator1'});

	return $myAjax;

}

//************************************************************************************************************
function ResetJump($sValue, $obj){

	$($obj).selectedIndex 	= 0;
	window.top.location 	= $sValue;

}

//************************************************************************************************************
function ShowD($s){

	if($('a' + $s).innerHTML == '+') $('a' + $s).innerHTML='-';
	else	$('a' + $s).innerHTML='+';

	$('d' + $s).toggle();

}

//************************************************************************************************************
function EmailNotificationAjax($sMessage, $sSubject, $sTo, $sFrom, $sCC){

	$sSubject = typeof($sSubject) != 'undefined' ? $sSubject : 'Test';
	$sTo 	= typeof($sTo) != 'undefined' ? $sTo : 'it@pridedallas.com';
	$sFrom 	= typeof($sFrom) != 'undefined' ? $sFrom : '';
	$sCC 	= typeof($sCC) != 'undefined' ? $sCC : '';
	$sPars	= 'ajaxCommand=EmailNotificationAjax&sMessage=' + $sMessage + '&sSubject=' + $sSubject +
				'&sTo=' + $sTo + '&sFrom=' + $sFrom + '&sCC=' + $sCC;

	AjaxUpdater($sPars, 'MessageResults', $aURL.Common);

}

//************************************************************************************************************
function ConfirmAndSubmit($sText, $sName, $sValue, $sFormName){

	$sFormName 	= typeof($sFormName) != 'undefined' ? $sFormName : 'frmMain';
	$sAnswer 		= confirm($sText);

	if($sAnswer){

		$('hdncomphere').innerHTML = '<input type="hidden" name="' + $sName + '"' +
								'value="' + $sValue + '">';
		$($sFormName).submit();

	}

}

//************************************************************************************************************
function DelConfirm($sLastName, $sFirstName, $sCase, $sEpisode, $sID){

	$sAnswer = confirm('Are you sure you want to delete ' + $sLastName + ', ' + $sFirstName +
				' (' + $sCase + ' - ' + $sEpisode + ')');

	if($sAnswer){

		$('hdndelhere' + $sID).innerHTML = '<input type="hidden" name="cmdDelete" value="Delete">';
		window.document.forms('frmUpdate' + $sID).submit('test');

	}
}

//************************************************************************************************************
function MarkOPNOPC($iSkey, $sType){

	if($iSkey == '') return;

	$sDate = $F('hdnEndDate' + $iSkey);

	if($sDate == ''){

		alert('No End Date entered!');
		return;

	}
	else{

		$sConfirm = confirm('Mark patient ' + $sType + ' and enter discharge date of ' + $sDate + ' ?');

		if($sConfirm){

			AjaxUpdater('ajaxCommand=MarkOPNOPC&iSkey=' + $iSkey + '&sDate=' + $sDate + '&sType=' +
				$sType, 'results', $aURL.OPT, 'false', 'get');

		}

	}

}

//************************************************************************************************************
function MarkORD($iSkey){

	if($iSkey == '') return;

	$sConfirm = confirm('Mark patient ORD?');

	if($sConfirm){

		AjaxUpdater('ajaxCommand=MarkORD&iSkey=' + $iSkey, 'results', $aURL.OPT, 'true', 'get');

	}

}

//************************************************************************************************************
function LoadGrid($sPage, $s, $iRowOffset){

	AjaxUpdater('sFunction=LoadGrid&s=' + $s + '&iRowOffset=' + $iRowOffset, 'Grid', $aURL[$sPage], 'false',
		'get');

}

function Login(){


	var $pars = 'sCommand=Login&txtUserName=' + $F('txtUserName') + '&txtPassword=' + $F('txtPassword') +
				'&hdnRefer=' + $F('hdnRefer');

	var myAjax 	= new Ajax.Updater('login_result', '../library/common_ajax.php', { method: 'post',
					parameters: $pars, evalScripts: 'true', asynchronous: 'false' });

}


if(document.images) {

	var compn = new Image();
	compn.src = "images/button_physicians_up.gif";
	var compa = new Image();
	compa.src = "images/button_physicians_do.gif";
	var servn = new Image();
	servn.src = "images/button_services_up.gif";
	var serva = new Image();
	serva.src = "images/button_services_do.gif";
	var clien = new Image();
	clien.src = "images/button_referral_up.gif";
	var cliea = new Image();
	cliea.src = "images/button_referral_do.gif";
	var linkn = new Image();
	linkn.src = "images/button_publications_up.gif";
	var linka = new Image();
	linka.src = "images/button_publications_do.gif";
	var linxn = new Image();
	linxn.src = "images/button_directions_up.gif";
	var linxa = new Image();
	linxa.src = "images/button_directions_do.gif";
	var dinkn = new Image();
	dinkn.src = "images/button_staff_up.gif";
	var dinka = new Image();
	dinka.src = "images/button_staff_do.gif";
	var dinln = new Image();
	dinln.src = "images/button_outcomes_do.gif";
	var dinla = new Image();
	dinla.src = "images/button_outcomes_up.gif";
	var dinmn = new Image();
	dinmn.src = "images/button_home_up.gif";
	var dinma = new Image();
	dinma.src = "images/button_home_do.gif";

}

//************************************************************************************************************
function ActAsLinkOver($id){

	$($id).style.cursor = 'pointer';

}

//************************************************************************************************************
function ActAsLinkOut($id){

	($id).style.cursor = 'default';

}

//************************************************************************************************************
function act(imgName){ if(document.images)document[imgName].src = eval(imgName + 'a.src'); }

//************************************************************************************************************
function inact(imgName){ if(document.images) document[imgName].src = eval(imgName + 'n.src'); }

//************************************************************************************************************
//Open window using select index, except if blank
function cbojump($s){ if($s != '') window.location.href=$s; }

//************************************************************************************************************
//Manual hyperlinks
function showlinks($iMenu){

	for($i = 0; $i < 5; $i++){ if($i != $iMenu && $('sub' + $i)) $('sub' + $i).style.display = 'none'; }
	if($('sub' + $iMenu).style.display == 'none') $('sub' + $iMenu).style.display = 'inline';
	else	$('sub' + $iMenu).style.display = 'none';

}

//************************************************************************************************************
//Open referral form
function OpenForm($s){

	window.open($s,'login', 'fullscreen=no, toolbar=no, location=no, menubar=no, scrollbars=yes, resizable=no, height=550, width=750');

}

//************************************************************************************************************
function ShowGrid($sForm, $sParam1){

	if($sForm + '' == ''){

		alert('Form not specified!');

		return true;

	}

	AjaxUpdater('ShowGrid=Grid&sForm=' + $sForm + '&param1=' + $sParam1, 'Grid', $aURL.FormMaint, 'false',
		'get');

	return true;

}

//************************************************************************************************************
function AddSlashesJS($s) {

	if($s === null) return '';
	else{

		$s = $s.replace(/\'/g,"\\'");
		$s = $s.replace(/\"/g,'\\"');
		$s = $s.replace(/\\/g,'\\\\');
		$s = $s.replace(/\0/g,'\\0');

	}

	return $s;

}

//************************************************************************************************************
function CleanForURL($s) {

	if($s === null) return '';
	else{

		$s = $s.replace(/\'/g,'%27');
		$s = $s.replace(/\"/g,'%22');
		$s = $s.replace(/\\/g,'%5C');
		$s = $s.replace(/\\/g,'%5C');
		$s = $s.replace(/&/g, '%26');
		$s = $s.replace(/\?/g, '%3F');
		$s = $s.replace(/#/g, '%23');
		$s = $s.replace(/ /g, '%20');

	}

	return $s;

}

//************************************************************************************************************
function StripSlashesJS($s) {

	if($s === null) return '';
	else{

		$s=$s.replace(/\\'/g,'\'');
		$s=$s.replace(/\\"/g,'"');
		$s=$s.replace(/\\\\/g,'\\');
		$s=$s.replace(/\\0/g,'\0');

	}

	return $s;

}

//************************************************************************************************************
function PageBreak3($sElementClass, $iPageLength, $sForceBreak1, $sHeader){

	if($iPageLength == '') $iPageLength = 900; 	//Total Page Length

	$iCurrentTotalLength = 0; 	//Total length of current elements on page
	$aSec = window.document.getElementsByClassName($sElementClass);	//Get elements by class

	for($i = 0; $i < $aSec.length; $i ++){

		if($aSec[$i]){

			$iCurrentTotalLength 	= $iCurrentTotalLength + $aSec[$i].offsetHeight;
			$iElementLength 		= $aSec[$i].offsetHeight;

			if($aSec[$i].id == $sForceBreak1) {

			   	$aSec[$i].style.pageBreakBefore = "always";
			   	$iCurrentTotalLength = 0;

			}
			else{

			   	if($iCurrentTotalLength > ($iPageLength)) {

					if(typeof($sHeader) != 'undefined') {

					 	new Insertion.Before($aSec[$i], $sHeader);
					 	$iCurrentTotalLength = $aSec[$i].offsetHeight;

					 }
					 else {

					 	$aSec[$i].style.pageBreakBefore = "always";
					 	$iCurrentTotalLength = $aSec[$i].offsetHeight;

					 }

			   	}

			}

		}

	}

}

//Open window, except if blank********************************************************************************
function JumpCBO($sEle){

	if($sEle != '') location = $F($sEle);

}

//Maximize window*********************************************************************************************
function Maximize(){

	window.moveTo(0,0);
	window.resizeTo(screen.width,screen.height);

}

//************************************************************************************************************
function JumpCHK($sLoc, $this){

	if($this.checked) $sChecked = '?' + $this.name + '=on';
	else $sChecked = '?' + $this.name + '=off';

	location = $sLoc + $sChecked;

}

//************************************************************************************************************
function JumpMenu_AddPatient(targ, selObj){ //v3.0

	eval(targ + ".location='http://intranet/patient_schedule_add.php?cboPatientid=" +
		selObj.options[selObj.selectedIndex].value + "'");

}

//************************************************************************************************************
function PopUp(URL, w, h, sc, r, id) {

	day = new Date();

	if(id == '') id = day.getTime();

	eval("page" + id + " = window.open(URL, '" + id
		+ "', 'toolbar=0,scrollbars=" + sc + ",location=0,status=1,menubar=0,resizable="
		+ r + ",width=" + w +",height=" + h + ",left = 10,top = 10');");

}

//************************************************************************************************************
function HighlightElementOn($sEle, $sChangeText){

	$sChangeText 					= ($sChangeText == 'true') ? 'Click to Change' : '';
	$($sEle).style.cursor			= 'pointer';
	$($sEle).style.backgroundColor	= '#FFFF00';

	if($sChangeText) ddrivetip($sChangeText, 100);

}

//************************************************************************************************************
function HighlightElementOff($sEle, $sBGColor){

	$sBGColor 					= typeof($sBGColor) != 'undefined' ? $sBGColor : '#D9DFDB';
	$($sEle).style.backgroundColor 	= $sBGColor;

	if(typeof(tipobj) != 'undefined') hideddrivetip();

}

//************************************************************************************************************
function PopUpDialog($sURL, $sID, $sScroll, $sStatus) {

	day 		= new Date();
	$sID 	= typeof($sID) != 'undefined' ? $sID : day.getTime();
	$sScroll 	= typeof($sScroll) != 'undefined' ? $sScroll : 0;
	$sStatus 	= typeof($sStatus) != 'undefined' ? $sStatus : 0;

	window.open($sURL, $sID, 'toolbar=0,scrollbars=' + $sScroll +
		',location=0,status=' + $sStatus +
		',menubar=0,resizable=0,width=50,height=50,left=10,top=10');
//	window.showModalDialog($sURL, '', 'dialogWidth:50px;dialogHeight:50px;scroll' + $sScroll + ';status:' +
//		$sStatus)

}

//************************************************************************************************************
function FindEvent($sURL, $sMonth, $sYear, $sENOrgID, $sTitle) {

	window.open($sURL,'','width=535,height=400,directories=no,location=no,menubar=no,scrollbars=yes,' +
		'resizable=no');
	location = "/community/department/default.asp?Orgid=" + $sENOrgID + "&DeptTitle=" + $sTitle
		+ "&App=9&SC=Y&month=" + $sMonth + "&year=" + $sYear;

}

//************************************************************************************************************
function TimeOut($sFunction, $sTime){

    setTimeout($sFunction, $sTime  * 1000);

}

//************************************************************************************************************
function RefreshPage(){

	var $sURL = unescape(location);
	location.replace($sURL);

}

//************************************************************************************************************
function IsArray(obj) {

   if(obj.constructor.toString().indexOf("Array") == -1) return false;
   else return true;

}

//Open report window******************************************************************************************
function ReportOpen($sReport){

	if($sReport != ''){

		window.open('/' + $sReport,'reporting_all', 'channelmode=yes, toolbar=yes, location=no, ' +
			'menubar=no, scrollbars=yes, resizable=yes, fullscreen=no, status=yes');

	}

}

//************************************************************************************************************
function RM5DataUpdateAjax($skey, $sNoReload){

	if($skey == 'All') $sPars = 'all=all';
	else $sPars = 'all_skey=' + $skey;

	AjaxUpdater($sPars, 'RM5DataUpdateHTML', '../library/rm5_data_update_code.php', 'false', 'get');

	if($sNoReload === true) return;
	else window.location.reload();

}

//************************************************************************************************************
function UpdateSchedules(){

	AjaxUpdater('ajaxFunction=PatientSchedules', 'UpdateSchedules', '../library/rm5_data_update_code.php',
		'false', 'get');

	window.location.replace(window.document.URL);

}

//************************************************************************************************************
function AjaxUpdater($sPars, $sID, $sURL, $sAsync, $sMethod, $sEvalScripts){ //Generic Ajax Updater function

	//Async Default 		= true
	//Method Default 		= POST
	//EvalScripts Default 	= true

	$sMethod 		= (typeof($sMethod) == 'undefined' || ($sMethod != 'get' && $sMethod != 'post')) ?
					'post' : $sMethod;
	$sAsync 		= (typeof($sAsync) == 'undefined' || ($sAsync != 'true' && $sAsync != 'false')) ?
					'true' : $sAsync;
	$sEvalScripts 	= (typeof($sEvalScripts) == 'undefined' || ($sEvalScripts != 'true' &&
					$sEvalScripts != 'false')) ? 'true' : $sEvalScripts;

	$sAjax = new Ajax.Updater(AjaxID($sID), $sURL, { method: $sMethod, asynchronous: $sAsync,
				evalScripts: $sEvalScripts, parameters: $sPars });

	return $sAjax;

}

//************************************************************************************************************
function AjaxID($sEle, $sEleType){

	$sEle		= DefaultArg($sEle, 'AjaxIDPlaceHolder53542354');
	$sEleType 	= DefaultArg($sEleType, 'span');

	if(!$($sEle)){

	 	var $oEleID = window.document.createElement($sEleType);

	 	$oEleID.id	= $sEle;
	 	document.body.appendChild($oEleID);

	}

	return $sEle;

}

//************************************************************************************************************
function Landscape($sReport){

	if($sReport == 'Phase3and4'){

		$('phase3results').style.width = '960px';
		$('title').style.fontSize = "24px";
		$aTD = window.document.getElementsByClassName('phase3');

		for($i = 0; $i < $aTD.length; $i ++) $aTD[$i].style.fontSize = '20px';

		$aTD = window.document.getElementsByClassName('subheading');

		for($i = 0; $i < $aTD.length; $i ++) $aTD[$i].style.fontSize = '20px';

		$aTD = window.document.getElementsByClassName('header');

		for($i = 0; $i < $aTD.length; $i ++) $aTD[$i].style.fontSize = '20px';

	}

	window.print();

}

//************************************************************************************************************
function NewCal($sEle){

	if($($sEle)){

		//This variable has to be global
		cal1				= new calendar2($($sEle));
		cal1.year_scroll 	= true;
		cal1.time_comp 		= false;

	}

}

//************************************************************************************************************
function Dirty(){

	$('Dirty').innerHTML = '...';

}

//This is now the only UpdateField function that should be used.
//1 Argument: 	$($sField).name, $F($sField), $F('sForm'), $F('id')
//3 Arguments: 	$($sField).name, $F($sField), $sTable, $id
//4 Arguments:	$($sField).name, $F($sField),
//************************************************************************************************************
function UpdateField($sField, $sTable, $iID, $sValue){

	var $sName 			= '';
	var $sFieldData 	= '';
	var $sFieldNames	= '';

	$(AjaxID('Dirty')).update('');

	//If $sField is not an element, use $sField as the field name
	if(!$($sField)) $sName = $sField;
	else $sName = $($sField).name;

	//If $sValue isn't passed, use $F($sField)
	if(typeof($sValue) == 'undefined'){

		if($($sField)){

			if($($sField).type == 'checkbox' && $($sField).checked === false) $sValue = '';
			else $sValue = $F($sField);

		}
		else $sValue = $sField;

	}

	$sFieldNames 	= 'sFieldNames=' + $sName;
	$sFieldData		= '&sFieldData=' + CleanForURL($sValue);
	$sTable 		= '&sForm=' + DefaultArg($sTable, $('sForm') ? $F('sForm') : '');
	$iID 			= '&ID=' + DefaultArg($iID, $('id') ? $F('id') : '');

	if($('modified_by_field')){

		$sFieldNames 	= $sFieldNames + '|||' + $F('modified_by_field');
		$sFieldData 	= $sFieldData + '' + '|||' + $F('modified_by_value');

	}

	var $sPars = encodeURI($sFieldNames + $sFieldData  + $iID + $sTable + '&ajaxCommand=UpdateFields');

	AjaxUpdater($sPars, AjaxID('Dirty'), $aURL.Forms, 'false', 'post');

}

//Uses $sField for column name, $sValue for column data, $sTable for table name, $iID for key
//************************************************************************************************************
function UpdateField4($sField, $sValue, $sTable, $iID){

	var $sFieldNames 	= 'sFieldNames=' + $sField;
	var $sFieldData		= '&sFieldData=' + CleanForURL($sValue);

	if($('modified_by_field')){

		$sFieldNames 	= $sFieldNames + '|||' + $F('modified_by_field');
		$sFieldData 	= $sFieldData + '' + '|||' + CleanForURL($F('modified_by_value'));

	}

	var $sPars = encodeURI($sFieldNames + $sFieldData + '&ID=' + $iID + '&sForm=' + $sTable +
					'&ajaxCommand=UpdateFields');

	AjaxUpdater($sPars, 'Dirty', $aURL.Forms, 'false', 'get');

}

//Uses $($sField) for column name, $sValue for column data, hidden input named sForm for table name,
//hidden input named id for key
//************************************************************************************************************
function UpdateField5($sField, $sValue){

	var $sFieldNames 	= 'sFieldNames=' + $sField;
	var $sFieldData		= '&sFieldData=' + CleanForURL($sValue);

	if($('modified_by_field')){

		$sFieldNames 	= $sFieldNames + '|||' + $F('modified_by_field');
		$sFieldData 	= $sFieldData + '' + '|||' + CleanForURL($F('modified_by_value'));

	}

	var $sPars = encodeURI($sFieldNames + $sFieldData + '&ID=' + $F('id') + '&sForm=' + $F('sForm') +
					'&ajaxCommand=UpdateFields');

	AjaxUpdater($sPars, 'Dirty', $aURL.Forms, 'false', 'get');

}

//Uses $sField for column name, $sValue for column data, $sTable for table name, $iID for key
//************************************************************************************************************
function UpdateFieldRM5($sField, $sValue, $sTable, $skey){

	var $sFieldName = 'sFieldName=' + $sField;
	var $sFieldData	= '&sFieldData=' + CleanForURL($sValue);

	var $sPars = encodeURI($sFieldName + $sFieldData + '&skey=' + $skey + '&sTable=' + $sTable +
					'&ajaxCommand=UpdateFieldRM5');

	AjaxUpdater($sPars, 'Dirty', $aURL.Forms, 'false', 'get');

}

//************************************************************************************************************
function VerifyPatientExists(){

	if($F('ssn2') == '' || $F('episode') == '' || $F('doi') == '') return false;
	else
	 	AjaxUpdater('sSSN=' + $F('ssn2') + '&sEpisode=' + $F('episode') + '&sOnDate=' + $F('doi') +
	 		'&ajaxCommand=VerifyPatientExists', 'AjaxMessages', $aURL.Forms);

	return true;

}

//************************************************************************************************************
function RM5DataUpdateAjaxAll($sAsync){

	$sAsync = ($sAsync == false) ? 'false' : 'true';

	alert('Click only once!');

	AjaxUpdater('all_rm5=yes', 'RM5DataUpdateHTML', '../library/rm5_data_update_code.php');

	location.reload();

}

//************************************************************************************************************
function RM5DataUpdateAjaxFunction($sFunction, $sParam1, $sAsync){

	$sAsync = ($sAsync == 'false') ? 'false' : 'true';

	AjaxUpdater('ajaxFunction=' + $sFunction + '&param1=' + $sParam1, 'RM5DataUpdateHTML',
		'../library/rm5_data_update_code.php', $sAsync, 'get');

}

//Show element ($item) when select option ($index) is matched ($match)****************************************
function ShowItemCBO($index, $match, $item){

	$sMatchNoMatch = false;

	if(IsArray($match)){

		for($i = 0; $i < $match.length; $i ++)
			if($index == $match[$i]) $sMatchNoMatch = true;

	}
	else if($index == $match) $sMatchNoMatch = true;

	if($sMatchNoMatch) $($item).show();
	else{

		$($item).hide();
		$($item).value = '';

	}

}

//Show element ($item) when select option ($index) is matched ($match)****************************************
function ShowItem($value, $match, $item){

	if($value == $match) $($item).show();
	else $($item).hide();

}

//Show and Hide element when box is checked and unchecked*****************************************************
function ShowItemCHK($sChk, $sID){

	if(($($sChk).checked) === true) $($sID).show();
	else $($sID).hide();

}

//Clear a text box if Checkbox is not checked*****************************************************************
function ClearTextIfNotChecked($sChkID, $sTextID){ if($($sChkID) != true) $($sTextID).value = ''; }

//Clear a text box if Checkbox is checked*********************************************************************
function ClearTextIfChecked($sChkID, $sTextID){ if($($sChkID).checked === true) $($sTextID).value = ''; }

//Check box if Text is changed********************************************************************************
function CheckIfTextChanged($sTextID, $sChkID){

	if($F($sTextID)){

	 	$($sChkID).checked = true;
		UpdateField($sChkID);

	 }
	 else{

	 	$($sChkID).checked = false;
		UpdateField($sChkID);

	 }

}

//Uncheck box if Text is changed******************************************************************************
function UnCheckIfTextChanged($sTextID, $sChkID){

	if($F($sTextID) == '') $($sChkID).checked = true;
	else $($sChkID).checked = false;

}

//************************************************************************************************************
function ClearSubs($sField){

	if($($sField).checked == true) return;

	$aFields = GetFormElementNamesbyPrefix('frmMain', $sField);

	$sFieldNames 	= '';
	$sFieldData 	= '';

	$aFields.each(function($sField){

		$($sField).checked 	= false;
		$($sField).value	= '';

		$sFieldNames 	= $sFieldNames + $($sField).name + '|||';
		$sFieldData	= $sFieldData + '' + '|||';

	});

	if($sFieldNames) $sFieldNames = $sFieldNames.substr(0, $sFieldNames.length - 3);
	if($sFieldData) $sFieldData = $sFieldData.substr(0, $sFieldData.length - 3);

	AjaxUpdater('sFieldNames=' + $sFieldNames + "&sFieldData=" + CleanForURL($sFieldData) + '&ID=' +
		$F('id') + '&sForm=' + $F('sForm') + '&ajaxCommand=UpdateFields', 'Dirty',
		$aURL.Forms);

}

//************************************************************************************************************
//Pass $iID = 0 if ID is unknown
function FormOpen($iID, $iFormNum, $iSkey, $sForm, $sNoReload, $sFormName, $sNew){

	$sFormName = typeof($sFormName) != 'undefined' ? $sFormName : $sForm;

	if($sNew == true){

		$answer = confirm('Create a new ' + $sFormName + '?');

		if($answer === false) return;

	}

	if($sForm == 'inf'){

		$sURL = '/form.php?id=' + $iID + '&sForm=' + $sForm;

		if($iID > 0){

			window.open($sURL,'form1', 'channelmode=yes, toolbar=yes, ' +
				'location=no, menubar=no, scrollbars=yes, resizable=yes, fullscreen=no, status=yes');

			if($('cboCaseNumStatus')) $('cboCaseNumStatus').value='';

		}
		else alert('ID is missing!');

	}
	else{

		$sURL = '/form.php?id=' + $iID + '&skey=' + $iSkey + '&sForm=' + $sForm + '&iFormNum=' + $iFormNum;

		if($iID || $iSkey){

			window.open($sURL,'form1', 'channelmode=yes, toolbar=yes, ' +
				'location=no, menubar=no, scrollbars=yes, resizable=yes, fullscreen=no, status=yes');

			if($('cboCaseNumStatus')) $('cboCaseNumStatus').value='';

		}
		else alert('ID and Skey missing!');

	}

	if(!$sNoReload) location.reload();

}

//************************************************************************************************************
function FormOpenNoSession($iID, $iFormNum, $iSkey, $sForm, $sNoReload, $sFormName, $sNew){

	$answer = true;

	if($sNew == true) $answer = confirm('Create a new ' + $sFormName + '?');

	if($answer === false) return;

	//For opening the form without session set
	$sForm = ($sForm != '') ? '&sForm=' + $sForm : '';

	$sURL = '/form.php?id=' + $iID + '&skey=' + $iSkey + $sForm + '&iFormNum=' + $iFormNum;

	if($iID || $iSkey){

		window.open($sURL,'form1', 'channelmode=yes, toolbar=yes, ' +
			'location=no, menubar=yes, scrollbars=yes, resizable=yes, fullscreen=no, status=yes');

		if($('cboCaseNumStatus')) $('cboCaseNumStatus').value='';

	}
	else alert('ID or Skey missing!');

	if($sNoReload != true) location.reload();

}

//************************************************************************************************************
function Debug($s){

	if(!_PRODUCTION) alert($s);

}

//************************************************************************************************************
function PrintNotes($sID, $sForm){

	if($sID != ''){

		window.open('/form_notes.php?id=' + $sID + '&sForm=' + $sForm, 'form_notes1',
			'channelmode=yes, toolbar=no,' +
			'location=no, menubar=no, scrollbars=yes, resizable=yes, fullscreen=no, status=yes');

	}

}

//Open report window******************************************************************************************
function FormReportOpen($sID, $sForm, $sOverwrite){

	var $sURL 		= 'library/load_report.php';
	var $sReport	= 'reports/saved/' + $sForm + '/' + $sID + '.htm';

	if($sID != '' && $sID != null){

		$sURL = '/' + $sURL + '?id=' + $sID + '&sReport=' + $sReport + '&sForm=' + $sForm +
				'&sOverwrite=' + $sOverwrite;

		window.open($sURL, 'form_report',
			'channelmode=yes, toolbar=yes, location=no, menubar=no, scrollbars=yes, ' +
			'resizable=yes, fullscreen=no, status=yes');

		if($('cboCaseNumStatus')) $('cboCaseNumStatus').value='';

	}

}

//Supress form submission by Enter key************************************************************************
function CheckEnter($oEvent){ //$e is event object passed from function invocation

	//if which property of event object is supported (NN4)
	if($oEvent && $oEvent.which){

			$oEvent 			= $oEvent;
			characterCode 	= $oEvent.which;

	}//character code is contained in NN4's which property
	else{

		$oEvent 			= event;
		characterCode 	= $oEvent.keyCode;

	}//character code is contained in IE's keyCode property

	//if generated character code is equal to ascii 13 (if enter key)
	if(characterCode == 13) return false;
	else return true;

}

//************************************************************************************************************
function GetFormElementNamesbyPrefix($sFormName, $sPrefix){

	$aFormFields 	= $($sFormName).getElements();
	$aReturn		= new Array();

	$aFormFields.each(function($sField){

		if($sField.name.startsWith($sPrefix)) $aReturn[$aReturn.length] = $sField;

	});

	return $aReturn;

}

//************************************************************************************************************
function InArray($aArray, $sMatch){

	for($x = 0; $x <= $aArray.length; $x ++){

		if($aArray[$x] == $sMatch) return true;

	}

	return false;
}

//************************************************************************************************************
function GetSerializedFieldDatabyPrefix($sFormName, $sPrefix){

	$aFormFields 	= GetFormElementNamesbyPrefix($sFormName, $sPrefix);
	$sReturn		= '';

	$aFormFields.each(function($sField){

		$sReturn = $sReturn + '&' + $sField.name + '=' + $F($sField);

	});

	return $sReturn;

}

//Clear a TEXT value******************************************************************************************
function ClearValue($sClearID, $sCurrentID, $sNoClearID){

	if($($sCurrentID) != $sNoClearID) $($sClearID).value = '';

}

//************************************************************************************************************
function EditForm($sPage, $sCommand, $sField){

	//If Report was pressed, save the form first
	if($sCommand == 'Report') EditForm($sPage, 'UpdateReport', $sField);

	if($($sField)) $skey = $F($sField);
	else $skey = $sField;

	if($sCommand == 'Update' || $sCommand == 'UpdateReport'){

		$sResults 	= 'MessageResults';
		$sPars 	= 'ajaxCommand=Update&skey=' + $skey + '&' + Form.serialize('frmPatient');

	}
	else{

		$sResults	= 'PatientResults';
		$sPars 	= 'ajaxCommand=' + $sCommand + '&skey=' + $skey;

	}

	AjaxUpdater($sPars, $sResults, $aURL[$sPage], 'false');

	if($sCommand == 'Update')
		AjaxUpdater('ajaxCommand=EditForm&skey=' + $skey, 'PatientResults', $aURL[$sPage], 'false');

}

//************************************************************************************************************
function CheckDate($sValue, $sID){

	return;

	$aDays = new Array('a', 'b', 'c', 'd', 'e');

	$oDate = new Date($sValue + ' 00:00:00');

	$sCorrectDay = $sID.charAt($sID.length - 1);

	if($aDays[$oDate.getDay() - 1] != $sCorrectDay){

		alert("Your date is does not match the DAY selected.");
		$($sID).value = '';

	}


}

//************************************************************************************************************
function CheckClear($ID){

	if($($ID).checked === false){

		$sInput = '<input type="hidden" name="' + $ID.name + '" value="">';
		new Insertion.Before($ID.name, $sInput);

	}

}

//************************************************************************************************************
//* AnyLink Vertical Menu- © Dynamic Drive (www.dynamicdrive.com)
//* This notice MUST stay intact for legal use
//* Visit http://www.dynamicdrive.com/ for full source code
//************************************************************************************************************

//Contents for menu 1
var menu1=new Array();
menu1[0]='<A href="../mayer.php">Tom Mayer, M.D.</A>';
//menu1[1]='<A href="../polatin.php">Peter Polatin, M.D.</A>';
//menu1[2]='<A href="../adams.php">Tracey Adams, M.D.</A>';
menu1[1]='<A href="../gatchel.php">Robert Gatchel, Ph.D.</A>';
//menu1[3]='<A href="../kmayer.php">Eric AK Mayer, M.D.</A>';
menu1[2]='<A href="../cohen.php">Howard Mark Cohen, M.D.</A>';
menu1[3]='<A href="../fino.php">Sam A. Fino, M.D.</A>';
menu1[4]='<A href="../powell.php">Gregory Powell, M.D.</A>';

//Contents for menu 2, and so on
var menu2=new Array();
menu2[0]='<A href="https://mail.pridedallas.com/Exchange" TARGET="_parent">WebMail (OWA)</A>';
menu2[1]='<A href="http://mail.pridedallas.com" TARGET="_parent">Extranet</A>';
menu2[2]='<A href="forms/7001A.pdf" TARGET="_blank">Patient Assement Form</A>';
menu2[3]='<A href="http://www.techinline.com/?eid=a2f4cf93-8162-4f2d-a061-d518afadd888" TARGET="_parent">' +
		'TechInline</A>';
menu2[4]='<A href="files.php" TARGET="_parent">Files</A>';
menu2[5]='<A href="files_upload.php" TARGET="_parent">Upload Files</A>';

var disappeardelay=250; //menu disappear speed onMouseout (in miliseconds)
var horizontaloffset=2; //horizontal offset of menu from default location. (0-5 is a good value)

/////No further editting needed

var ie4=document.all;
var ns6=document.getElementById&&!document.all;

if(ie4||ns6)
	document.write('<div id="dropmenudiv" style="visibility:hidden;width: 160px" ' +
		'onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>');

//************************************************************************************************************
function getposOffset($sEle, $sOffSetType){

	var $iTotalOffset	= $sOffSetType=="right" ? $sEle.offsetRight : $sEle.offsetTop;
	var $sParentEle	= $sEle.offsetParent;

	while($sParentEle != null){

		$iTotalOffset= $sOffSetType == "right" ? $iTotalOffset + $sParentEle.offsetRight :
					$iTotalOffset + $sParentEle.offsetTop;

		$sParentEle = $sParentEle.offsetParent;

	}

	return $iTotalOffset;

}

//************************************************************************************************************
function showhide(obj, e, visible, hidden, menuwidth){

	if(ie4||ns6) DROPMENU.style.left=DROPMENU.style.top=-500;

	DROPMENU.widthobj=DROPMENU.style;
	DROPMENU.widthobj.width=menuwidth;

	if(e.type=="click" && obj.visibility==hidden || e.type=="mouseover") obj.visibility=visible;
	else if(e.type=="click") obj.visibility=hidden;

}

//************************************************************************************************************
function iecompattest(){

	return (document.compatMode && document.compatMode!="BackCompat") ?
			document.documentElement : document.body;

}

//************************************************************************************************************
function clearbrowseredge($oEle, $sWhichEdge){

	var $iEdgeOffset = 0;
	var $iWindowEdge;

	if($sWhichEdge == "rightedge"){

		$iWindowEdge = ie4 && !window.opera ? iecompattest().scrollLeft + iecompattest().clientWidth-15 :
						window.pageXOffset + window.innerWidth-15;

		DROPMENU.contentmeasure = DROPMENU.offsetWidth;

		if($iWindowEdge - DROPMENU.x - $oEle.offsetWidth < DROPMENU.contentmeasure)
			$iEdgeOffset = DROPMENU.contentmeasure + $oEle.offsetWidth;

	}
	else{

		var $iTopEdge	= ie4 && !window.opera ? iecompattest().scrollTop : window.pageYOffset;
		$iWindowEdge	= ie4 && !window.opera ? iecompattest().scrollTop+iecompattest().clientHeight-15 :
						window.pageYOffset+window.innerHeight-18;

		DROPMENU.contentmeasure = DROPMENU.offsetHeight;

		 //move menu up?
		if($iWindowEdge - DROPMENU.y < DROPMENU.contentmeasure){

			$iEdgeOffset = DROPMENU.contentmeasure-$oEle.offsetHeight;

			//up no good either? (position at top of viewable window then)
			if((DROPMENU.y - $iTopEdge) < DROPMENU.contentmeasure) $iEdgeOffset = DROPMENU.y;

		}

	}

	return $iEdgeOffset;

}

//************************************************************************************************************
function populatemenu($sEle){

	if(ie4||ns6) DROPMENU.innerHTML = $sEle.join("");

}

//************************************************************************************************************
function dropdownmenu($oObj, $oEle, $sMenuContents, $iMenuWidth){

	if(window.event) event.cancelBubble = true;
	else if($oEle.stopPropagation) $oEle.stopPropagation();

	clearhidemenu();
	DROPMENU = document.getElementById ? document.getElementById("dropmenudiv") : dropmenudiv;
	populatemenu($sMenuContents);

	if(ie4||ns6){

		showhide(DROPMENU.style, $oEle, "visible", "hidden", $iMenuWidth);
		DROPMENU.x=getposOffset($oObj, "left");
		DROPMENU.y=getposOffset($oObj, "top");
		DROPMENU.style.left = DROPMENU.x-clearbrowseredge($oObj, "rightedge") +
							$oObj.offsetWidth+horizontaloffset+"px";
		DROPMENU.style.top = DROPMENU.y-clearbrowseredge($oObj, "bottomedge")+"px";

	}

	return clickreturnvalue();

}

//************************************************************************************************************
function clickreturnvalue(){

	if(ie4||ns6) return false;
	else return true;
	
}

//************************************************************************************************************
function contains_ns6($oEle1, $oEle2) {

	while($oEle2.parentNode) if(($oEle2 = $oEle2.parentNode) == $oEle1) return true;
	
	return false;

}

//************************************************************************************************************
function dynamichide($oEle){

	if(ie4 && !DROPMENU.contains($oEle.toElement)) delayhidemenu();
	else
		if(ns6&&$oEle.currentTarget != $oEle.relatedTarget &&
			!contains_ns6($oEle.currentTarget, $oEle.relatedTarget)) delayhidemenu();
	
}

//************************************************************************************************************
function hidemenu(){

	if(typeof DROPMENU!="undefined"){

		if(ie4||ns6) DROPMENU.style.visibility="hidden";

	}
	
}

//************************************************************************************************************
function delayhidemenu(){

	if(ie4||ns6) delayhide = setTimeout("hidemenu()",disappeardelay);

}

//************************************************************************************************************
function clearhidemenu(){

	if(typeof delayhide != "undefined") clearTimeout(delayhide);

}
//End Anylink Veritcal Menu***************************************************************************************************
