function windowFrame(windowName,frameWidth,frameHeight,url) {
  fw=window.open(url,windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,left=0,top=0,width=" + frameWidth + ",height=" + frameHeight);     
  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) {
 var b_name="";
  b_name=browser_name();

  if(b_name=="msie" )
  {
   fw=window.open(url,windowName,"toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,left=0,top=0,width=780,height=500");     
 
   fw.moveTo((screen.Width-780)/2,(screen.Height-500)/2 );
   }
   else
   {
    fw=window.open(url,windowName,"toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,left=200,top=200,width=780,height=500"); 
   }
   
   fw.focus();
}

function launchClipContent(windowName,url, centered){
    var frameWidth = 500;
    var frameHeight = 300;
   
    var b_name="";
  b_name=browser_name();
   if(b_name=="msie" )
  {
    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 );
        }
   }
   else
    {
        fw=window.open(url,windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,left=200,top=200,width=" + frameWidth + ",height=" + frameHeight);     
    }
    fw.focus();
}

function windowReferenceWithSize(windowName,w,h,url) {
 var b_name="";
  b_name=browser_name();

  if(b_name=="msie" )
  {
   fw=window.open(url,windowName,"toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,left=0,top=0,width=" + w + ",height=" + h);
 
   fw.moveTo((screen.Width-w)/2,(screen.Height-h)/2 );
   }
   else
   {
    fw=window.open(url,windowName,"toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,left=200,top=200,width=" + w + ",height=" + h); 
   }
   
   fw.focus();
}

// Show the case text for CUSTOM CURRICULUM
function showCase(id) {
    var divID;
    var linkID;
    var linkText;
    divID = "divCase_" + id;
    linkID = "lnkView_" + id;
    linkText = document.getElementById(linkID).innerText;
    
    if (linkText == 'hide all') {
        document.getElementById(divID).style.display = 'none';
        document.getElementById(linkID).innerText = 'view all';
    } else {
        document.getElementById(divID).style.display = 'block';
        document.getElementById(linkID).innerText = 'hide all';
    }
}

// Show the learning objectives text for CUSTOM CURRICULUM
function showObjective(id,all) {
    var divShortID;
    var divAllID;
    divShortID = "divObjectShort_" + id;
    divAllID = "divObjectAll_" + id;
    
    if (all == true) {
        document.getElementById(divShortID).style.display = 'none';
        document.getElementById(divAllID).style.display = 'block';
    } else {
        document.getElementById(divShortID).style.display = 'block';
        document.getElementById(divAllID).style.display = 'none';
    }
}

function windowNonResizable(windowName,frameWidth,frameHeight,url, centered){
var b_name="";
  b_name=browser_name();
   if(b_name=="msie" )
  {
  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 );
  }
  }
   else
   {
  fw=window.open(url,windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,left=200,top=200,width=" + frameWidth + ",height=" + frameHeight); 
   }
  fw.focus();
}

function resizeToHTML(){
  alert(document.getElementById('table').offsetHeight);
}

function popitup(url)
	{
	newwindow=window.open(url,'name','height=600,width=810,status=0,toolbar=0,menubar=0,scrollbars=0,resizable=1,location=0,directories=0');
	if (window.focus) {newwindow.focus()}
	}

function launchAssessment(resourceID) {
var b_name="";
  b_name=browser_name();

  if(b_name=="msie" )
  {
  fw=window.open("assessmentHome.aspx?resourceID=" + resourceID, "assessment","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=0,left=0,top=0,width=750,height=650");     
  fw.moveTo((screen.Width-750)/2,(screen.Height-600)/2 );
  }
  else{
   fw=window.open("assessmentHome.aspx?resourceID=" + resourceID, "assessment","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=0,left=200,top=200,width=750,height=650");     
  }
  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) {
var b_name="";
  b_name=browser_name();

  if(b_name=="msie" )
  {
  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 );
  }
  else{
   fw=window.open("../drugContent.aspx?cpNum=" + cpNum, 'Drug',"toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,left=200,top=200,width=550,height=550");     
  }
  fw.focus();
}

function showDrugClass(className) {
  windowReference("Drug", "/drugClassification.aspx?className=" + escape(className))
}

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 PlayLectureLarge(file) {
	fw=window.open(file,"","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=no,left=0,top=0,width=980,height=640");     
	fw.focus();
}

function toggleBlock(blockID) {
	if (document.getElementById) {
		var subNodes = document.getElementById(blockID);
		subNodes.style.display = (subNodes.style.display == 'block') ? 'none' : 'block';
	}
}

function searchAS() {
   var url = "http://www.accessSurgery.com/search.aspx?searchSource=all&searchStr=" + escape(frmMain.txtASQuery.value);
   fw=window.open(url,"_blank","");     
   fw.focus();
}
function browser_name() { 
var browserName = ""; 

var ua = navigator.userAgent.toLowerCase(); 
 if ( ua.indexOf( "safari" ) != -1 ) { 
browserName = "safari"; 
} 
 if ( ua.indexOf( "msie" ) != -1 ) { 
 browserName = "msie"; 
}
return browserName; 
}; 

function windowReferenceSlideShow(windowName,frameWidth,frameHeight,url, centered){
var b_name="";
  b_name=browser_name();
   if(b_name=="msie" )
  {
  fw=window.open(url,windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,left=0,top=0,width=" + frameWidth + ",height=" + frameHeight);     
  if(centered==true){
    fw.moveTo((screen.Width-frameWidth)/2,(screen.Height-frameHeight)/2 );
  }
  }
   else
   {
  fw=window.open(url,windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=no,left=200,top=200,width=" + frameWidth + ",height=" + frameHeight); 
   }
  fw.focus();
}