function windowtop(title, style){
   document.write('<table class="'+style+'" cellspacing="0" cellpadding="0" border="0">');
   document.write('   <tr class="'+style+'-top">');
   document.write('      <td class="'+style+'-top-left">');
   document.write('         &nbsp;');
   document.write('      </td>');
   document.write('      <td class="'+style+'-title">');
   document.write(          title);
   document.write('      </td>');
   document.write('      <td class="'+style+'-top-right">');
   document.write('         &nbsp;');
   document.write('      </td>');
   document.write('   </tr>');
   return true;
}
function windowelement(style, name, textident, description, id, ident, type, icon, isrotated, registered, left, right){
   if (left) {
      document.write('   <tr>');
      document.write('      <td class="'+style+'-content" colspan="3" valign="top">');
   }
   if (type == 'AGS') {
      document.write('         <table class="screensaver" cellspacing="0" cellpadding="0" border="0">');
      document.write('            <tr>');
      document.write('               <td class="checkbox" valign="top">');
      if (isrotated == 0) {
         document.write('               <a class="checkbox unchecked" id="c'+id+'" onclick="check('+id+', \''+textident+'\'); return false;" onmouseover="check_mouseover(this)" onmouseout="check_mouseout(this);"><img src="images/point.gif" width="20" height="21" alt="" /></a>');
      } else {
	   document.write('               <a class="checkbox checked" id="c'+id+'" onclick="check('+id+', \''+textident+'\'); return false;" onmouseover="check_mouseover(this)" onmouseout="check_mouseout(this);"><img src="images/point.gif" width="20" height="21" alt="" /></a>');
      }
      document.write('               </td>');
      document.write('               <td class="icon" valign="top" id="ss1'+id+'"');
      if (isrotated == 0) {
         document.write(' style="filter:alpha(Opacity=50)"');
      }
      document.write('>');
      document.write('                  <a href="product.html?id='+ident+'" onfocus="blur()" onclick="external.AddClick(\'myscreensavers\/'+textident+'\/icon\')"><img src="'+icon+'" class="icon" border="0"></a>');
      document.write('               </td>');
      document.write('               <td valign="top"><table class="bgwhite" cellpadding="0" cellspacing="0"><tr><td>');
      document.write('<a class="title" href="product.html?id='+ident+'" onfocus="blur()" onclick="external.AddClick(\'myscreensavers\/'+textident+'\/title\')">');
      document.write(name);
      document.write('</a>');
      if (registered == 1) {
         document.write('<span style="font-size:12px; font-weight:bold; margin-left:7px; background: #FFFFFF"> (Full version)</span>');
      }
      document.write('                  <div class="description">');
      document.write(                      description);
      document.write('                  </div>');
      document.write('               </td></tr><tr><td>');
      document.write('                  <table cellspacing="0" cellpadding="0" border="0" align="right" class="screensaverbottom">');
      document.write('                     <tr>');
      document.write('                        <td class="linkbottom" align="right">');
      document.write('                           <a href="#" class="preview" onclick="previewss('+id+'); external.AddClick(\'myscreensavers\/'+textident+'\/preview\'); return false;" onfocus="blur()">');
      document.write('                              Preview');
      document.write('                           </a>');
      document.write('                        </td>');
      document.write('                        <td class="linkbottom" align="right">');
      document.write('                           <a href="#" class="settings" onclick="configss('+id+'); external.AddClick(\'myscreensavers\/'+textident+'\/config\'); return false;" onfocus="blur()">');
      document.write('                              Settings');
      document.write('                           </a>');
      document.write('                        </td>');
      document.write('                        <td class="linkbottom" align="right">');
      document.write('                           <a href="product.html?id='+ident+'" class="learnmore" onfocus="blur()" onclick="external.AddClick(\'myscreensavers\/'+textident+'\/learn-more\')">');
      document.write('                              Learn More');
      document.write('                           </a>');
      document.write('                        </td>');
      document.write('                     </tr>');
      document.write('                  </table>');

      document.write('               </td></tr></table></td>');
      document.write('            </tr>');
      document.write('         </table>');
   } else {
      if (left) {
         document.write('         <table class="screensaver2" cellspacing="0" cellpadding="0" border="0">');
         document.write('            <tr>');
      }
      document.write('               <td class="checkbox" valign="top">');
      
      if (isrotated == 0) {
         document.write('               <a class="checkbox unchecked" id="c'+id+'" onclick="check('+id+', \''+textident+'\'); return false;" onmouseover="check_mouseover(this)" onmouseout="check_mouseout(this);"><img src="images/point.gif" width="20" height="21" alt="" /></a>');
      } else {
         document.write('               <a class="checkbox checked" id="c'+id+'" onclick="check('+id+', \''+textident+'\'); return false;" onmouseover="check_mouseover(this)" onmouseout="check_mouseout(this);"><img src="images/point.gif" width="20" height="21" alt="" /></a>');
      }
      document.write('               </td>');
      document.write('               <td class="icon2" valign="top" id="ss1'+id+'"');
      if (isrotated == 0) {
         document.write(' style="filter:alpha(Opacity=50)"');
      }
      document.write('>');
      document.write('                  <img src="'+icon+'" class="icon" width="32" height="32">');
      document.write('               </td>');
      document.write('               <td valign="top" width="194" align="left"><table class="bgwhite" cellpadding="0" cellspacing="0"><tr><td>');
     
      if (name.length>23) {
         document.write('                 <div class="title3" title="'+name+'">'+name.substring(0, 22)+'...</div>');
      } else {
         document.write('                 <div class="title3">'+name+'</div>');
      }
      document.write('               </td></tr><tr><td>');
      document.write('                  <table cellspacing="0" cellpadding="0" border="0" align="right" class="screensaverbottom">');
      document.write('                     <tr>');
      document.write('                        <td class="linkbottom" align="left">');
      document.write('                           <a href="#" class="preview" onclick="previewss('+id+'); return false;" onfocus="blur()">');
      document.write('                              Preview');
      document.write('                           </a>');
      document.write('                        </td>');
      document.write('                        <td class="linkbottom" align="right">');
      document.write('                           <a href="#" class="settings" onclick="configss('+id+'); return false;" onfocus="blur()">');
      document.write('                              Settings');
      document.write('                           </a>');
      document.write('                        </td>');
      document.write('                     </tr>');
      document.write('                  </table>');

      document.write('               </td></tr></table></td>');
      if (right) {
         document.write('            </tr>');
         document.write('         </table>');
      }
   }
   if (right) {
      document.write('      </td>');
      document.write('   </tr>');
   }
   return true;
}
function windownoelement(style) {
   document.write('   <tr>');
   document.write('      <td class="'+style+'-content" colspan="3" valign="top" style="font-size:12px; padding-left:10px; padding-top:20px; height:40px;">');
   document.write('         There are no Astro Gemini Screensavers. You can download more than 40 screensavers from the <a href="available.html">Download Section<\/a>');
   document.write('      </td>');
   document.write('   </tr>');
   return true;
}

function windowbottom(style){
   document.write('         <tr class="'+style+'-bottom">');
   document.write('            <td class="'+style+'-bottom-left">');
   document.write('               &nbsp;');
   document.write('            </td>');
   document.write('            <td class="'+style+'-bottom-center">');
   document.write('               &nbsp;');
   document.write('            </td>');
   document.write('            <td class="'+style+'-bottom-right">');
   document.write('               &nbsp;');
   document.write('            </td>');
   document.write('         </tr>');
   document.write('      </table>');
   return true;
}
function windowdownload (style, id, title, iconpath, installed, textident) {
   document.write('   <tr >');
   if (installed == 0) {
      document.write('      <td class="'+style+'-content" colspan="3" valign="top">');
      document.write(          '<a href="current.html" onfocus="blur()" onclick="external.DownloadSSbyID('+id+'); external.AddClick(\'available\/'+textident+'\/icon\')" title="Download"><img src="'+iconpath+'" alt="" width="50" height="50" align="left" hspace="7" vspace="10"></a>');
      document.write(          '<a href="current.html" class="download" onfocus="blur()" onclick="external.DownloadSSbyID('+id+');  external.AddClick(\'available\/'+textident+'\/title\');" title="Download"><img src="images/icon/download.gif" border="0">'+title+'</a>');
   } 
   if (installed == 1) {
      document.write('      <td class="'+style+'-content" colspan="3" valign="top" style="background:#DEF0DC">');
      document.write(          '<a href="product.html?id='+id+'" onfocus="blur()" onclick="external.AddClick(\'available\/'+textident+'\/icon\');" title="Installed"><img src="'+iconpath+'" alt="" width="50" height="50" align="left" hspace="7" vspace="10"></a>');
      document.write(          '<a href="product.html?id='+id+'" class="download" onfocus="blur()" onclick="external.AddClick(\'available\/'+textident+'\/title\')" title="Installed"><img src="images/icon/installed.gif" border="0">'+title+'</a>');
   } 
   if (installed == 2) {
      document.write('      <td class="'+style+'-content" colspan="3" valign="top" style="background:#F9E7DA">');
      document.write(          '<a href="current.html" onfocus="blur()" onclick="external.DownloadSSbyID('+id+');external.AddClick(\'available\/'+title+'\/icon\');" title="Downloading..."><img src="'+iconpath+'" alt="" width="50" height="50" align="left" hspace="7" vspace="10"></a>');
      document.write(          '<a href="current.html" class="download" onfocus="blur()" onclick="external.DownloadSSbyID('+id+');  external.AddClick(\'available\/'+textident+'\/title\')" title="Downloading..."><img src="images/icon/download2.gif" border="0">'+title+'</a>');
   } 
   document.write('      </td>');
   document.write('   </tr>');
   return true;
}
function winopen(uri, wdt, hgt) {
   l = Math.round((screen.width-wdt)/2);
   t = Math.round((screen.height-hgt)/2);
   try {
      if (parent.main.screenshot) { 
         parent.main.screenshot.focus();
      } else {
         screenshot = window.open(uri, "", "status=no,menubar=no,toolbar=no,resizable=yes,scrollbars=no,location=no,width="+wdt+",height="+hgt+",left="+l+",top="+t);
      }
   } catch(e) {
      screenshot = window.open(uri, "", "status=no,menubar=no,toolbar=no,resizable=yes,scrollbars=no,location=no,width="+wdt+",height="+hgt+",left="+l+",top="+t);
   }

   return true;
}
function windowscreenshots(style, screenshot1, screenshot2, screenshot3, textident, cat) {
   document.write('   <tr>');
   document.write('      <td class="'+style+'-content" colspan="3" valign="top">');
   document.write('         <table width="100%" cellspacing="5" cellpadding="0" border="0">');
   document.write('            <tr align="center">');
   document.write('               <td>');
   document.write('                  <a href="#" onfocus="blur()" onclick="winopen(\'http://www.astrogemini.com/screensavers/'+cat+'/'+textident+'/screenshots/1.html\', 640, 548); external.AddClick(\'product\/screenshot1\/'+textident+'\')"><img src="'+screenshot1+'" class="screenshot" width="120" height="90"></a>');
   document.write('               </td>');
   document.write('               <td>');
   document.write('                  <a href="#" onfocus="blur()" onclick="winopen(\'http://www.astrogemini.com/screensavers/'+cat+'/'+textident+'/screenshots/2.html\', 640, 548); external.AddClick(\'product\/screenshot2\/'+textident+'\')"><img src="'+screenshot2+'" class="screenshot" width="120" height="90"></a>');
   document.write('               </td>');
   document.write('               <td>');
   document.write('                  <a href="#" onfocus="blur()" onclick="winopen(\'http://www.astrogemini.com/screensavers/'+cat+'/'+textident+'/screenshots/3.html\', 640, 548); external.AddClick(\'product\/screenshot3\/'+textident+'\')"><img src="'+screenshot3+'" class="screenshot" width="120" height="90"></a>');
   document.write('               </td>');
   document.write('            </tr>');
   document.write('         </table>');
   document.write('      </td>');
   document.write('   </tr>');
   return true;
}
function windowfeatures(style, features) {
   document.write('   <tr>');
   document.write('      <td class="'+style+'-content" colspan="3" valign="top">');
   document.write('         <ul class="features">');
   features = features.replace(/(^\s+)|(\s+$)/g, "");
   a = features.split('\r\n');
   for (i=0; i<a.length; i++) {
      document.write('<li>'+a[i]);
   }
   document.write('         </ul>');
   document.write('      </td>');
   document.write('   </tr>');
   return true;
}
function windowassoc(style, id, title, textident, iconpath) {
   document.write('   <tr>');
   document.write('      <td class="'+style+'-content" colspan="3" valign="top">');
   if (textident == '') {
      document.write('<img src="'+iconpath+'" alt="" align="left" hspace="7" vspace="10" style="margin-left:18px;">');
      document.write('<div class="assoc-title">'+title+'</div>');
   } else {
      document.write('<a href="product.html?id='+id+'" onfocus="blur()" onclick="external.AddClick(\'product\/assoc\/logo\/'+textident+'\');"><img src="'+iconpath+'" alt="" width="50" height="50" align="left" hspace="7" vspace="10"></a>');
      document.write('<a href="product.html?id='+id+'" class="download" onfocus="blur()" onclick="external.AddClick(\'product\/assoc\/title\/'+textident+'\');">'+title+'</a>');
   }
   document.write('      </td>');
   document.write('   </tr>');
   return true;
}
function windowmore(style) {
   n = external.GetSSCount();
   document.write('   <tr>');
   document.write('      <td class="'+style+'-content" colspan="3" valign="top" align="center">');
   document.write('         <a href="myscreensavers.html" onfocus="blur()" onclick="external.AddClick(\'product\/assoc\/more\');" class="download"><b>More screensavers ('+n+')</b></a>');
   document.write('      </td>');
   document.write('   </tr>');
   return true;
}

function windowfeatured(style, title, desc, id, textident, is_default_guide) {
   document.write('   <tr>');
   document.write('      <td class="'+style+'-content" colspan="3" valign="top" style="height:183px;">');
   document.write('         <table width="100%" cellspacing="0" cellpadding="0" border="0">');
   document.write('            <tr>');
   document.write('               <td class="title-featured" align="center" colspan="2">');
   document.write('                 <a href="product.html?id='+id+'" class="title-featured" onfocus="blur()" onclick="external.AddClick(\'guide\/featured-ss\/'+textident+'\/title\')">'+title+'</a>');
   document.write('               </td>');
   document.write('            </tr>');
   document.write('            <tr>');
   document.write('               <td class="logo-featured" align="center" valign="top">');
   if (is_default_guide == 1) {
      document.write('                 <a href="product.html?id='+id+'" onfocus="blur()" onclick="external.AddClick(\'guide\/featured-ss\/'+textident+'\/logo\')"><img src="catalog/screenshots/top-logo-default.jpg" width="124" style="margin-left:14px; margin-right:6px;"></a>');
   } else {
      document.write('                 <a href="product.html?id='+id+'" onfocus="blur()" onclick="external.AddClick(\'guide\/featured-ss\/'+textident+'\/logo\')"><img src="catalog/screenshots/top-logo.jpg" width="124" style="margin-left:14px; margin-right:6px;"></a>');
   }
   document.write('               </td>');
   document.write('               <td class="desc-featured" valign="top" style="padding-right: 14px;">');
   document.write(                   desc);
   document.write('               </td>');
   document.write('            </tr>');
   document.write('         </table>');
   document.write('         <table width="100%" cellspacing="0" cellpadding="0" border="0" style="margin-top:15px;">');
   document.write('            <tr align="center">');
   document.write('               <td>');
   document.write('                 <a href="product.html?id='+id+'" onfocus="blur()" onclick="closeAll(1);external.AddClick(\'guide\/featured-ss\/'+textident+'\/more-info\')"><img src="images/button/more-info.gif"></a>');
   document.write('               </td>');
   document.write('               <td>');
   document.write('                 <a href="current.html" onfocus="blur()" onclick="openmenu(\'menu-downloads\', 1); activelink(2, 1); external.DownloadSSbyID('+id+');external.AddClick(\'guide\/featured-ss\/'+textident+'\/download\')"><img src="images/button/download2.gif">');
   document.write('               </td>');
   document.write('            </tr>');
   document.write('         </table>');
   document.write('      </td>');
   document.write('   </tr>');
   return true;
}
function windowfeatured3(style, title, logo, id, textident) {
   document.write('   <tr>');
   document.write('      <td class="'+style+'-content" colspan="3" valign="top">');
   document.write(          '<a href="product.html?id='+id+'" onfocus="blur()" onclick="closeAll(1);external.AddClick(\'guide\/featured-ss3\/'+textident+'\/logo\')"><img src="'+logo+'" alt="" width="50" height="50" align="left" hspace="7" vspace="10"></a>');
   document.write(          '<a href="product.html?id='+id+'" class="download" onfocus="blur()" onclick="closeAll(1);external.AddClick(\'guide\/featured-ss3\/'+textident+'\/title\')">'+title+'</a>');
   document.write('      </td>');
   document.write('   </tr>');
   return true;
}
function windowtop10(style, order1, title1, logo1, id1, textident1, order2, title2, logo2, id2, textident2) {
   document.write('   <tr>');
   document.write('      <td class="'+style+'-content" colspan="3" valign="top">');
   document.write('        <table cellspacing="0" cellpadding="0" border="0" width="100%">');
   document.write('           <tr valign="top">');
   document.write('             <td class="order-top10">');
   document.write(                order1+'.');
   document.write('             </td>');
   document.write('             <td class="logo-top10">');
   document.write('                <a href="product.html?id='+id1+'" onfocus="blur()" onclick="closeAll(1);external.AddClick(\'guide\/top10\/'+textident1+'\/logo\')"><img src="'+logo1+'"></a>');
   document.write('             </td>');
   document.write('             <td width="133">');
   document.write('                <a href="product.html?id='+id1+'" class="title-top10" onfocus="blur()" onclick="closeAll(1);external.AddClick(\'guide\/top10\/'+textident1+'\/title\')">'+title1+'</a>');
   document.write('             </td>');
   document.write('             <td class="order-top10">');
   document.write(                order2+'.');
   document.write('             </td>');
   document.write('             <td class="logo-top10">');
   document.write('                <a href="product.html?id='+id2+'" onfocus="blur()" onclick="closeAll(1);external.AddClick(\'guide\/top10\/'+textident2+'\/logo\')"><img src="'+logo2+'"></a>');
   document.write('             </td>');
   document.write('             <td width="133">');
   document.write('                <a href="product.html?id='+id2+'" class="title-top10" onfocus="blur()" onclick="closeAll(1);external.AddClick(\'guide\/top10\/'+textident2+'\/title\')">'+title2+'</a>');
   document.write('             </td>');
   document.write('           </tr>');
   document.write('        </table>');
   document.write('      </td>');
   document.write('   </tr>');
   return true;
}
function windowwhatsnew(style, title, logo, id, textident) {
   document.write('   <tr>');
   document.write('      <td class="'+style+'-content" colspan="3" valign="top" align="center">');
   document.write(          '<a href="product.html?id='+id+'"  class="logo-whatsnew" onfocus="blur()" onclick="closeAll(1);external.AddClick(\'guide\/whatsnew\/'+textident+'\/logo\')"><img src="'+logo+'"></a>');
   document.write(          '<a href="product.html?id='+id+'" class="title-whatsnew" onfocus="blur()" onclick="closeAll(1);external.AddClick(\'guide\/whatsnew\/'+textident+'\/title\')">'+title+'</a>');
   document.write('      </td>');
   document.write('   </tr>');
   return true;
}
function windowmyss(style) {
   n = external.GetSSCount();
   a1 = external.GetAGSSCount();
   if (a1 == 0) {
      a = 'none';
   } else if (a1 == 1) {
      a = 'one';
   } else {
      a = a1;
   }
   document.write('   <tr>');
   document.write('      <td class="'+style+'-content" colspan="3" valign="top">');
   document.write('        <div class="myss">');
   document.write('           You have <a href="myscreensavers.html" class="link2" onfocus="blur()" onclick="external.AddClick(\'guide\/myss\')">'+n+' screensavers</a> installed on your computer, '+a+' of them by Astro Gemini Software.');
   document.write('        </div>');
   document.write('      </td>');
   document.write('   </tr>');
   return true;
}
function windowsubscribe(style) {
   document.write('   <tr>');
   document.write('      <td class="'+style+'-content" colspan="3" valign="top" style="background:url(\'images\/win\/blue\/subscribe-bg.jpg\') left top repeat-y">');
   document.write('        <div class="subscribe">');
   document.write('           Sign up for screensaver updates and special offers from Astro Gemini');
   document.write('        </div>');
   document.write('<div id="answer">&nbsp;</div>')
   document.write('        <form action="" method="post" onsubmit="subscribe();external.AddClick(\'guide\/subscribe\'); return false">');
   document.write('        <input type="text" name="email" class="subscribe2" id="text-email" value="Enter e-mail" onclick="subscribeinit()" onblur="subscribetext()" onkeyup="answerinit()"><br>');
   document.write(' 	      <input type="image" src="images/button/signup.jpg" class="button-subscribe" onfocus="blur()">');
   document.write('        </form>');
   document.write('      </td>');
   document.write('   </tr>');
   return true;
}
function answerinit() {
   document.getElementById('answer').innerHTML = '&nbsp;';
   return true;
}
function subscribeinit() {
   if (document.getElementById('text-email').value == 'Enter e-mail') {
      document.getElementById('text-email').value = '';
      document.getElementById('text-email').className = 'subscribe';
   }
   return true;
}
function subscribetext() {
   if (document.getElementById('text-email').value == '') {
      document.getElementById('text-email').value = 'Enter e-mail';
      document.getElementById('text-email').className = 'subscribe2';
   }
   return true;
}
function subscribe() {
   document.getElementById("answer").innerHTML = '&nbsp;';
   document.getElementById("text-email").style.background = '#E6EEFB';
   document.getElementById("text-email").setAttribute("disabled", "on");

   if (! (/^\w+[-_\.]*\w+@\w+-?\w+\.[a-z]{2,6}$/.test(document.getElementById('text-email').value))) {
      document.getElementById("answer").innerHTML = 'Invalid Email Address';
      document.getElementById("text-email").style.background = '#FFFFFF';
      document.getElementById("text-email").removeAttribute("disabled");
   } else {
   JsHttpRequest.query(
      'http://www.astrogemini.com/manager2/subscribe.php', 
      {'email': document.getElementById("email").value}, 
      function(result, errors) {
         text='&nbsp;';
         if (result["answer"] == '304') {
            text = 'Invalid Email Address';
            document.getElementById("answer").style.color = '#ED1B23';
         }
         if (result["answer"] == '300') {
            text = 'You\'re already subscribed';
            document.getElementById("answer").style.color = '#ED1B23';
         }
         if (result["answer"] == '200') {
            text = 'Successfully Subscribed';
            document.getElementById("answer").style.color = '#38B549';
         }
         document.getElementById("answer").innerHTML = text;
         document.getElementById("text-email").style.background = '#FFFFFF';
         document.getElementById("text-email").removeAttribute("disabled");
      }, 
      false
   );
   }
}