﻿function windowFrame(windowName,frameWidth,frameHeight,url) {
  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=yes,resizable=yes,left=0,top=0,width=" + frameWidth + ",height=" + frameHeight);     
        fw.moveTo((screen.Width-frameWidth)/2,(screen.Height-frameHeight-20)/2 );
    }else{
        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 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" )
  { 
  if (url=="popup.aspx?aid=1001470&id=update1001470tb1&refType=table"){

  fw=window.open(url,windowName,"toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,left=0,top=0,width=880,height=700");     
 
   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=0,top=0,width=780,height=500");     
 
   fw.moveTo((screen.Width-780)/2,(screen.Height-500)/2 );
   }
   }
   else
   {
     if (url=="popup.aspx?aid=1001470&id=update1001470tb1&refType=table"){

  fw=window.open(url,windowName,"toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,left=0,top=0,width=950,height=700");     

  }else{
   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.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();
}

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 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+200) + ",height=" + (frameHeight+200));     
        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+200) + ",height=" + (frameHeight+200));     
    }
    fw.focus();
}

function showDrugInfo(cpNum) {
var b_name="";
  b_name=browser_name();

  if(b_name=="msie" )
  {
  fw=window.open("/drugs/content/popup/" + cpNum, 'Drug',"toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,left=0,top=0,width=920,height=600");     
  fw.moveTo((screen.Width-920)/2,(screen.Height-550)/2 );
  }
  else
  {
   fw=window.open("/drugs/content/popup/" + cpNum, 'Drug',"toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,left=200,top=200,width=920,height=600");     
  }
  fw.focus();
}

function showDrugClass(catid) {
  windowReference("Drug", "/drugClassification.aspx?catID=" + escape(catid))
}
function launchClipContent(windowName,url, centered){
    var frameWidth = 550;
    var frameHeight = 350;
   debugger;
    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 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 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 searchAM() {
   var url = "http://www.accessmedicine.com/search/searchAM.aspx?searchFor=A&searchStr=" + escape(frmMain.Text2.value);
   fw=window.open(url,"_blank","");     
   fw.focus();
}

function toggleTocBlock(parentNode, blockID) {
	if (document.getElementById) {
		var subNodes = document.getElementById(blockID);
		if (subNodes.style.display == 'block') {
		    subNodes.style.display = "none";
		    parentNode.style.color = "#003399";
		} else {
		    subNodes.style.display = "block";
		    parentNode.style.color = "#333333";
		}
	}
}

function showTocBlock(parent, blockID) {
	if (document.getElementById) {
		var subNode = document.getElementById(blockID);
	    subNode.style.display = "block";
	    var parentNode = document.getElementById(parent);
	    parentNode.style.color = "#333333";
	}
}

function hideTocBlock(parent, blockID) {
	if (document.getElementById) {
		var subNodes = document.getElementById(blockID);
	    subNodes.style.display = "none";
	    var parentNode = document.getElementById(parent);
	    parentNode.style.color = "#003399";
	}
}

function reloadParentWindow(parentUrl, referURL) {
    if ( top.opener != null && top.opener.closed == false ) {							
	    if (parentUrl == null) {
		    parentUrl = top.opener.location.href;
	    }
	    if (referURL == null) {
		    referURL = escape(top.opener.location.href);
	    }			
		
	    if (parentUrl.indexOf("#") > 0){			  
	      top.opener.top.location.reload();
	    } else if (parentUrl.indexOf("?") > 0) {
	      top.opener.parent.location.href = parentUrl + "/" + referURL;
	    }	else {
	      top.opener.location.href = parentUrl + "/" + referURL;
	    }
    }								
	
    self.close();
}

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 showAboutUpdates() {
            var oWindow = window.radopen ('aboutUpdate.aspx','aboutUpdates');
            oWindow.MoveTo (650,300);   // left,top
            oWindow.SetSize (350,175);   // width,height
        }
        
        function validateAdvSearch1() {
 		    var hasResSelected, i, allRes, allSources, hasSourceSelected, searchSource;
			
 		    if (document.getElementById('advSearchStr').value=="") {
 		      alert("Please input a search string.");
 		      return false;
 		    }
 		    
 		    if (document.getElementById('ctl00_mainContent_drpBoolean1').checked == true)
 		    {
 		        if (document.getElementById('drpBoolean').value == '- Select')
 		        {
 		            alert("Please select a boolean operation.");
 		            return false;
 		        }
 		        
 		        if (document.getElementById('advSearchStr2').value == true)
 		        {
 		            alert("Please input second search string for boolean search.");
 		            return false;
 		        }
 		    }
 		    
 		    
 		    var b600 = document.getElementById('chb600');
				var b28 = document.getElementById('chb28');
				var b53  = document.getElementById('chb53');
				var b605 = document.getElementById('chb605');
				var b601 = document.getElementById('chb601');
				var b76 = document.getElementById('chb76');
				var b602 = document.getElementById('chb602');
				var b603 = document.getElementById('chb603');
 		    
 		    if (b600.checked == false && b28.checked == false && b53.checked == false && b605.checked == false && b601.checked == false && b76.checked == false && b602.checked == false && b603.checked == false)
 		    {
 		        alert('Please select a resource or resources to search');
 		        return false;
 		    }
 		    
 		    

 		    return true;
 		  }
 		    function showAboutpage1() {
            var oWindow = radopen ('/learnMore_search.aspx','showAbout');
            oWindow.MoveTo (250,220);   // left,top
            oWindow.SetSize (550,500);   // width,height
        }
        
        function SetResourceOptions(status) {
		    var b600 = document.getElementById('chb600');
				var b28 = document.getElementById('chb28');
				var b53  = document.getElementById('chb53');
				var b605 = document.getElementById('chb605');
				var b601 = document.getElementById('chb601');
				var b76 = document.getElementById('chb76');
				var b602 = document.getElementById('chb602');
				var b603 = document.getElementById('chb603');
				
				
				b600.checked = status;
                b28.checked = status;
                b53.checked = status;
                b605.checked = status;
                b601.checked = status;	
                b76.checked = status;
                b602.checked = status;
                b603.checked = status;
 		  }
 		  
// 		  function disableBoolean(status) {
// 		
// 		   document.getElementsByName('ctl00$mainContent$drpBoolean').disabled = status;
// 		    document.getElementsByName('advSearchStr2').disabled = status;
// 		    
// 		    
// 		  } 
 		  
 			  function disableBoolean(status) {

// document.getElementById('ctl00_mainContent_drpBoolean1').disabled= status;
// 
// 		   document.getElementsByName('ctl00$mainContent$drpBoolean').disabled = status;
// 		    document.getElementById('ctl00_mainContent_advSearchStr2').disabled = status;
 		    if  (status==false){
 		    // alert(status);
 		       document.getElementById('ctl00_mainContent_drpBoolean').disabled = false;
 		    document.getElementById('ctl00_mainContent_advSearchStr2').disabled = false;
 		    document.getElementById('ctl00_mainContent_rbBoolean1').checked=false;
 		     }
 		    else{
       document.getElementById('ctl00_mainContent_drpBoolean').disabled = true;
 		    document.getElementById('ctl00_mainContent_advSearchStr2').disabled = true;
 		  document.getElementById('ctl00_mainContent_rbBoolean2').checked=false;
 		    }
 		    
 		    
 		   
 		    return true;
 		    
 		  } 
 		  
 		  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();
}



 
