
// SET FUNCTIONS
function isset(varname)
{
   if (typeof(window[varname]) != 'undefined')
   {
      return true;
   }
   else
   {
      return false;
   }
}


function ArraySearch(item, arr)
{
   for (var i = 0; i < arr.length; i++)
   {
      if (item == arr[i])
      {
         return i;
      }
   }
   
   return false;
}




// SET BANNER AVIABLE PARAMETERS
banner_types = new Array(
                         'minisearch'
                        );

banner_widths = new Array(
                          120,
                          350
                         );

banner_heights = new Array(
                           90,
                           30
                          );

banner_backgrounds = new Array(
                               '#FFFFFF'
                              );

banner_borders = new Array(
                           '#000000',
                           ''
                          );




// CHECK IF PARAMETERS EXISTS
if (!isset('ha_banner_type'))
{
   ha_banner_type = banner_types[0];
}

if (!isset('ha_banner_width'))
{
   ha_banner_width = banner_widths[0];
}

if (!isset('ha_banner_height'))
{
   ha_banner_height = banner_heights[0];
}

if (!isset('ha_banner_background'))
{
   ha_banner_background = banner_backgrounds[0];
}

if (!isset('ha_banner_border'))
{
   ha_banner_border = banner_borders[0];
}



// CHECK IF PARAMETERS ARE CORRECT
if (ArraySearch(ha_banner_type, banner_types) == false)
{
   ha_banner_type = banner_types[0];
}

if (ArraySearch(ha_banner_width, banner_widths) == false)
{
   ha_banner_width = banner_widths[0];
}

if (ArraySearch(ha_banner_height, banner_heights) == false)
{
   ha_banner_height = banner_heights[0];
}

if (ArraySearch(ha_banner_background, banner_backgrounds) == false)
{
   ha_banner_background = banner_backgrounds[0];
}

if (ArraySearch(ha_banner_border, banner_borders) == false)
{
   ha_banner_border = banner_borders[0];
}





// PRINT HTML SOURCE
if (ha_banner_type == 'minisearch')
{
   document.write('\n');
   document.write('<div style="width:'+ha_banner_width+'px; height:'+ha_banner_height+'px; background-color:'+(ha_banner_border == '' ? ha_banner_background : ha_banner_border)+'; margin:0px; padding:0px; overflow:hidden;">\n');
   document.write('<div style="width:'+(ha_banner_width-2)+'px; height:1px; background-color:'+(ha_banner_border == '' ? ha_banner_background : ha_banner_border)+'; margin:0px; padding:0px; overflow:hidden;"><img src="http://hledej-aukce.cz/images/transparent.gif" width="10" height="1"></div>\n');
   document.write('<div style="width:'+(ha_banner_width-2)+'px; height:'+(ha_banner_height-2)+'px; background-color:'+ha_banner_background+'; margin:0px 1px; padding:0px; overflow:hidden; text-align:center;">\n');

   document.write('<form name="hasearch'+Math.round(Math.random()*1000)+'" action="http://hledej-aukce.cz/" method="get" style="margin:0px; padding:0px;" target="_blank">\n');

   if ((ha_banner_width == 120) && (ha_banner_height == 90))
   {
      document.write('<a href="http://hledej-aukce.cz/" target="_blank"><img src="http://hledej-aukce.cz/images/logo_110.gif" alt="Hledej-aukce.cz" style="width:110px; height:36px; margin:2px 0px 1px 0px; vertical-align:middle; border:none;"></a><br>\n');
      document.write('<input type="text" name="hledej" style="width:110px; height:20px; margin:0px; padding:0px; border:1px solid #a7a6aa; vertical-align:middle;"><br>\n');
      document.write('<input type="hidden" name="sourceid" value="'+window.location.href+'">\n');
      document.write('<input type="submit" value="Hledej" style="width:70px; height:23px; margin:1px 0px 0px 0px; padding:0px; vertical-align:middle;">\n');
   }
   
   if ((ha_banner_width == 350) && (ha_banner_height == 30))
   {
      document.write('<a href="http://hledej-aukce.cz/" target="_blank"><img src="http://hledej-aukce.cz/images/logo_82.gif" alt="Hledej-aukce.cz" style="width:82px; height:28px; margin:0px 10px 0px 2px; vertical-align:middle; border:none;"></a>\n');
      document.write('<input type="text" name="hledej" style="width:150px; height:20px; margin:0px; padding:0px; border:1px solid #a7a6aa; vertical-align:middle;">\n');
      document.write('<input type="hidden" name="sourceid" value="'+window.location.href+'">\n');
      document.write('<input type="submit" value="Hledej" style="width:70px; height:23px; margin:0px 0px 0px 10px; padding:0px; vertical-align:middle;">\n');
   }

   document.write('</form>\n');
   
   document.write('</div>\n');
   document.write('</div>\n');

}

