oisz_ad_url = '';
oisz_random = (new Date()).getTime();
oisz_org_error_handler = window.onerror;

function quoted(str) {
  return (str != null) ? '"' + str + '"' : '""';
}

function oisz_encodeURIComponent(str) {
  if (typeof(encodeURIComponent) == 'function') {
    return encodeURIComponent(str);
  } else {
    return escape(str);
  }
}


function oisz_append_url(param, value) {
  if (value) {
    window.oisz_ad_url += '&' + param + '=' + value;
  }
}

function oisz_append_url_esc(param, value) {
  if (value) {
    oisz_append_url(param, oisz_encodeURIComponent(value));
  }
}

function oisz_append_color(param, value) {
  if (value && typeof(value) == 'object') {
    value = value[window.oisz_random % value.length];
  }
  oisz_append_url('color_' + param, value);
}


function oisz_show_ad() {
  var w = window;
  w.onerror = w.oisz_org_error_handler;

//w.oisz_ad_url = 'http://ad.oisz.hu/www/ads.php?' +
//                    'media=' + escape(w.oisz_ad_media.toLowerCase()) +
//  w.oisz_ad_url = '/vhosts/ad.oisz.hu/www/ads.php?' +
//                    'media=' + w.oisz_ad_media +


//w.oisz_ad_url = '/vhosts/ad.oisz.hu/www/ads.php?' +
w.oisz_ad_url = 'http://ad.oisz.hu/ads.php?' +
                    'random=' + w.oisz_random;

  oisz_append_url('media', w.oisz_ad_media);
  oisz_append_url('xl', w.oisz_language);
  oisz_append_url('format', w.oisz_ad_format);
  oisz_append_url('id', w.oisz_id);
  oisz_append_url('text_size', w.oisz_text_size);
  oisz_append_url('gl', w.oisz_gl);
  oisz_append_url_esc('hints', w.oisz_hints);
  oisz_append_url('adsafe', w.oisz_safe);
  oisz_append_url('oe', w.oisz_encoding);
  oisz_append_url('lmt', w.oisz_last_modified_time);
  oisz_append_url_esc('alternate_ad_url', w.oisz_alternate_ad_url);

//  if (w.oisz_ad_format) {
//    oisz_append_url_esc('format', w.oisz_ad_format.toLowerCase());
//  }

  oisz_append_url('num_ads', w.oisz_max_num_ads);
  oisz_append_url('output', w.oisz_ad_output);
  oisz_append_url('adtest', w.oisz_adtest);
  if (w.oisz_ad_channel) {
    oisz_append_url_esc('channel', w.oisz_ad_channel.toLowerCase());
  }
  oisz_append_url_esc('page_url', w.oisz_page_url);
  oisz_append_color('bg', w.oisz_color_bg);
  oisz_append_color('text', w.oisz_color_text);
  oisz_append_color('title', w.oisz_color_title);
  oisz_append_color('url', w.oisz_color_url);
  oisz_append_color('border', w.oisz_color_border);
  oisz_append_color('footer', w.oisz_color_footer);
  oisz_append_url('border', w.oisz_ad_border);
  oisz_append_url('border_top', w.oisz_ad_border_top);
  oisz_append_url('border_left', w.oisz_ad_border_left);
  oisz_append_url('border_right', w.oisz_ad_border_right);
  oisz_append_url('border_bottom', w.oisz_ad_border_bottom);
  oisz_append_url('spacing', w.oisz_ad_spacing);
  oisz_append_url('width', w.oisz_ad_width);
  oisz_append_url('height', w.oisz_ad_height);
  oisz_append_url('kw_type', w.oisz_kw_type);
  oisz_append_url_esc('kw', w.oisz_kw);
  oisz_append_url_esc('contents', w.oisz_contents);
  oisz_append_url('num_radlinks', w.oisz_num_radlinks);
  oisz_append_url('max_radlink_len', w.oisz_max_radlink_len);

  w.oisz_ad_url = w.oisz_ad_url.substring(0, 1000);
  w.oisz_ad_url = w.oisz_ad_url.replace(/%\w?$/, '');

      document.write('<ifr' + 'ame' +
                     ' name="oisz_ads_frame"' +
                     ' width=' + quoted(w.oisz_ad_width) +
                     ' height=' + quoted(w.oisz_ad_height) +
                     ' frameborder=' + quoted(w.oisz_ad_frameborder) +
                     ' src=' + quoted(w.oisz_ad_url) +
                     ' marginwidth="0"' +
                     ' marginheight="0"' +
                     ' vspace="0"' +
                     ' hspace="0"' +
                     ' allowtransparency="true"' +
                     ' scrolling="no">');
      document.write('</ifr' + 'ame>');

  w.oisz_ad_frameborder = null;
  w.oisz_ad_format = null;
  w.oisz_page_url = null;
  w.oisz_text_size = null;
  w.oisz_language = null;
  w.oisz_gl = null;
  w.oisz_hints = null;
  w.oisz_safe = null;
  w.oisz_encoding = null;
  w.oisz_ad_output = null;
  w.oisz_max_num_ads = null;
  w.oisz_ad_channel = null;
  w.oisz_contents = null;
  w.oisz_alternate_ad_url = null;
  w.oisz_color_bg = null;
  w.oisz_color_text = null;
  w.oisz_color_title = null;
  w.oisz_color_url = null;
  w.oisz_color_border = null;
  w.oisz_color_footer = null;
  w.oisz_ad_media = null;
  w.oisz_ad_border = null;
  w.oisz_ad_border_top = null;
  w.oisz_ad_border_left = null;
  w.oisz_ad_border_right = null;
  w.oisz_ad_border_bottom = null;
  w.oisz_ad_spacing = null;
  w.oisz_ad_width = null;
  w.oisz_ad_height = null;
  w.oisz_adtest = null;
  w.oisz_kw_type = null;
  w.oisz_kw = null;
  w.oisz_num_radlinks = null;
  w.oisz_max_radlink_len = null;
}

function oisz_error_handler(message, url, line) {
  oisz_show_ad();
  return true;
}

window.onerror = oisz_error_handler;

if (window.oisz_ad_frameborder == null) {
  oisz_ad_frameborder = 0;
}

if (window.oisz_ad_output == null) {
  oisz_ad_output = 'html';
}

if (window.oisz_color_footer == null) {
    window.oisz_color_footer=window.oisz_color_border;
}

if (window.oisz_color_border == null) {
    window.oisz_ad_border= 0;
} else {
    window.oisz_ad_border= 1;
}

if (window.oisz_ad_spacing == null) {
    window.oisz_ad_spacing = 1;
}

if (window.oisz_ad_border == null) {
    window.oisz_ad_border= 0;
}

if (window.oisz_language == null) {
    window.oisz_language= 'hu';
}
if (window.oisz_text_size == null) {
    window.oisz_text_size= '11';
}

if (window.oisz_ad_border_left == null) {
    window.oisz_ad_border_left= window.oisz_ad_border;
}
if (window.oisz_ad_border_right == null) {
    window.oisz_ad_border_right= window.oisz_ad_border;
}
if (window.oisz_ad_border_top == null) {
    window.oisz_ad_border_top= window.oisz_ad_border;
}
if (window.oisz_ad_border_bottom == null) {
    window.oisz_ad_border_bottom= window.oisz_ad_border;
}



if (window.oisz_footer == null) {
    window.oisz_footer= 0;
}


if (window.oisz_page_url == null) {
  oisz_page_url = document.referrer;
  if (window.top.location == document.location) {
    oisz_page_url = document.location;
    oisz_last_modified_time = Date.parse(document.lastModified) / 1000;
  }
}
oisz_show_ad();

