home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 May / INTERNET103.ISO / pc / software / 1do3 / code / standard.js
Encoding:
Text File  |  2002-07-09  |  5.2 KB  |  138 lines

  1. var sven_appName="UN"; // Unknown
  2. var sven_appVersion=0; // Generally unknown
  3.  
  4. var days = new Object;
  5. var months = new Object;
  6.  
  7. days[0] = "Sunday";
  8. days[1] = "Monday";
  9. days[2] = "Tuesday";
  10. days[3] = "Wednesday";
  11. days[4] = "Thursday";
  12. days[5] = "Friday";
  13. days[6] = "Saturday";
  14.  
  15. months[0] = "Jan";
  16. months[1] = "Feb";
  17. months[2] = "Mar";
  18. months[3] = "Apr";
  19. months[4] = "May";
  20. months[5] = "Jun";
  21. months[6] = "Jul";
  22. months[7] = "Aug";
  23. months[8] = "Sep";
  24. months[9] = "Oct";
  25. months[10]= "Nov";
  26. months[11]= "Dec";
  27.  
  28. var msie=((navigator.appName.substring(0,9)=="Microsoft") && (navigator.appVersion.charAt(0)>=4));
  29.  
  30. function openChangePass() {
  31.         window.open("http://www.1do3.com/uk/user.php?m=changepass","winchangepass","location=no,directories=no,height=450,width=700,scrollbars=yes,status=no,toolbar=no");
  32. }
  33.  
  34. if (navigator.appName.indexOf("Opera")>-1){
  35.  sven_appName="OP";
  36. }else if (navigator.appName.substring(0,9)=="Microsoft"){
  37.  sven_appName="MS";
  38. }else if (navigator.appName.substring(0,8)=="Netscape"){
  39.  sven_appName="NS";
  40. }
  41.  
  42. sven_appVersion=navigator.appVersion.charAt(0);
  43. if (navigator.appVersion.indexOf("MSIE 5")>-1){
  44.  sven_appVersion=5; // MSIE5 reports 4.0 compatible, this is a reasonable fix
  45. }
  46.  
  47.  
  48. // Opens the public comments page in a new popup window
  49. function opencomments(coords){
  50. if (screen.height<768){
  51.   window.open("http://www.1do3.com/uk/page.php?x="+coords+"&m=comment","1do3comments","toolbar=no,scrollbars=yes,statusbar=yes,resize=no,width=400,height=500,left="+((screen.width-400)/2)+",top="+((screen.height-500)/2));
  52. }else{
  53.   window.open("http://www.1do3.com/uk/page.php?x="+coords+"&m=comment","1do3comments","toolbar=no,scrollbars=yes,statusbar=yes,resize=no,width=400,height=650,left="+((screen.width-400)/2)+",top="+((screen.height-650)/2));
  54. }
  55. }
  56.  
  57.  
  58. // Opens the private comments (feedback) page in a new popup window
  59. function openfeedback(coords){
  60.   window.open("http://www.1do3.com/uk/page.php?x="+coords+"&m=feedback","1do3feedback","toolbar=no,scrollbars=yes,resize=no,width=500,height=400,left="+((screen.width-500)/2)+",top="+((screen.height-400)/2));
  61. }
  62.  
  63. function opensubscription(){
  64.   window.open("http://www.1do3.com/uk/do.php?m=subscribe","1do3subscribe","toolbar=no,scrollbars=yes,resize=no,width=500,height=600,left="+((screen.width-500)/2)+",top="+((screen.height-600)/2));
  65. }
  66.  
  67. // Open the 'send to a friend' page in a popup
  68. function openemailfriend(coords){
  69.   window.open("http://www.1do3.com/uk/page.php?x="+coords+"&m=email","1do3sendfriend","toolbar=no,scrollbars=yes,resize=no,width=500,height=400,left="+((screen.width-500)/2)+",top="+((screen.height-400)/2));
  70. }
  71.  
  72.  
  73.  
  74. function sven_setHPOLD(){
  75.   if (sven_appName=="MS" && sven_appVersion>=5){
  76.     sven_sethome.setHomePage(document.location);
  77.   } else if (sven_appName=="OP"){
  78.     window.open("http://www.1do3.com/uk/home_opera.html","1do3homer","toolbar=no,scrollbars=yes,resize=yes,width=500,height=500,left="+((screen.width-500)/2)+",top="+((screen.height-500)/2));
  79.   } else {
  80.     window.open("http://www.1do3.com/uk/home_netscape.html","1do3homer","toolbar=no,scrollbars=yes,resize=yes,width=500,height=500,left="+((screen.width-500)/2)+",top="+((screen.height-500)/2));
  81. }
  82. }
  83.  
  84. function setHomePage(url) {
  85.     if (msie){
  86.         event.srcElement.style.behavior="url(#default#homepage)";
  87.         event.srcElement.setHomePage(url);
  88.     } else {
  89.         alert("This feature is not yet available for your browser.\n\nHome pages can usually be found in the 'Preferences' window of your browser, which can be found from one of the menus.\n\nYou should then have the option to set the current page as your home.");
  90.     }
  91. }
  92.  
  93.  
  94. function give_registrant(){
  95.   myLoginHandle=window.open("do.php?m=registrant","1do3login","width=500,height=500,left="+((screen.width-500)/2)+",top="+((screen.height-500)/2));
  96. }
  97.  
  98. function give_login(){
  99.   myLoginHandle=window.open("do.php?m=loginregister","1do3login","width=500,height=500,left="+((screen.width-500)/2)+",top="+((screen.height-500)/2));
  100. }
  101.  
  102. function give_register() { }
  103. give_register=give_login;
  104.  
  105.  
  106. function give_subscriber(){
  107.   window.open("http://www.1do3.com/uk/do.php?m=subscriber","1do3subscribe","toolbar=no,scrollbars=yes,resize=no,width=500,height=550,left="+((screen.width-500)/2)+",top="+((screen.height-550)/2));
  108. }
  109.  
  110. function give_subscribe(){
  111.   window.open("http://www.1do3.com/uk/do.php?m=subscribe","1do3subscribe","toolbar=no,scrollbars=yes,resize=no,width=500,height=550,left="+((screen.width-500)/2)+",top="+((screen.height-550)/2));
  112. }
  113.  
  114. function addToFaves(myCoords) {
  115.     window.open("http://www.1do3.com/uk/user.php?m=favourites&x="+myCoords,"DoFaves","status=no,width=550,heigh=250,left=40,top=40");
  116. }
  117.  
  118. // Search Stuff:
  119. var defaultQuery="Type here or click below";
  120. function clearSearch() { if (document.searchform.query.value==defaultQuery) document.searchform.query.value=""; }
  121. function resetSearch() { if (document.searchform.query.value=="") document.searchform.query.value=defaultQuery; }
  122. function verifySearch() { if (document.searchform.query.value==defaultQuery) { return false; } else { document.searchform.submit(); } }
  123.  
  124.  
  125.  
  126.  
  127. function GetDate() {
  128.  var date = new Date();
  129.  var year=date.getYear();
  130.  
  131.  var br=navigator.appVersion;
  132.  if (br.indexOf("3.")==-1) year=date.getFullYear();
  133. // return days[date.getday()] +" "+
  134.  return months[date.getMonth()] +" "+
  135.         date.getDate() +", "+
  136.         year;
  137. }
  138.