
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 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
   {
   //alert("test");
     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 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 launchCert(creditID){
  var b_name="";
  b_name=browser_name();

  if(b_name=="msie" )
  {
	fw=window.open("cme_certificate.aspx?creditID=" + creditID,"","toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,left=0,top=0,width=780,height=580");     
	fw.moveTo((screen.Width-780)/2,20);
	}
	else
	{
	fw=window.open("cme_certificate.aspx?creditID=" + creditID,"","toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,left=200,top=200,width=780,height=580");     
	}
	fw.focus();
}

function resizeToHTML(){
  alert(document.getElementById('table').offsetHeight);
}

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,25);
  }
  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 launchCME(resourceID,aID) {
  var b_name="";
  b_name=browser_name();

  if(b_name=="msie" )
  {
  fw=window.open("cme_assessment.aspx?resourceID=" + resourceID + "&aID=" + aID, "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,25);
  }
  else
  {
   fw=window.open("cme_assessment.aspx?resourceID=" + resourceID + "&aID=" + aID, "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 getCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

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 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 displayRenewalReminder(expDate) {
    document.write('<table id="tblRenewalReminder" cellpadding="10" cellspacing="10" width="300" height="170" class="font11" background="images/tile_renew.jpg" style="position:absolute; left:240; top:200">');
    document.write('<tr>');
    document.write('<td style="border:solid 1px white" height="100%" width="100%">');
    document.write('<div class="font12" style="color: White"><b>Your PsychiatryOnline subscription will expire in ' + expDate + '.</b></div><br/>');
    document.write('<div><a href="https://store.psychiatryonline.com"><img src="images/b_renew.gif" border="0"/></a></div><br/>');
    document.write('<div><a href="#" class="font12" style="color: White" onclick="javascript:document.getElementById(\'tblRenewalReminder\').style.visibility=\'hidden\';">Close Window</a></div></td>');
    document.write('</tr>');
    document.write('</table>');
}

function displayTrialExpReminder(product) {
    document.write('<table id="tblUpgradeReminder" cellpadding="10" cellspacing="10" width="300" height="170" class="font11" background="images/tile_renew.jpg" style="position:absolute; left:220; top:200">');
    document.write('<tr>');
    document.write('<td style="border:solid 1px white" height="100%" width="100%">');
    document.write('<div class="font12" style="color: White"><b>We hope you\'ve had an opportunity to explore</b> the additional books and journals that are part of a DSM Premium subscription.'); 
   if (product=='product'){
   document.write(' You now have access to only those products you purchased. ');
  } else{
    document.write('<b> Because your free trial has ended</b>, you now have access to only those resources available as part of your <i>');
    document.write(product)
     document.write('</i> purchase.')
   }
   
    document.write(' To expand your access, <b><a href="https://store.psychiatryonline.com" style="color:red">upgrade now</a> and receive a 25% discount.</b></div><br/>');
    document.write('<div><a href="#" class="font12" style="color: White" onclick="javascript:document.getElementById(\'tblUpgradeReminder\').style.visibility=\'hidden\';">Close Window</a></div></td>');
    document.write('</tr>');
    document.write('</table>');
}

function displayUpgradeReminder(product,daysLeft) {
    document.write('<table id="tblTrialExpReminder" cellpadding="10" cellspacing="10" width="300" height="170" class="font11" background="images/tile_renew.jpg" style="position:absolute; left:220; top:200">');
    document.write('<tr>');
    document.write('<td style="border:solid 1px white" height="100%" width="100%">');
    document.write('<div class="font12" style="color: White"><b>Your free trial to additional resources at PsychiatryOnline.com will end in ')
    document.write(daysLeft)
    document.write(' day(s). After that date, you will have access to only those resources available as part of your <i>');
    document.write(product)
    document.write('</i> purchase. To expand your access, <a href="https://store.psychiatryonline.com" style="color:red">upgrade now</a> and receive a 25% discount.</b></div><br/>');
    document.write('<div><a href="#" class="font12" style="color: White" onclick="javascript:document.getElementById(\'tblTrialExpReminder\').style.visibility=\'hidden\';">Close Window</a></div></td>');
    document.write('</tr>');
    document.write('</table>');
}

function seeMoreRelatedContent(resource) {
    var seeMoreLink = document.getElementById('seeMoreRelated'+resource);
    seeMoreLink.style.display="none";
    var moreContent = document.getElementById('contentMoreRelated'+resource);
    moreContent.style.display="block";
}

function toggleBlock(blockID) {
	if (document.getElementById) {
		var subNodes = document.getElementById(blockID);
		subNodes.style.display = (subNodes.style.display == 'block') ? 'none' : 'block';
	}
}
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 PlayDemo() {
			fw=window.open("/demo/demoplay.htm","","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=no,left=0,top=0,width=800,height=600");     
			fw.focus();
		} 
		
		function MM_preloadImages() {
			var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();			
			var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
			if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
		}
		
			function Validate() {
			var field = document.getElementById("comments").value;
			if (field == "") {
				alert("Please enter your comments.");
				document.getElementById("comments").focus();
				return false;
			}
		}
		
		 	
   	  function gotoStore() {
   	    self.top.close();
  	    window.top.opener.document.location.href = "http://store.psychiatryonline.com";
   	  }

	
