


function windowFrame(windowName,frameWidth,frameHeight,url) {
	var w = frameWidth;
	var h = frameHeight;
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	if (winl < 0) winl = 0;
	if (wint < 0) wint = 0;
	var windowprops = "height=" + h + ",width=" + w + ",top=" + wint + ",left=" + winl + ",location=no," + "scrollbars=yes,menubars=no,toolbars=no,resizable=yes,status=no";
	fw=window.open(url,'',windowprops);     
	fw.focus();
}

function windowFrameWithBrowserControls(windowName,frameWidth,frameHeight,url) {
  fw=window.open(url,windowName,"status=0,toolbar=0,menubar=1,scrollbars=1,resizable=1,location=0,directories=0,left=0,top=0,width=" + frameWidth + ",height=" + frameHeight);     
  fw.focus();
}

function windowReference(windowName,url) 
{
   fw=window.open(url,"_blank","toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,left=0,top=0,width=800,height=600");     
   fw.moveTo((screen.Width-800)/2,(screen.Height-600)/2 );
   fw.focus();
}

function windowReference2(windowName,url) {
   fw=window.open(url,"_blank","toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,left=0,top=0,width=858,height=610");     
   fw.moveTo((screen.Width-858)/2,(screen.Height-610)/2 );
   fw.focus();
}

function windowNonResizable(windowName,frameWidth,frameHeight,url, centered){
  fw=window.open(url,windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,left=0,top=0,width=" + frameWidth + ",height=" + frameHeight);     
  if(centered==true){
    fw.moveTo((screen.Width-frameWidth)/2,(screen.Height-frameHeight)/2 );
  }
  fw.focus();
}

function resizeTohtml(){
  alert(document.getElementById('table').offsetHeight);
}

function switchMenu(id) {
	if (document.getElementById) {
		var subNavDiv = document.getElementById(id);
		var subNavImg = document.getElementById('img' + id);
		var subNavAuthorClosed = document.getElementById(id + "|c");
		var subNavAuthorExpanded = document.getElementById(id + "|e");

		subNavDiv.style.display = (subNavDiv.style.display == 'block') ? 'none' : 'block';
		subNavImg.src = (subNavImg.src.substr(subNavImg.src.lastIndexOf('/')+1) == 'update_plus.gif') ? 'images/update_minus.gif' : 'images/update_plus.gif'
		if(subNavAuthorClosed)
			subNavAuthorClosed.style.display = (subNavAuthorClosed.style.display == '') ? 'none' : '';
		if(subNavAuthorExpanded)
			subNavAuthorExpanded.style.display = (subNavAuthorExpanded.style.display == '') ? 'none' : '';
	}	
}

function hideMenu(id) {
	if (document.getElementById) document.getElementById(id).style.display = 'none';
}

function launchAssessment(aid, resourceID) {
  fw=window.open("assessment.aspx?aid=" + aid + "&resourceID=" + resourceID, "assessment","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=1,left=0,top=0,width=660,height=580");     
  fw.moveTo((screen.Width-660)/2,(screen.Height-500)/2 );
  fw.focus();
}

function setcookie(args)
{
	var aryArgs = args.split("|");
	var Audio = aryArgs[0];
	var Volume = aryArgs[1];
	document.cookie='audio=' + Audio;
	document.cookie='volume=' + Volume;
}

function getCookie(name) {
  var result = null;
  var myCookie = " " + document.cookie + ";";
  var searchName = "courseStatus=";
  var startOfCookie = myCookie.indexOf(searchName);
  var endOfCookie;
  if (startOfCookie != -1) {
    startOfCookie += searchName.length;
    endOfCookie = myCookie.indexOf(";",startOfCookie);
    result = unescape(myCookie.substring(startOfCookie,endOfCookie));
  }
  return result;
}

function closeAndReloadParent(parentURL) {
  if ( top.opener != null && top.opener.closed == false ) {
    top.opener.location.href = parentURL;    
    top.opener.focus();
  } else {
    newwin = window.open(parentURL);
    newwin.focus();
  }
  window.close();
}

function reloadParentOpener(parentURL) {  
  if ( top.opener != null && top.opener.closed == false ) { 
    top.opener.location.href = parentURL;        
  } else {
    newwin = window.open(parentURL);
  }
}

function reloadParent(parentURL) {  
    parent.location.href = parentURL;        
}

function showDrugInfo(cpNum) {
  fw=window.open("../drugContent.aspx?cpNum=" + cpNum, 'Drug',"toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,left=0,top=0,width=550,height=550");     
  fw.moveTo((screen.Width-550)/2,(screen.Height-550)/2 );
  fw.focus();
}

function PlayLecture(file) {
	fw=window.open(file,"","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=no,left=0,top=0,width=700,height=500");     
	fw.focus();
}

function toggleBlock(blockID) {
	if (document.getElementById) {
		var subNodes = document.getElementById(blockID);
		subNodes.style.display = (subNodes.style.display == 'block') ? 'none' : 'block';
	}
}

function searchGuideline() {
   var url = "http://www.guidelines.gov/search/searchresults.aspx?type=3&num=10&txtSearch=" + escape(frmMain.Text1.value);
   fw=window.open(url,"_blank","");     
   fw.focus();
}
function searchGuideline() {
   var url = "http://www.guidelines.gov/search/searchresults.aspx?type=3&num=10&txtSearch=" + escape(frmMain.Text1.value);
   fw=window.open(url,"_blank","");     
   fw.focus();
}

function searchAM() {
   var url = "http://www.accessmedicine.com/search/searchAM.aspx?searchFor=A&searchStr=" + escape(frmMain.Text2.value);
   fw=window.open(url,"_blank","");     
   fw.focus();
}
