// NewsworthyAudioC2L.js source code //©Copyright 2006 Newsworthy, Inc. All Rights Reserved var m_oC2LWindow=null; // Reference to the window's object var m_iRefCount=0; // Refernece counter (Guarantees that no infinte recursion occurs) /*For Gr1 displaying page, change value to 585*/ var m_sC2LWindowFeatures='location=0,menubar=0,status=0,width=358,height=600'; var m_sC2LWindowName='_blank'; //All parameters except for UserName, Environment, and Debug are required function OpenC2LWindow(PartnerKey,ArticleGUID,ArticleURL,PartnerSpecificParam,SiteKey,UserName,Environment,Debug) { try { var sHostName=""; switch(Environment) { case "QA": //Quality Assurance sHostName="http://QA.C2L.NewsworthyAudio.com/Partners/"; break; case "Test": //Test Environment sHostName="http://Test.C2L.NewsworthyAudio.com/Partners/"; break; case "Demo": //Demo Environment sHostName="http://Demo.C2L.NewsworthyAudio.com/Partners/"; break; default: //Default- Production sHostName="http://C2L.NewsworthyAudio.com/Partners/"; break; } //Construct Url var sUrl=sHostName + PartnerKey + "/" ; sUrl +="C2lPlayer.aspx?PartnerKey=" + PartnerKey; sUrl +="&SiteKey=" + SiteKey; sUrl +="&ArticleGUID=" + ArticleGUID; sUrl +="&ArticleURL=" + ArticleURL; sUrl +="&PartnerSpecificParam=" + PartnerSpecificParam; sUrl +="&UserName=" + typeof(UserName)=="string"?UserName:""; sUrl +=typeof(Debug)=="string"?"&Debug=":""; //If this window was launched before, kill it first if (m_oC2LWindow!=null) { m_iRefCount=0; // Reset counter m_oC2LWindow=null; } m_iRefCount++; // increment counter m_oC2LWindow = window.open(sUrl, m_sC2LWindowName, m_sC2LWindowFeatures); } catch(e) { //m_iRefCount<2 conditions makes sure that the recursive call occurs only once //if it was invoked once and the same exception is raised, the function will display //an alert box with the error number and message. if ((e.number==-2147418094||e.number==-2147024891) && m_iRefCount<2) { /* Error number -2147418094 has the following massage associated with it... The callee (server [not server application]) is not available and disappeared; all connections are invalid. The call did not execute. ... which means that the client has closed the browser whose reference is stored in the oC2LWindow object. Error number -2147024891 has this message Access is denied. Set the oC2LWindow object to null and try again one more time. */ oC2LWindow=null; OpenC2LWindow(PartnerKey,ArticleGUID,ArticleURL,PartnerSpecificParam,UserName,Environment,Debug); } else alert("Failed to execute OpenC2LWindow()\n\n"+ e.number+ "\n" + e.message); } } function test() { alert("TESTING"); }