var notEnrolledAlert='You may not access Psych Congress On-Demand sessions unless you have purchased the product.  If you feel you have received this message in error,  please contact our customer service team at 800.447.4474.';

var notLoggedInAlert='You must be signed in to access Psych Congress On-Demand.\n\nPlease sign in and try again.\n\nPlease contact customer service at  (800) 447-4474 if you need assistance.'

jQuery(document).ready(function(){
    jQuery.ajax({
            type:'POST',
            url:'/DesktopModules/CMEGate/PCODSecure.ashx',
            contentType:'application/json; charset=utf-8;',
            dataType:'json',
			data:'',
            success: function (response)
           {
               var oResult=eval(response);
			   var oResponse=true;
               if(oResult.LoginStatus=='Success')
               {
				
					if(oResult.PCOD=='True')
					{
						return false;	
					}
					else
					{
							var answer = confirm("Welcome to Psych Congress On-Demand!\n\nYour CME LLC account has been upgraded to allow 24/7 access to valuable session content from the 2009 U.S. Psychiatric and Mental Health Congress. \n\nClick OK to break the package seal and begin viewing sessions and earning credit!*\n\n*Accessing Psych Congress On-Demand confirms your purchase, after which no refunds will be issued.")
							if (answer)
							{
								jQuery.ajax({
									type:'POST',
									url:'/DesktopModules/CMEGate/PCODSecure.ashx?Terms=accept'
								});
								return false;
							}
							else
							{
								window.location="http://www.cmellc.com/";
							}
					}
				 
               }
               else
               { 
				
				   if(oResult.LoginMessage=='Not Logged In')
				   {
					alert(notLoggedInAlert);
					window.location="http://www.cmellc.com/tabid/66/Default.aspx?return_url=/PsychCongress/On-Demand/Access/";
				   }
				  else
				   {
					alert(notEnrolledAlert);
					window.location="http://www.cmellc.com/";
				   }
               }
           },
           error: function (response)
           {
                alert('Sorry, We are not able to determine your enrollment. Please contact customer service at  (800) 447-4474');
				window.location="http://www.cmellc.com/tabid/66/Default.aspx?return_url=/PsychCongress/On-Demand/Product/";

           }
      });
});

//window.location="http://www.cmellc.com";
