home *** CD-ROM | disk | FTP | other *** search
/ 24.172.56.42 / 24.172.56.42.tar / 24.172.56.42 / art.categories.php_files / show_ads < prev    next >
Text File  |  2006-01-16  |  10KB  |  317 lines

  1. google_ad_url = '';
  2. google_date = new Date();
  3. google_random = google_date.getTime();
  4. google_org_error_handler = window.onerror;
  5.  
  6. function quoted(str) {
  7.   return (str != null) ? '"' + str + '"' : '""';
  8. }
  9.  
  10. function google_encodeURIComponent(str) {
  11.   if (typeof(encodeURIComponent) == 'function') {
  12.     return encodeURIComponent(str);
  13.   } else {
  14.     return escape(str);
  15.   }
  16. }
  17.  
  18. function google_write_tracker(tracker_event) {
  19.   var qloc = window.google_ad_url.indexOf('?');
  20.   var img_src = 'http://pagead2.googlesyndication.com/pagead/imp.gif?event=';
  21.   img_src += tracker_event;
  22.   if (qloc != -1 && qloc+1 < window.google_ad_url.length) {
  23.     img_src += '&' + window.google_ad_url.substring(qloc+1);
  24.   }
  25.   var img_tag = '<i' + 'mg height="1" width="1" border="0" ' +
  26.                 'src=' + quoted(img_src) +
  27.                 ' />';
  28.   document.write(img_tag);
  29. }
  30.  
  31. function google_append_url(param, value) {
  32.   if (value) {
  33.     window.google_ad_url += '&' + param + '=' + value;
  34.   }
  35. }
  36.  
  37. function google_append_url_esc(param, value) {
  38.   if (value) {
  39.     google_append_url(param, google_encodeURIComponent(value));
  40.   }
  41. }
  42.  
  43. function google_append_color(param, value) {
  44.   if (value && typeof(value) == 'object') {
  45.     value = value[window.google_random % value.length];
  46.   }
  47.   google_append_url('color_' + param, value);
  48. }
  49.  
  50. function google_get_user_data() {
  51.   var javaEnabled = navigator.javaEnabled();
  52.   var tz = -google_date.getTimezoneOffset();
  53.  
  54.   if (window.screen) {
  55.     google_append_url("u_h", window.screen.height);
  56.     google_append_url("u_w", window.screen.width);
  57.     google_append_url("u_ah", window.screen.availHeight);
  58.     google_append_url("u_aw", window.screen.availWidth);
  59.     google_append_url("u_cd", window.screen.colorDepth);
  60.   }
  61.  
  62.   google_append_url("u_tz", tz);
  63.   google_append_url("u_his", history.length);
  64.   google_append_url("u_java", javaEnabled);
  65.  
  66.   if (navigator.plugins) {
  67.     google_append_url("u_nplug", navigator.plugins.length);
  68.   }
  69.   if (navigator.mimeTypes) {
  70.     google_append_url("u_nmime", navigator.mimeTypes.length);
  71.   }
  72. }
  73.  
  74. function google_show_ad() {
  75.   var w = window;
  76.   w.onerror = w.google_org_error_handler;
  77.  
  78.   if (w.google_ad_region == null && w.google_ad_section != null) {
  79.     w.google_ad_region = w.google_ad_section;
  80.   }
  81.  
  82.   if (w.google_ad_format) {
  83.     google_is_zero_ad_format=((w.google_ad_format).indexOf('_0ads'))>0;
  84.   } else {
  85.     google_is_zero_ad_format=false;
  86.   }
  87.  
  88.   if (google_is_zero_ad_format) {
  89.     if (w.google_num_0ad_slots) {
  90.       w.google_num_0ad_slots = w.google_num_0ad_slots +1;
  91.     } else {
  92.       w.google_num_0ad_slots = 1;
  93.     }
  94.  
  95.     if (w.google_num_0ad_slots>1) {
  96.       return;
  97.     }
  98.   } else {
  99.     if (w.google_num_ad_slots) {
  100.       w.google_num_ad_slots = w.google_num_ad_slots + 1;
  101.     } else {
  102.       w.google_num_ad_slots = 1;
  103.     }
  104.  
  105.     if (w.google_num_slots_to_rotate) {
  106.       w.google_prev_ad_formats = null;
  107.       if (w.google_num_slot_to_show == null) {
  108.         w.google_num_slot_to_show = w.google_random % w.google_num_slots_to_rotate
  109.                                     + 1;
  110.       }
  111.       if (w.google_num_slot_to_show != w.google_num_ad_slots) {
  112.         return;
  113.       }
  114.     } else if (w.google_num_ad_slots > 3 && w.google_ad_region == null) {
  115.       return;
  116.     }
  117.   }
  118.  
  119.   w.google_ad_url = 'http://pagead2.googlesyndication.com/pagead/ads?';
  120.   w.google_ad_client = w.google_ad_client.toLowerCase();
  121.   if (w.google_ad_client.substring(0,3) != 'ca-') {
  122.      w.google_ad_client = 'ca-' + w.google_ad_client;
  123.   }
  124.   w.google_ad_url += 'client=' + escape(w.google_ad_client) +
  125.                      '&dt=' + w.google_date.getTime();
  126.  
  127.   google_append_url('hl', w.google_language);
  128.   if (w.google_country) {
  129.     google_append_url('gl', w.google_country);
  130.   } else {
  131.     google_append_url('gl', w.google_gl);
  132.   }
  133.   google_append_url('gr', w.google_region);
  134.   google_append_url_esc('gcs', w.google_city);
  135.   google_append_url_esc('hints', w.google_hints);
  136.   google_append_url('adsafe', w.google_safe);
  137.   google_append_url('oe', w.google_encoding);
  138.   google_append_url('lmt', w.google_last_modified_time);
  139.   google_append_url_esc('alternate_ad_url', w.google_alternate_ad_url);
  140.   google_append_url('alt_color', w.google_alternate_color);
  141.   google_append_url("skip", w.google_skip);
  142.  
  143.   if (w.google_prev_ad_formats) {
  144.     google_append_url_esc('prev_fmts', w.google_prev_ad_formats.toLowerCase());
  145.   }
  146.  
  147.   if (w.google_ad_format) {
  148.     google_append_url_esc('format', w.google_ad_format.toLowerCase());
  149.     if (w.google_prev_ad_formats) {
  150.       w.google_prev_ad_formats = w.google_prev_ad_formats + ',' + w.google_ad_format;
  151.     } else {
  152.       w.google_prev_ad_formats = w.google_ad_format;
  153.     }
  154.   }
  155.  
  156.   google_append_url('num_ads', w.google_max_num_ads);
  157.   google_append_url('output', w.google_ad_output);
  158.   google_append_url('adtest', w.google_adtest);
  159.  
  160.   if (w.google_ad_channel) {
  161.     var chnl = w.google_ad_channel.toLowerCase();
  162.     google_append_url_esc('channel', chnl);
  163.     var pv_ch = '';
  164.     var arr = chnl.split('+');
  165.     for (var i = 0; i < arr.length; i++) {
  166.       var ch = arr[i];
  167.       if (!w.google_num_slots_by_channel[ch]) {
  168.         w.google_num_slots_by_channel[ch] = 1;
  169.       } else {
  170.         pv_ch += ch + '+';
  171.       }
  172.     }
  173.     google_append_url_esc('pv_ch', pv_ch);
  174.   }
  175.  
  176.   google_append_url_esc('url', w.google_page_url);
  177.   google_append_color('bg', w.google_color_bg);
  178.   google_append_color('text', w.google_color_text);
  179.   google_append_color('link', w.google_color_link);
  180.   google_append_color('url', w.google_color_url);
  181.   google_append_color('border', w.google_color_border);
  182.   google_append_color('line', w.google_color_line);
  183.   google_append_url('kw_type', w.google_kw_type);
  184.   google_append_url_esc('kw', w.google_kw);
  185.   google_append_url_esc('contents', w.google_contents);
  186.   google_append_url('num_radlinks', w.google_num_radlinks);
  187.   google_append_url('max_radlink_len', w.google_max_radlink_len);
  188.   google_append_url('rl_filtering', w.google_rl_filtering);
  189.   google_append_url('rl_mode', w.google_rl_mode);
  190.   google_append_url('rt', w.google_rt);
  191.   google_append_url('ad_type', w.google_ad_type);
  192.   google_append_url('image_size', w.google_image_size);
  193.   google_append_url('region', w.google_ad_region);
  194.   google_append_url('feedback_link', w.google_feedback);
  195.   google_append_url_esc('ref', w.google_referrer_url);
  196.   google_append_url_esc('loc', w.google_page_location);
  197.   if (document.body) {
  198.     var scr_h = document.body.scrollHeight;
  199.     var clt_h = document.body.clientHeight;
  200.     if (clt_h && scr_h) {
  201.       google_append_url_esc('cc', Math.round(clt_h*100/scr_h));
  202.     }
  203.   }
  204.   google_get_user_data();
  205.  
  206.   w.google_ad_url = w.google_ad_url.substring(0, 1000);
  207.   w.google_ad_url = w.google_ad_url.replace(/%\w?$/, '');
  208.  
  209.   if (google_ad_output == 'js' &&
  210.       (w.google_ad_request_done || w.google_radlink_request_done)) {
  211.     document.write('<scr' + 'ipt language="JavaScript1.1"' +
  212.                    ' src=' + quoted(google_ad_url) +
  213.                    '></scr' + 'ipt>');
  214.   } else if (google_ad_output == 'html') {
  215.     if (w.name == 'google_ads_frame') {
  216.       google_write_tracker('reboundredirect');
  217.     } else {
  218.       document.write('<ifr' + 'ame' +
  219.                      ' name="google_ads_frame"' +
  220.                      ' width=' + quoted(w.google_ad_width) +
  221.                      ' height=' + quoted(w.google_ad_height) +
  222.                      ' frameborder=' + quoted(w.google_ad_frameborder) +
  223.                      ' src=' + quoted(w.google_ad_url) +
  224.                      ' marginwidth="0"' +
  225.                      ' marginheight="0"' +
  226.                      ' vspace="0"' +
  227.                      ' hspace="0"' +
  228.                      ' allowtransparency="true"' +
  229.                      ' scrolling="no">');
  230.       google_write_tracker('noiframe');
  231.       document.write('</ifr' + 'ame>');
  232.     }
  233.   }
  234.  
  235.   w.google_ad_frameborder = null;
  236.   w.google_ad_format = null;
  237.   w.google_page_url = null;
  238.   w.google_language = null;
  239.   w.google_gl = null;
  240.   w.google_country = null;
  241.   w.google_region = null;
  242.   w.google_city = null;
  243.   w.google_hints = null;
  244.   w.google_safe = null;
  245.   w.google_encoding = null;
  246.   w.google_ad_output = null;
  247.   w.google_max_num_ads = null;
  248.   w.google_ad_channel = null;
  249.   w.google_contents = null;
  250.   w.google_alternate_ad_url = null;
  251.   w.google_alternate_color = null;
  252.   w.google_color_bg = null;
  253.   w.google_color_text = null;
  254.   w.google_color_link = null;
  255.   w.google_color_url = null;
  256.   w.google_color_border = null;
  257.   w.google_color_line = null;
  258.   w.google_adtest = null;
  259.   w.google_kw_type = null;
  260.   w.google_kw = null;
  261.   w.google_num_radlinks = null;
  262.   w.google_max_radlink_len = null;
  263.   w.google_rl_filtering = null;
  264.   w.google_rl_mode = null;
  265.   w.google_rt = null;
  266.   w.google_ad_type = null;
  267.   w.google_image_size = null;
  268.   w.google_feedback = null;
  269.   w.google_skip = null;
  270.   w.google_page_location = null;
  271.   w.google_referrer_url = null;
  272.   w.google_ad_region = null;
  273.   w.google_ad_section = null;
  274. }
  275.  
  276. function google_error_handler(message, url, line) {
  277.   google_show_ad();
  278.   return true;
  279. }
  280.  
  281. window.onerror = google_error_handler;
  282.  
  283. if (window.google_ad_frameborder == null) {
  284.   google_ad_frameborder = 0;
  285. }
  286.  
  287. if (window.google_ad_output == null) {
  288.   google_ad_output = 'html';
  289. }
  290.  
  291. if (window.google_ad_format == null && window.google_ad_output == 'html') {
  292.   google_ad_format = google_ad_width + 'x' + google_ad_height;
  293. }
  294.  
  295. if (window.google_page_url == null) {
  296.   google_page_url = document.referrer;
  297.   if (window.top.location == document.location) {
  298.     google_page_url = document.location;
  299.     google_last_modified_time = Date.parse(document.lastModified) / 1000;
  300.     google_referrer_url = document.referrer;
  301.   }
  302. } else {
  303.   google_page_location = document.referrer;
  304.   if (window.top.location == document.location) {
  305.     google_page_location = document.location;
  306.   }
  307. }
  308.  
  309. if (window.google_num_slots_by_channel == null) {
  310.   google_num_slots_by_channel = new Array();
  311. }
  312.  
  313. google_show_ad();
  314.  
  315.  
  316.  
  317.