				 /*
				     utils
				 */
				     function ValidateOfferSelection(box)
				     {
				         var thisForm = document.forms[0];       //the Form
				         var formItem = box.name;                //the order item selected for purchase
				 
				         var itemArray = new Array();            //the order item selected for purchase in an Array() to split underscores(_)
				         var formArray = new Array();            //the whole form in an Array()
				 
				         itemArray = formItem.split('_');        
				         
				         for (i = 0; i < thisForm.length; i++)  
				         {   
				             formArray = thisForm.elements[i].name.split('_');
				             if ( itemArray[1] == formArray[1] )
				             {  
				                 var firstItem = itemArray[0]+'_'+itemArray[1]+'_'+itemArray[2];
				                 var dupeItems = formArray[0]+'_'+formArray[1]+'_'+formArray[2];
				                
				                 if (counter < 3)
				                 {
				                     if( document.frmOrder[dupeItems].length != null )
				                     {
				                         for( j = 0; j < document.frmOrder[dupeItems].length; j++ )
				                         {
				                             if( document.frmOrder[dupeItems][j] != box && document.frmOrder[dupeItems][j].checked )
				                             {
				                                 box.checked = false;
				                                 alert( "You have already selected this magazine.\nPlease review your selections." );
				                                 return;   
				                             }
				                         }
				                     }
				                     else
				                     {
				                         if( dupeItems != formItem && document.frmOrder[dupeItems].checked )
				                         {
				                             box.checked = false;
				                             alert( "You have already selected this magazine.\nPlease review your selections." );
				                             return;
				                         }
				                     }
				                     document.frmOrder[firstItem].checked = box.checked;
				                 }
				             }
				         }
				         
				         if (box.checked) counter++;
				         else counter--;
				             
				         if (counter > 3)
				         {
				             box.checked = false;
				             counter--;
				             alert ("You may order up to three magazines only.\nPlease review your selections.");
				         }
				 
				         if (counter < 0)
				         {
				             counter = 0;
				             document.forms[0].reset();
				         }
				     }  
				 
				     function string_GetURLValue(string_name)    {
				         var string_queryString = new String(document.location.search);
				         if(string_queryString.charAt(0)=="?")   {
				             string_queryString = string_queryString.substring(1)
				         }
				         if(string_queryString.length==0)return "";
				         array_nameValuePairs = string_queryString.split("&");
				         for(int_counter=0; int_counter < array_nameValuePairs.length; int_counter++)    {
				             if(array_nameValuePairs[int_counter].split("=")[0].toUpperCase() == string_name.toUpperCase())  {
				                 return unescape(array_nameValuePairs[int_counter].split("=").slice(1).join('='));
				             }
				         }
				         return "";
				     }
				 
				     function AppendPrePopInfo(link)
				     {
				         str_URL = document.location.href;
				         str_newURL = link
				         str_newURL += "ti=" + string_GetURLValue("ti")
				         str_newURL += "&fn=" + string_GetURLValue("fn")
				         str_newURL += "&ln=" + string_GetURLValue("ln")
				         str_newURL += "&a1=" + string_GetURLValue("a1")
				         str_newURL += "&a2=" + string_GetURLValue("a2")
				         str_newURL += "&ci=" + string_GetURLValue("ci")
				         str_newURL += "&st=" + string_GetURLValue("st")
				         str_newURL += "&zi=" + string_GetURLValue("zi")
				         str_newURL += "&em=" + string_GetURLValue("em")
				         str_newURL += "&ti=" + string_GetURLValue("ti")
				         document.location.href = str_newURL
				     }
				 
				     function AppendPrePopInfoNewWindow(link)
				     {
				         str_URL = document.location.href;
				         str_newURL = link
				         str_newURL += "ti=" + string_GetURLValue("ti")
				         str_newURL += "&fn=" + string_GetURLValue("fn")
				         str_newURL += "&ln=" + string_GetURLValue("ln")
				         str_newURL += "&a1=" + string_GetURLValue("a1")
				         str_newURL += "&a2=" + string_GetURLValue("a2")
				         str_newURL += "&ci=" + string_GetURLValue("ci")
				         str_newURL += "&st=" + string_GetURLValue("st")
				         str_newURL += "&zi=" + string_GetURLValue("zi")
				         str_newURL += "&em=" + string_GetURLValue("em")
				         str_newURL += "&ti=" + string_GetURLValue("ti")
				 
				         var w = "800"
				         var h = "600"
				         var expdateLong = new Date()
				         mynewwin = window.open(str_newURL,'newwindow'+expdateLong.getTime(), 'width=' + w + ',height=' + h + ',status=yes,menubar=yes,scrollable=yes,resizable=yes,scrollbars=yes,screenX=0,screenY=0,top=0,left=0')       
				     }
				 
				     function DateLessThan(d1,d2)
				     {
				         if (d1.getYear()<d2.getYear())
				             return true
				 
				         if (d1.getYear()>d2.getYear())
				             return false
				 
				         //we know years are  == below here
				         if(d1.getMonth()<d2.getMonth())
				             return true
				         if (d1.getMonth()>d2.getMonth())
				             return false
				 
				         //we know months are  == below here
				         if(d1.getDate()<=d2.getDate())
				             return true
				         if (d1.getDate()>d2.getDate())
				             return false
				 
				     }
				 
				     function ShortDate()
				     {
				         var d, s = ""
				         d = new Date()
				         s += (d.getMonth() + 1) + "/"
				         s += d.getDate() + "/"
				         s += d.getYear()
				         return s                               
				     }
				 
				     var sbCookie = GetCookie("SBSession")
				     var badCookie = sbCookie != null && DateLessThan(new Date(getNameVal("SBSession","SessionDate")), new Date("Tue Feb 10 00:00:00 EST 2004"))
				     //alert( badCookie )
				     if(badCookie)
				     {
				        document.cookie = "SBSession=; expires=Fri, 02-Jan-1970 00:00:00 GMT"
				     }
				 
				     if (sbCookie == null || badCookie)
				     {
				         var expdateLong = new Date();
				         var ar1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
				         var ar2 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
				         var ar3 = "ABCDEFGHIJKL0123456789MNOPQRSTUVWXYZ";
				         var ar4 = "56789ABCDEFGHIJKLMNOPQRSTUVWXYZ01234";
				         var ar5 = "01234ABCDEFGHIJKLMNOPQRSTUVWXYZ56789";
				         var sID = "";
				         
				         var years = 8;
				         var today = new Date();
				         var expires = new Date(today.getTime() + (years * 365 * 24*60*60*1000));
				         
				         sID += ar1.substr(Math.random()*30,1);
				         sID += ar2.substr(Math.random()*30,1);
				         sID += ar3.substr(Math.random()*30,1);
				         sID += ar4.substr(Math.random()*30,1);
				         sID += ar5.substr(Math.random()*30,1);
				         sID += ar1.substr(Math.random()*30,1);
				         sID += ar2.substr(Math.random()*30,1);
				         sID += ar3.substr(Math.random()*30,1);
				         sID += "-";
				         sID += ar4.substr(Math.random()*30,1);
				         sID += ar5.substr(Math.random()*30,1);
				         sID += ar1.substr(Math.random()*30,1);
				         sID += ar2.substr(Math.random()*30,1);
				         sID += "-";
				         sID += ar3.substr(Math.random()*30,1);
				         sID += ar4.substr(Math.random()*30,1);
				         sID += ar5.substr(Math.random()*30,1);
				         sID += ar1.substr(Math.random()*30,1);
				         sID += "-";
				         sID += ar2.substr(Math.random()*30,1);
				         sID += ar3.substr(Math.random()*30,1);
				         sID += ar4.substr(Math.random()*30,1);
				         sID += ar5.substr(Math.random()*30,1);
				         sID += "-";
				         sID += ar1.substr(Math.random()*30,1);
				         sID += ar2.substr(Math.random()*30,1);
				         sID += ar3.substr(Math.random()*30,1);
				         sID += ar4.substr(Math.random()*30,1);
				         sID += ar5.substr(Math.random()*30,1);
				         sID += ar1.substr(Math.random()*30,1);
				         sID += ar2.substr(Math.random()*30,1);
				         sID += ar3.substr(Math.random()*30,1);
				         sID += ar4.substr(Math.random()*30,1);
				         sID += ar5.substr(Math.random()*30,1);
				         sID += ar1.substr(Math.random()*30,1);
				         sID += ar2.substr(Math.random()*30,1);
				         
				         document.cookie = "SBSession=" + escape("Session="+sID) + escape(";SessionDate="+ ShortDate()) +"; path=/ ; expires=" + expires.toGMTString();
				     } 
				 
				 /*
				     legacy functions
				 */
				     function parseURL() {
				         var winURL = window.location.toString();
				         var iID     = winURL.indexOf("ID_Type=");        
				         var iSource = winURL.indexOf("Source=");
				         var iSegment    = winURL.indexOf("Segment_SourceKey=");
				         var iV = winURL.indexOf("v=");
				         var iTC = winURL.indexOf("tc=");
				         var iDestId = winURL.indexOf("destId=");
				         var iForeign = winURL.indexOf("foreign=");
				 
				         if ( iID == -1 || iSource == - 1 || iSegment == -1 ) {
				             document.frmOrder.ID_Type.value             = -1;
				             document.frmOrder.Source.value              = -1;
				             document.frmOrder.Segment_sourceKey.value   = -1;
				         }else {
				             document.frmOrder.ID_Type.value             =  winURL.substring(iID+8,(winURL.indexOf("&",iID+8)==-1)?winURL.length:winURL.indexOf("&",iID+8) );
				             document.frmOrder.Source.value              =  winURL.substring(iSource+7,(winURL.indexOf("&",iSource+7)==-1)?winURL.length:winURL.indexOf("&",iSource+7) );
				             document.frmOrder.Segment_sourceKey.value   =  winURL.substring(iSegment+18,(winURL.indexOf("&",iSegment+18)==-1)?winURL.length:winURL.indexOf("&",iSegment+18) );
				         }
				 
				         if((document.frmOrder.tcIdA) && (document.frmOrder.tcIdB) ) {
				             if ( iV == -1 || iTC == -1) {
				                 document.frmOrder.tcIdA.value       = -1;
				                 document.frmOrder.tcIdB.value     = -1; 
				             } else {
				                 document.frmOrder.tcIdA.value   = winURL.substring(iV+2,(winURL.indexOf("&",iV+2)==-1)?winURL.length:winURL.indexOf("&",iV+2) );
				                 document.frmOrder.tcIdB.value   = winURL.substring(iTC+3,(winURL.indexOf("&",iTC+3)==-1)?winURL.length:winURL.indexOf("&",iTC+3) );
				             }   
				         }
				 
				         if(document.frmOrder.destId) {
				             if ( iDestId > 0) {
				                  document.frmOrder.destId.value   = winURL.substring(iDestId+7,(winURL.indexOf("&",iDestId+7)==-1)?winURL.length:winURL.indexOf("&",iDestId+7) );
				             }       
				         } 
				 
				         if(document.frmOrder.foreign) {
				             if ( iForeign > 0) {
				                  document.frmOrder.foreign.value   = winURL.substring(iForeign+8,(winURL.indexOf("&",iForeign+8)==-1)?winURL.length:winURL.indexOf("&",iForeign+8) );
				             }       
				         } 
				 
				     }
				 
				     function init() {
				         if (!document.layers)   {
				             document.frmOrder.reset();
				         }
				         parseURL();
				         document.frmOrder.OSType.value = new String(navigator.userAgent).replace(";"," ");
				         document.frmOrder.BrowserType.value = new String(navigator.appName).replace(";"," ");
				     }
				 
				 //This function is used to retrieve a value from a name value pair
				 //stored in a cookie.  There are several assumptions being made
				 //each one is tested for and a false value is returned if the assumptions/requirements
				 //are not met
				 //1.  The cookie name value pairs are delimited by a semicolon ";"
				 //2.  Each name value pair is delimited by an equal sign "name=value"
				 function getNameVal(cookieName,valName) 
				 {
				     
				     var cookieString;
				     var cookieArray;
				     var nameValArray;
				     var nameValStr;
				     var nameValLength;
				     var i;
				     
				     cookieString = GetCookie(cookieName);
				     
				     if (cookieString == null)
				     {
				         return false;
				     }
				     
				     cookieArray = getStringArr(cookieString,";");
				     
				     if (cookieArray.length == 0) 
				     {
				         return false;
				     }
				         
				     nameValStr = setArrayStr(cookieArray,"=");
				     nameValArray = getStringArr(nameValStr,"=");
				     
				     if (nameValArray == 0)
				     {
				         //alert("Debugg -- nameValArray == 0");
				         return false;
				     }
				     
				     nameValLength = nameValArray.length;
				     
				     for (i = 0; i < nameValLength;)
				     {
				         //alert(nameValArray[i]);
				         if (nameValArray[i] == valName)
				         {
				             //alert(nameValArray[i+1]);
				             //return stringReplace(nameValArray[i+1], "+", " ");
				             return unescape(nameValArray[i+1]);
				         }
				         i=i+1; //increment every other array member to just get the key values
				     }
				     //alert("no entry found in the " + cookieName + " for " + valName);
				 }
				 
				 
				 //Purpose of this function is to create a "symbol" delimited
				 //string out of an array of values
				 function setArrayStr(strArray,sDelimiter)
				 {
				     var arrLength;
				     var sReturn = ""; 
				     var i; 
				     arrLength = strArray.length;
				     if (arrLength == 0)
				     {
				         //alert("Nothing to concatenate");
				         return false;
				     }
				     else
				     {
				         for (i=0;i<arrLength;i++)
				         {
				             sReturn = sReturn + strArray[i] + sDelimiter; 
				             
				         }
				     }
				     return sReturn
				 }   
				     
				     
				     
				 //Purpose of this function is to create a string array
				 //out of a "symbol" delimited string
				 function getStringArr(strCookieVals,sDelimiter)
				 {
				     var sReturn
				     sReturn = (sDelimiter.length > 0)? strCookieVals.split(sDelimiter) : false;
				     if (! sReturn)
				     {
				         alert("Delimiter not specified")
				         return false
				     }
				     else
				     {   
				         return sReturn
				     }
				 }
				     
				     
				 function checkCookieEnable(sRedirect)
				 {
				     var sCheckCookieName = "check"
				     var sCheckCookieVal = "000"
				     var sCookieVal = ""
				     var expdate = new Date ();
				     expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000));
				     SetCookie(sCheckCookieName,sCheckCookieVal,expdate);
				     sCookieVal = GetCookie(sCheckCookieName)
				     DeleteCookie(sCheckCookieName,"/")
				     
				     if (sCookieVal==null)
				     {
				         document.location.href = sRedirect
				     }
				 }
				 
				 function getCookieVal (offset) {
				   var endstr = document.cookie.indexOf (";", offset);
				   if (endstr == -1)
				     endstr = document.cookie.length;
				   return unescape(document.cookie.substring(offset, endstr));
				 }
				 //
				 //  Function to correct for 2.x Mac date bug.  Call this function to
				 //  fix a date object prior to passing it to SetCookie.
				 //  IMPORTANT:  This function should only be called *once* for
				 //  any given date object!  See example at the end of this document.
				 //
				 function FixCookieDate (date) {
				   var base = new Date(0);
				   var skew = base.getTime(); // dawn of (Unix) time - should be 0
				   if (skew > 0)  // Except on the Mac - ahead of its time
				     date.setTime (date.getTime() - skew);
				 }
				 //
				 //  Function to return the value of the cookie specified by "name".
				 //    name - String object containing the cookie name.
				 //    returns - String object containing the cookie value, or null if
				 //      the cookie does not exist.
				 //
				 function GetCookie (name) {
				   var arg = name + "=";
				   var alen = arg.length;
				   var clen = document.cookie.length;
				   var i = 0;
				   while (i < clen) {
				     var j = i + alen;
				     if (document.cookie.substring(i, j) == arg)
				       return getCookieVal (j);
				     i = document.cookie.indexOf(" ", i) + 1;
				     if (i == 0) break; 
				   }
				   return null;
				 }
				 //
				 
				 //
				 //  The first two parameters are required.  The others, if supplied, must
				 //  be passed in the order listed above.  To omit an unused optional field,
				 //  use null as a place holder.  For example, to call SetCookie using name,
				 //  value and path, you would code:
				 //
				 //      SetCookie ("myCookieName", "myCookieValue", null, "/");
				 function SetCookie (name,value,expires,path,domain,secure) {
				     document.cookie = name + "=" + escape (value) +
				     ((expires) ? "; expires=" + expires.toGMTString() : "") +
				     ((path) ? "; path=" + path : "") +
				     ((domain) ? "; domain=" + domain : "") +
				     ((secure) ? "; secure" : "");
				 }
				 
				 //  Function to delete a cookie. (Sets expiration date to start of epoch)
				 //    name -   String object containing the cookie name
				 //    path -   String object containing the path of the cookie to delete.  This MUST
				 //             be the same as the path used to create the cookie, or null/omitted if
				 //             no path was specified when creating the cookie.
				 //    domain - String object containing the domain of the cookie to delete.  This MUST
				 //             be the same as the domain used to create the cookie, or null/omitted if
				 //             no domain was specified when creating the cookie.
				 //
				 function DeleteCookie (name,path,domain) {
				 return;
				   if (GetCookie(name)) {
				     document.cookie = name + "=" +
				       ((path) ? "; path=" + path : "") +
				       ((domain) ? "; domain=" + domain : "") +
				       "; expires=Thu, 01-Jan-70 00:00:01 GMT";
				   }
				 }
				 
				 checkCookieEnable("/errors/cookiesoff.html")
				 
				 /*
				     email validation
				 */
				 
				 function lTrim(x) {
				     if (x.length == 0) {
				         return "";
				     }
				 
				     while( x.charAt(0)==" ") {
				         x = x.substring( 1, x.length );
				     }
				     
				     return x;
				  
				 } 
				 
				 function rTrim(x) {
				     if (x.length == 0) {
				         return "";
				     }
				     
				     while ( x.charAt( x.length-1 ) == " " ){
				          x = x.substring(0, x.length-1 );
				     }
				     
				     return x;
				 }
				 
				 
				 function allTrim(x) {
				     x = rTrim( lTrim(x) );
				     return x;
				 }
				 
				 var oEmailField;
				 //alert("Loaded")
				 function checkEmail(idx, sMsg)
				 {
				 
				     oEmailField = document.frmOrder.Email;
				         var sVal = allTrim(document.frmOrder.Email.value);
				     document.frmOrder.Email.value = sVal;
				         var sOldVal = sVal ;
				     var bOK = basicEmailCheck(sVal);
				    
				    
				     if ( ! bOK ) {
				         return false;
				     }
				     else{
				         // make sure the login form doesn't pick this up
				         //if ( idx.form.name != "frmNewEntry" ){
				         //  return true;
				         //}
				     }    
				            
				     sVal = emailHygeine(sVal);
				     
				 
				   
				     // if it was changed, run the popup
				     if (sVal.toLowerCase() != sOldVal.toLowerCase()) {
				     
				         var sURL;
				         sURL = "/aq/invalidemail.html?rec=" + sVal;
				         sURL = sURL + "&ent=" + sOldVal ;
				         
				         var w = "510";
				         var h = "320";
				         var expdateLong = new Date();
				         mynewwin = window.open(sURL,'newwindow'+expdateLong.getTime(), 'width=' + w + ',height=' + h + ',status=yes,menubar=no,scrollable=no,resizable=yes,scrollbars=no,screenX=0,screenY=0,top=0,left=0');
				         return false;
				     }
				     else {    
				         idx.value = sVal.toLowerCase();
				         return true;
				     }
				 }
				 
				 function doUnload() {
				   if (window.mynewwin && window.mynewwin.open && !window.mynewwin.closed)
				   window.mynewwin.opener = null;
				 }
				 
				 function basicEmailCheck(sVal) {
				     //*****************
				     // DEBUG
				     //alert("in  basicemailcheck() ...");
				     //*****************
				     
				     // There is a some kludging here for NS
				     var oReg = /[^@\s][^@\s]+@[^@\s][^@\s]+\.[a-z]{2,4}/i  
				 
				     var bOK = oReg.test(sVal);
				     var sErr = "Please enter a valid email address\n(e.g. username@pch.com).";
				    
				     if ( ! bOK ) {
				         alert( sErr );
				         document.frmOrder.Email.focus();
				         return false;
				     }    
				     return true;
				     //return false;
				 }
				 /**/
				     function callbackRec(sVal) {
				         document.frmOrder.Email.value = sVal;
				 
				         var bOK = basicEmailCheck(sVal)
				         if ( ! bOK ) {
				             return false;
				         }
				 
				         document.frmOrder.submit();
				     }
				 
				     function callbackEnt(sVal) {
				         document.frmOrder.Email.value = sVal;
				         var bOK = basicEmailCheck(sVal)
				         if ( ! bOK ) {
				             return false;
				         }
				         document.frmOrder.submit();
				     }
				 
				     function callbackNew(sVal) {
				         document.frmOrder.Email.value = sVal;
				 
				         if ( checkEmail(document.frmOrder.Email,"Email") ) {
				             document.frmOrder.submit();
				         }
				     }
				 
				 
				 
				 function emailHygeine(sVal) {
				 	var httpConn = new XmlHttpConn();
				 
				 	if (!httpConn || !sVal) return sVal;	 
				 
				 	httpConn.connectSync("/emailHygiene/emailHygiene.aspx", "GET", "email=" + sVal ) ;
				 	
				 	var sValOut =  httpConn.getXmlHttp().responseText;
				 	
				 	if(!sValOut	|| sValOut == "undefined" || sValOut.indexOf("Error:") == 0) 
				 		return sVal
				 	else
				 		return sValOut 
				 }
				 
				 
				 
				 
				 var gImageServer;
				 var gAkamaiHTTP = 'a1708.g.akamai.net/f/1708/179/1h/';
				 var gAkamaiHTTPS = 'a248.e.akamai.net/f/248/179/1h/';
				 var gAkamaiHTTP_test = 'a1708.g.akamai.net/f/1708/179/1m/';
				 var gAkamaiHTTPS_test = 'a248.e.akamai.net/f/248/179/1m/';
				 
				 if (window.location.host.substring(0,2) == 'i3')
				 {
				     if (window.location.protocol == 'http:')
				     {
				       gImageServer = 'http://';
				     }
				     else if (window.location.protocol == 'https:')
				     {
				       gImageServer = 'https://';
				     }
				     gImageServer += window.location.host;
				 }
				 else if ((window.location.host.substring(0,6) == 'pchdev') || (window.location.host.substring(0,2) =='38'))
				 {
				     if (window.location.protocol == 'http:')
				     {
				       gImageServer = 'http://';
				       gImageServer += gAkamaiHTTP;
				     }
				     else if (window.location.protocol == 'https:')
				     {
				       gImageServer = 'https://';
				       gImageServer += gAkamaiHTTPS;
				     }
				     gImageServer += '38.203.242.3';
				 }
				 else if (window.location.host.indexOf("test") != -1)
				 {
				     //test server
				     if (window.location.protocol == 'http:')
				     {
				       gImageServer = 'http://';
				       gImageServer += gAkamaiHTTP_test;
				     }
				     else if (window.location.protocol == 'https:')
				     {
				       gImageServer = 'https://';
				       gImageServer += gAkamaiHTTPS_test;
				     }
				     gImageServer += 'image.pch.com';
				     gImageServer += '/testImages2';
				 }
				 else
				 {
				     if (window.location.protocol == 'http:')
				     {
				       gImageServer = 'http://';
				       gImageServer += gAkamaiHTTP;
				     }
				     else if (window.location.protocol == 'https:')
				     {
				       gImageServer = 'https://';
				       gImageServer += gAkamaiHTTPS;
				     }
				     gImageServer += 'image.pch.com';
				 }
				 
				 function getImageServerPath2(sVal)
				 {
				     var sImageServer;
				     sImageServer = '<img src="';
				     sImageServer += gImageServer;
				     sImageServer += sVal;
				     return sImageServer;
				 }
				 
				 
				 function XmlHttpConn()
				 {
				 	var xmlhttp, bComplete = false;
				 
				 	try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
				 	catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
				 	catch (e) { try { xmlhttp = new XMLHttpRequest(); }
				 	catch (e) { xmlhttp = false; }}}
				 	if (!xmlhttp) return null;
				 
				 	this.connectBase = function(sURL, sMethod, sVars, fnDone, async)
				 	{
				 		if (!xmlhttp) return false;
				 			bComplete = false;
				 			sMethod = sMethod.toUpperCase();
				 
				 			try {
				 			  if (sMethod == "GET")
				 			  {
				 				xmlhttp.open(sMethod, sURL+"?"+sVars, async);
				 				sVars = "";
				 			  }
				 			  else
				 			  {
				 				xmlhttp.open(sMethod, sURL, async);
				 				xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");
				 				xmlhttp.setRequestHeader("Content-Type",
				 				  "application/x-www-form-urlencoded");
				 			  }
				 
				 					if(async)
				 					{
				 						xmlhttp.onreadystatechange = function(){
				 						if (xmlhttp.readyState == 4 && !bComplete)
				 						{
				 							bComplete = true;
				 							fnDone(xmlhttp);
				 						}};
				 					}
				 
				 					xmlhttp.send(sVars);
				 			}
				 			catch(z) { return false; }
				 				return true;
				 		};
				 
				 		this.connectSync = function(sURL, sMethod, sVars)
				 		{
				 			 var emptyFunc  = function x(){};
				 			 return this.connectBase(sURL, sMethod, sVars, emptyFunc , false)
				 		}
				 
				 		this.connect = function(sURL, sMethod, sVars, fnDone)
				 		{
				 			  return this.connectBase(sURL, sMethod, sVars, fnDone, true)
				 		}
				 
				 		this.getXmlHttp = function()
				 		{
				 			  return xmlhttp;
				 		}
				 
				 		return this;
				 }
				 
				 function writeElement(inStrTag, inStrAttribs, inStrTxt) {
				 /*
				 inStrTag = the type of object you want to create
				 inStrAttribs = list of attribites associated with this object (ex. 'border=0 align=center') seperated by SPACE (delimeter1) and = (delimeter2). NO QUOTES!
				 inStrTxt = the display text within the object (ex. <span>Hello World!</span>)
				 */
				 	if (!document.createElement) {return};
				 	var objO; // our object
				 	var locSrc, locID, boolSet;
				 	inStrTag=inStrTag.toLowerCase()//make it lowercase for consistancy and comparisons
				 	if (!objO && document.createElement) {
				 		var objO=document.createElement(inStrTag);
				 		//SET ATTIBUTES!
				 		if(inStrAttribs!=""){
				 			var arrAttSub;
				 			if(inStrAttribs.indexOf(" ")==-1){//only ONE attribute to set :. no loop
				 				boolSet=false;//always reset
				 				arrAttSub=inStrAttribs.split("=");
				 				switch(arrAttSub[0].toLowerCase()){
				 					case "src":
				 						locSrc=arrAttSub[1];//set locSrc var to be used later
				 						break;
				 					case "id":
				 						locID=arrAttSub[1];//set locID var to ve used later
				 						break;
				 				}
				 				if(arrAttSub[0].toLowerCase()=="style"){
				 					if(navigator.userAgent.indexOf("MSIE")>=0){
				 						//b/c IE doesnt like setting the style with "setAttribute"
				 						objO.style.setAttribute("csstext",arrAttSub[1],0);
				 						boolSet=true;
				 					}
				 				}
				 				if(!boolSet){
				 					objO.setAttribute(arrAttSub[0],arrAttSub[1]);
				 				}
				 			}else{
				 				var arrAtts = inStrAttribs.split(" ");
				 				for(var ifor=0;ifor<arrAtts.length;ifor++){
				 					arrAttSub=arrAtts[ifor].split("=");
				 					switch(arrAttSub[0].toLowerCase()){
				 						case "src":
				 							locSrc=arrAttSub[1];//set locSrc var to be used later
				 							break;
				 						case "id":
				 							locID=arrAttSub[1];//set locID var to ve used later
				 							break;
				 					}
				 
				 					if(arrAttSub[0].toLowerCase()=="style"){
				 						if(navigator.userAgent.indexOf("MSIE")>=0){
				 							//b/c IE doesnt like setting the style with "setAttribute"
				 							objO.style.setAttribute("csstext",arrAttSub[1],0);
				 							boolSet=true;
				 						}
				 					}
				 					if(!boolSet){
				 						objO.setAttribute(arrAttSub[0],arrAttSub[1])
				 					}
				 				}
				 			}
				 		}
				 		if(inStrTxt!="") objO.innerHTML=inStrTxt;
				 		document.body.appendChild(objO);
				 		if(inStrTag=="iframe"){
				 			if (document.frames) {
				 				// this is for IE5 Mac, because it will only
				 				// allow access to the document object
				 				// of the IFrame if we access it through
				 				// the document.frames array
				 				objO = document.frames[locID];
				 			}
				 		}
				 	}
				 
				 	if(inStrTag=="iframe"){//special iframe code...
				 		var IFrameDoc;
				 		if (navigator.userAgent.indexOf('Gecko') !=-1 && !objO.contentDocument) {
				 			// we have to give NS6 a fraction of a second
				 			// to recognize the new IFrame
				 			setTimeout('writeElement()',10);
				 			return;
				 		}
				 
				 		if(objO.contentDocument){
				 			// For NS6
				 			IFrameDoc = objO.contentDocument;
				 		}else if(objO.contentWindow){
				 			// For IE5.5 and IE6
				 			IFrameDoc = objO.contentWindow.document;
				 		}else{
				 			return;
				 		}
				 		locSrc=unescape(locSrc)
				 		IFrameDoc.location.replace(locSrc);
				 	}
				 }
				 
				 function writeHiddenIframe(inStrSrc){
				 	//seperated by spaces(delimeter 1) and = (delimeter 2)
				 	inStrSrc=escape(inStrSrc);
				 	var strAttribs="src="+inStrSrc+" style=border:0px;width:0px;height:0px;"
				 	writeElement("iframe",strAttribs,"")
				 }




				 
				  //Pixel Selector functions
				  
				  var timeHandler;
				  var strRedirectURL;
				  var intMinimumDelay;

				  function fnCallPixelSelector(PixelSelectorURL,pid)
				  {
				      var eid = getEidFromCookie();if(eid == "") document.location.replace("http://www.pch.com");
				      var content =getMetaContent();if(content =="") document.location.replace("http://www.pch.com");
				      var i = content.indexOf(';',0);
				      var delay = content.substring(0,i);
				      var url = content.substring(i + 5, content.length) ;
				      delay =  parseInt(delay) * 1000;
				      strRedirectURL = PixelSelectorURL + "?eid=" +  eid  + "&pid=" + pid + "&url=" + url ;
				      fnDelay();
				  } 
				  
				  // delay is used by PixelSelector  
				  function fnDelay()
				  { 
			          	var delay = (parseInt(intMinimumDelay) * 1000) - 500;
			          	timeHandler = window.setTimeout("NavigatePage()", delay);
		    	  	  }   
		    	  
				  function NavigatePage()
				  {
				      window.clearInterval(timeHandler);
				      window.location = strRedirectURL;
				  }
				  
				 function getMetaContent() 
				  {
				      var metas = document.getElementsByTagName('META');
				      var url='';
				      var i;
				      var iDelay = 0;
				      var retURL='';
				      intMinimumDelay=iDelay;
				      for(i = 0;i < metas.length;i++)
				      {

			            	if( metas[i].httpEquiv == 'refresh')
			            	{
			               	 url = metas[i].getAttribute('CONTENT');	
			              	  var arrContent = url.split(';');
			              	  if ( arrContent.length > 1 )
			              	  {
			                  	  if ( arrContent[0] != '' )
			                  	  {
			                     	   var delay = parseInt(arrContent[0]);
			                    	    if ((iDelay == 0) ||( iDelay > delay ))
			                    	    {
			                   	         retURL = url;
			                    	        iDelay = delay;
			                   	         intMinimumDelay = iDelay;
			                 	       }
			                 	   }
			               	 	}
			             	}
				      }	
				      return retURL;
				  }
				  
				  function getEidFromCookie() 
				  {
				      var eid="";
				      var sbS= document.cookie.indexOf('SB=');
				      if ( sbS != -1 )
				      {
				          var sbcookie =  document.cookie.substring(sbS,document.cookie.length);
				          sbcookie = decodeURI (sbcookie);
				          var eidS= sbcookie.indexOf('eid');
				          var eidE= sbcookie.indexOf('%3b',eidS);
				          eid = sbcookie.substring(eidS + 6,eidE);
				      }
				      return eid;
				  }
